/* ============================================
   MOBILE ADAPTATION — NeyroVerse Analytics
   ============================================ */

/* === ГАМБУРГЕР-КНОПКА === */
.mobile-hamburger {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 201;
    width: 40px;
    height: 40px;
    background: #1a202c;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.mobile-hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    border-radius: 1px;
    transition: all 0.3s;
}
.mobile-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.mobile-hamburger.active span:nth-child(2) { opacity: 0; }
.mobile-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* === МОБИЛЬНЫЙ OVERLAY === */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}
.mobile-overlay.show { display: block; }

/* === МОБИЛЬНАЯ АДАПТАЦИЯ (до 768px) === */
@media (max-width: 768px) {
    /* Показываем гамбургер */
    .mobile-hamburger { display: flex; }

    /* Sidebar — скрыт, показывается по клику */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }
    .sidebar.mobile-open {
        transform: translateX(0);
        display: flex !important;
    }

    /* Основной контент — на всю ширину */
    .main {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    /* Хедеры — отступ для гамбургера */
    .header, .chat-header, .chat-list-header {
        padding-left: 60px !important;
    }

    /* Status bar — на всю ширину */
    .status-bar {
        left: 0 !important;
    }

    /* === LANDING === */
    .hero { padding: 60px 15px 40px !important; }
    .hero h1 { font-size: 28px !important; }
    .hero p { font-size: 16px !important; }
    .features-grid, .pricing-grid { grid-template-columns: 1fr !important; padding: 0 15px; }
    .cta-section { padding: 40px 15px !important; }
    .top-nav { padding: 10px 15px !important; }
    .top-nav .nav-links { display: none; }

    /* === LOGIN === */
    .login-container { padding: 20px 15px !important; }
    .login-card { padding: 25px 20px !important; width: 100% !important; max-width: 100% !important; }

    /* === ONBOARDING === */
    .onboarding-container, .step-container { padding: 20px 15px !important; max-width: 100% !important; }

    /* === APP HOME === */
    .quick-stats { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .quick-actions { grid-template-columns: 1fr !important; }
    .welcome-banner { padding: 20px !important; }
    .welcome-banner h2 { font-size: 18px !important; }

    /* === DASHBOARD === */
    .metrics-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .two-columns, .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
    .metric-card .value { font-size: 22px !important; }
    .section { padding: 15px !important; }

    /* === AI CHAT === */
    .history-panel { display: none !important; }
    .chat-container { padding: 15px !important; }
    .message { gap: 10px; }
    .message-content { max-width: 90% !important; padding: 12px !important; }
    .chat-input-container { padding: 10px 15px !important; }

    /* === TEAM CHAT === */
    .chat-layout { flex-direction: column; }
    .chat-list-panel {
        width: 100% !important;
        height: auto;
        max-height: 100%;
        border-right: none !important;
        border-bottom: 1px solid #e2e8f0;
    }
    .chat-list-panel.hidden-mobile { display: none; }
    .chat-messages-panel {
        display: none;
        width: 100%;
    }
    .chat-messages-panel.active-mobile {
        display: flex !important;
        flex: 1;
    }
    .mobile-back-btn {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        background: none;
        border: none;
        color: #667eea;
        font-size: 14px;
        cursor: pointer;
        padding: 0;
        margin-right: 10px;
    }

    /* === REACTIVATION === */
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px !important; }
    .data-table { font-size: 12px !important; }
    .data-table th, .data-table td { padding: 8px 5px !important; }

    /* === SOURCES / CONNECT === */
    .sources-grid { grid-template-columns: 1fr !important; }

    /* === SETTINGS === */
    .settings-grid { grid-template-columns: 1fr !important; }
    .tabs { overflow-x: auto; white-space: nowrap; }
    .tab { padding: 10px 12px !important; font-size: 13px !important; }

    /* === BILLING === */
    .pricing-cards, .plans-grid { grid-template-columns: 1fr !important; }

    /* === ALERTS === */
    .alerts-grid { grid-template-columns: 1fr !important; }

    /* === МОДАЛКИ === */
    .modal { width: 95vw !important; max-width: 95vw !important; padding: 20px !important; margin: 10px; }

    /* === ОБЩЕЕ === */
    .content { padding: 15px !important; }
    h1 { font-size: 20px !important; }
    h2 { font-size: 17px !important; }
    .btn-primary, .btn-send, .btn-new-chat { padding: 10px 16px !important; }

    /* Таблицы — горизонтальный скролл */
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 500px; }
}

/* === МАЛЕНЬКИЕ ЭКРАНЫ (до 480px) === */
@media (max-width: 480px) {
    .quick-stats, .metrics-grid, .stats-grid { grid-template-columns: 1fr !important; }
    .hero h1 { font-size: 24px !important; }
    .status-bar { font-size: 10px !important; gap: 10px !important; padding: 0 8px !important; }
    .sb-tokens .label { display: none; }
    .sb-token-bar { width: 40px; }
}
