/* ═══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE - Menu & Component Reorganization Styles
   ═══════════════════════════════════════════════════════════════ */

/* ──────────────────────────────────────────────────────────────
   HAMBURGER BUTTON (Mobile only)
   ────────────────────────────────────────────────────────────── */

.mobile-menu-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ui-fg);
    cursor: pointer;
    padding: 0;
    border-radius: 6px;
    transition: background 0.12s ease;
    flex-shrink: 0;
    z-index: 5;
}

.mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.mobile-menu-btn:active {
    background: rgba(255, 255, 255, 0.12);
}

.mobile-menu-btn svg {
    width: 22px;
    height: 22px;
}

/* ──────────────────────────────────────────────────────────────
   MOBILE MENU OVERLAY & PANEL
   ────────────────────────────────────────────────────────────── */

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.mobile-menu-overlay.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: min(85vw, 320px);
    height: 100vh;
    background: var(--ui-panel);
    border-right: 1px solid var(--ui-panel-border);
    display: flex;
    flex-direction: column;
    z-index: 1001;
    animation: slideInLeft 0.3s ease;
    overflow-y: auto;
    scrollbar-width: thin;
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

.mobile-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.mobile-menu-title {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
}

.mobile-menu-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.mobile-menu-close:hover {
    background: #f3f4f6;
}

.mobile-menu-close svg {
    width: 20px;
    height: 20px;
}

.mobile-menu-content {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* ──────────────────────────────────────────────────────────────
   MENU SECTIONS
   ────────────────────────────────────────────────────────────── */

.mobile-menu-section {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-menu-section:last-child {
    border-bottom: none;
}

.mobile-menu-section-title {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    color: #1f2937;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease;
}

.mobile-menu-section-title:hover {
    background: #f9fafb;
}

.mobile-menu-section-title:active {
    background: #f3f4f6;
}

.mobile-menu-section-title svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: #6b7280;
}

.section-arrow {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #9ca3af;
}

.mobile-menu-section-content {
    display: none;
    padding: 4px 8px;
    background: #f9fafb;
}

.mobile-menu-section-content.open {
    display: block;
}

/* ──────────────────────────────────────────────────────────────
   MENU ITEMS
   ────────────────────────────────────────────────────────────── */

.mobile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 16px;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s ease;
    margin: 4px 8px;
}

.mobile-menu-item:hover {
    background: #f3f4f6;
}

.mobile-menu-item:active {
    background: #e5e7eb;
}

.mobile-menu-item span {
    flex: 1;
    text-align: left;
}

.mobile-menu-item svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.6;
    color: #6b7280;
}

/* ──────────────────────────────────────────────────────────────
   THEME SELECTOR IN MOBILE MENU
   ────────────────────────────────────────────────────────────── */

.mobile-menu-theme-selector {
    padding: 11px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-menu-item-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mobile-menu-theme-options {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mobile-menu-theme-btn {
    flex: 1;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    color: #374151;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.mobile-menu-theme-btn:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
}

.mobile-menu-theme-btn.active {
    background: #26a69a;
    border-color: #26a69a;
    color: white;
}

.mobile-menu-theme-btn svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

/* ──────────────────────────────────────────────────────────────
   RESPONSIVE TOPBAR ADJUSTMENTS — see layout.css + responsive.css
   (Topbar rules moved to avoid conflicts with new mobile architecture)
   ────────────────────────────────────────────────────────────── */

/* Show hamburger on mobile */
@media (max-width: 767px) {
    .mobile-menu-btn {
        display: flex;
    }
}

@media (min-width: 768px) {
    .mobile-menu-btn {
        display: none;
    }
    .mobile-menu-overlay {
        display: none;
    }
}

/* ──────────────────────────────────────────────────────────────
    MOBILE-SPECIFIC CHART LAYOUT — see layout.css
    (Rules moved to css/mobile/layout.css to avoid conflicts)
    ────────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────────────────────
   TOPBAR RESPONSIVE — see responsive.css
   ────────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────────────────────
   BOTTOM ACTION BAR (Future: for quick actions)
   ────────────────────────────────────────────────────────────── */

.mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--ui-panel);
    border-top: 1px solid var(--ui-panel-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    gap: 4px;
    padding: 0 8px;
}

.mobile-action-btn {
    flex: 1;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: var(--ui-fg);
    font-size: 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.mobile-action-btn:active {
    background: var(--ui-button-hover);
}

.mobile-action-btn svg {
    width: 20px;
    height: 20px;
}

/* ──────────────────────────────────────────────────────────────
   DARK/LIGHT MODE SUPPORT
   ────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
    /* Keep mobile menu LIGHT even in dark mode for better visibility */
    .mobile-menu-panel {
        background: #F3F4F6;
        border-right: 1px solid #e5e7eb;
    }

    .mobile-menu-overlay {
        background: rgba(0, 0, 0, 0.4);
    }

    .mobile-menu-header {
        background: #F3F4F6;
        border-bottom: 1px solid #e5e7eb;
        color: #1f2937;
    }

    .mobile-menu-title {
        color: #1f2937;
    }

    .mobile-menu-close {
        color: #6b7280;
        background: transparent;
    }

    .mobile-menu-close:hover {
        background: #e5e7eb;
    }

    .mobile-menu-section {
        border-bottom: 1px solid #e5e7eb;
    }

    .mobile-menu-section-title {
        background: #F3F4F6;
        color: #1f2937;
        border: none;
    }

    .mobile-menu-section-title:hover {
        background: #e5e7eb;
    }

    .mobile-menu-section-title svg {
        color: #6b7280;
    }

    .mobile-menu-section-content {
        background: #e5e7eb;
    }

    .mobile-menu-item {
        background: transparent;
        color: #374151;
        font-weight: 500;
        border: none;
    }

    .mobile-menu-item:hover {
        background: #e5e7eb;
    }

    .mobile-menu-item:active {
        background: #d1d5db;
    }

    .mobile-menu-item svg {
        color: #6b7280;
    }

    .mobile-menu-item-label {
        color: #374151;
    }

    .mobile-menu-theme-selector {
        background: transparent;
        border-top: 1px solid #e5e7eb;
        padding: 12px;
    }

    .mobile-menu-theme-btn {
        background: #e5e7eb;
        border: 1px solid #d1d5db;
        color: #374151;
        cursor: pointer;
    }

    .mobile-menu-theme-btn:hover {
        background: #d1d5db;
    }

    .mobile-menu-theme-btn.active {
        background: #26a69a;
        border-color: #26a69a;
        color: #ffffff;
    }
}

@media (prefers-color-scheme: light) {
    .mobile-menu-panel {
        background: #F3F4F6;
    }

    .mobile-menu-overlay {
        background: rgba(0, 0, 0, 0.4);
    }
}

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION BAR (Mobile-only quick access)
   ════════════════════════════════════════════════════════════ */

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 54px;
    background: rgba(255, 255, 255, 0.95);
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    z-index: 40;
    padding-bottom: max(0, env(safe-area-inset-bottom, 0px));
    gap: 0;
    padding: 0;
    backdrop-filter: blur(8px);
}

/* Show bottom nav only on mobile */
@media (max-width: 767px) {
    .mobile-bottom-nav {
        display: flex;
    }

    /* Adjust chart area to make room */
    #chart-layout-area {
        bottom: 22px;
    }

    /* Adjust status bar height */}

/* Hide on tablet and above */
@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }

    #chart-layout-area {
        bottom: 0;
    }
}

.mobile-nav-item {
    flex: 1;
    height: 54px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    border-top: 2px solid transparent;
    color: #6b7280;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
    position: relative;
    outline: none;
    padding-bottom: max(4px, env(safe-area-inset-bottom, 0px));
}

.mobile-nav-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #1f2937;
}

.mobile-nav-item:active {
    background: rgba(0, 0, 0, 0.06);
    color: #1f2937;
}

.mobile-nav-item.active {
    border-top-color: #26a69a;
    color: #26a69a;
    background: rgba(38, 166, 154, 0.08);
}

.mobile-nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.mobile-nav-item span {
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Individual nav item styling */
.mobile-nav-chart-types svg {
    color: #ef5350;
}

.mobile-nav-chart-types.active svg {
    color: #26a69a;
}

.mobile-nav-timeframes svg {
    color: #2962ff;
}

.mobile-nav-timeframes.active svg {
    color: #26a69a;
}

.mobile-nav-indicators svg {
    color: #ff9800;
}

.mobile-nav-indicators.active svg {
    color: #26a69a;
}

.mobile-nav-tools svg {
    color: #9c27b0;
}

.mobile-nav-tools.active svg {
    color: #26a69a;
}

.mobile-nav-menu svg {
    color: #757575;
}

.mobile-nav-menu.active svg {
    color: #26a69a;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mobile-nav-item {
        transition: background 0.15s step-end, color 0.15s step-end;
    }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
    .mobile-bottom-nav {
        background: rgba(15, 23, 42, 0.92);
        border-top-color: rgba(255, 255, 255, 0.06);
    }

    .mobile-nav-item {
        color: #d1d5db;
    }

    .mobile-nav-item:hover {
        background: rgba(255, 255, 255, 0.08);
        color: #f3f4f6;
    }

    .mobile-nav-item:active {
        background: rgba(255, 255, 255, 0.1);
        color: #f3f4f6;
    }

    .mobile-nav-item.active {
        background: rgba(38, 166, 154, 0.12);
        color: #26a69a;
    }
}

/* Light mode (default) */
@media (prefers-color-scheme: light) {
    .mobile-bottom-nav {
        background: rgba(255, 255, 255, 0.98);
        border-top-color: rgba(0, 0, 0, 0.06);
    }

    .mobile-nav-item {
        color: #6b7280;
    }

    .mobile-nav-item:hover {
        background: rgba(99, 102, 241, 0.06);
        color: #1f2937;
    }

    .mobile-nav-item:active {
        background: rgba(99, 102, 241, 0.08);
        color: #1f2937;
    }

    .mobile-nav-item.active {
        background: rgba(38, 166, 154, 0.08);
        color: #26a69a;
    }
}

/* ──────────────────────────────────────────────────────────────
   TOUCH DEVICE OPTIMIZATION
   ────────────────────────────────────────────────────────────── */

@media (hover: none) {
    .mobile-menu-item {
        padding: 14px 16px;
        margin: 6px 8px;
    }

    .mobile-menu-section-title {
        padding: 14px 16px;
    }

    .mobile-menu-btn {
        min-width: 48px;
        min-height: 48px;
    }
}

/* ──────────────────────────────────────────────────────────────
   ACCESSIBILITY & KEYBOARD NAVIGATION
   ────────────────────────────────────────────────────────────── */

.mobile-menu-btn:focus,
.mobile-menu-close:focus,
.mobile-menu-item:focus {
    outline: 2px solid #2962ff;
    outline-offset: 2px;
}

.mobile-menu-btn:focus-visible,
.mobile-menu-close:focus-visible,
.mobile-menu-item:focus-visible {
    outline: 2px solid #2962ff;
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mobile-menu-overlay,
    .mobile-menu-panel,
    .section-arrow,
    .mobile-menu-item {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ──────────────────────────────────────────────────────────────
    LANDSCAPE MODE (Mobile) - see layout.css
    (Chart layout rules moved to css/mobile/layout.css)
    ────────────────────────────────────────────────────────────── */

/* ──────────────────────────────────────────────────────────────
    SAFE AREA SUPPORT (Notched devices) — see layout.css
    (Chart layout rules moved to css/mobile/layout.css)
    ────────────────────────────────────────────────────────────── */
