/* ═══════════════════════════════════════════════════════════════════
   TradeMate VN — Responsive Breakpoints
   Mobile-first: base is mobile, scale up for larger screens
   ═══════════════════════════════════════════════════════════════════ */

/* ── Bottom Tab Bar (mobile only, app-style) ──────────── */
.tm-bottom-bar { display: none; }

@media (max-width: 768px) {
    /* ── Larger base font on mobile ── */
    html { font-size: 17px; }

    .tm-bottom-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 60px;
        background: var(--color-bg-secondary);
        border-top: 1px solid var(--color-border);
        z-index: var(--z-dropdown);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .tm-bottom-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        text-decoration: none;
        color: var(--color-text-muted);
        font-size: 0.75rem;
        font-weight: 500;
        padding: 6px 0;
        -webkit-tap-highlight-color: transparent;
        transition: color var(--transition-fast);
    }
    .tm-bottom-item.active {
        color: var(--color-primary);
        font-weight: 600;
    }
    .tm-bottom-item:active {
        opacity: 0.7;
    }
    .tm-bottom-icon { font-size: 24px; line-height: 1; }
    .tm-bottom-label { white-space: nowrap; }

    /* Main content padding-bottom to avoid bottom bar overlap */
    .tm-main { padding-bottom: 76px !important; }

    /* Hide hamburger when bottom bar is present */
    .tm-hamburger { display: none !important; }

    /* ── Sidebar nav: larger icons & text ── */
    .tm-nav-item {
        font-size: 1rem;
        padding: var(--space-md) var(--space-lg);
        gap: var(--space-lg);
        color: var(--color-text);
    }
    .tm-nav-icon { font-size: 22px; width: 28px; }
    .tm-nav-item.active { font-weight: 700; }

    /* ── Dashboard: merge style header + advice into 1 block ── */
    .tm-style-header {
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        margin-bottom: 0;
        border-bottom: 1px dashed var(--color-border);
    }
    .tm-advice-strip {
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        margin-bottom: var(--space-md);
        margin-top: 0;
        background: var(--color-bg-card);
        border: 1px solid var(--color-border);
        border-top: none;
    }
    /* When no advice strip, restore radius */
    .tm-style-header:last-child,
    .tm-style-header + .tm-market-strip-card {
        border-radius: var(--radius-lg);
    }

    /* ── Market strip: prominent card ── */
    .tm-market-strip {
        background: var(--color-bg-card);
        border: 1px solid var(--color-border);
        border-radius: var(--radius-lg);
        padding: var(--space-md) var(--space-lg);
        margin-bottom: var(--space-md);
        gap: var(--space-md);
    }
    .tm-chip {
        flex: 1;
        min-width: 0;
        justify-content: center;
        padding: var(--space-sm) var(--space-md);
        font-size: 1rem;
        border: none;
        background: var(--color-bg-secondary);
    }
    .tm-chip-label {
        font-size: 0.75rem;
        font-weight: 600;
        color: var(--color-text);
    }
    .tm-chip-value {
        font-size: 1rem;
        font-weight: 700;
    }
    .tm-chip-value small {
        font-size: 0.8rem;
    }
    .tm-regime-badge {
        font-size: 0.8rem;
        padding: 4px 12px;
    }

    /* ── Panel titles & body text larger ── */
    .tm-panel-title {
        font-size: 1rem;
    }
    .tm-panel-icon {
        font-size: 1.3rem;
    }
    .tm-panel-body {
        font-size: 1rem;
    }

    /* ── Style header text larger ── */
    .tm-style-header-name {
        font-size: 1.2rem;
    }
    .tm-style-header-meta {
        font-size: 0.85rem;
        color: var(--color-text-secondary);
    }
    .tm-style-header-icon {
        font-size: 2rem;
    }
    .tm-exposure-badge {
        font-size: 0.8rem;
        padding: 4px 12px;
    }

    /* ── Advice strip text ── */
    .tm-advice-action {
        font-size: 1rem;
    }
    .tm-advice-item {
        font-size: 0.85rem;
    }
    .tm-advice-label {
        color: var(--color-text);
        font-weight: 600;
    }
    .tm-advice-value {
        color: var(--color-text);
    }

    /* ── Stat chips larger ── */
    .tm-stat-chip-label {
        font-size: 0.75rem;
    }
    .tm-stat-chip-value {
        font-size: 1.1rem;
    }

    /* ── Table text larger ── */
    .tm-table { font-size: 0.95rem; }
    .tm-table th { font-size: 0.8rem; }

    /* ── Content card title ── */
    .tm-content-card-title { font-size: 1.2rem; }
    .tm-page-title { font-size: 1.5rem; }

    /* ── Tab text ── */
    .tm-tab { font-size: 0.85rem; }

    /* ── Accent card (AI assessment, etc.) ── */
    .tm-accent-card { font-size: 1rem; line-height: 1.7; }
    .tm-accent-card-title { font-size: 1rem; }

    /* ── Badge ── */
    .tm-badge { font-size: 0.8rem; padding: 3px var(--space-sm); }

    /* ── Action items ── */
    .tm-action-item { font-size: 0.95rem; }
}

/* ── Tablet (640px+) ──────────────────────────────────── */
@media (min-width: 640px) {
    .page-container {
        padding: var(--space-xl);
    }

    .auth-card {
        padding: var(--space-3xl);
    }

    .quiz-nav {
        justify-content: flex-end;
    }

    .quiz-nav .btn {
        flex: 0 1 auto;
        min-width: 140px;
    }

    .result-actions {
        flex-direction: row;
    }

    .result-actions .btn {
        flex: 1;
    }
}

/* ── Dashboard panels — small mobile (≤480px) ──────────── */
@media (max-width: 480px) {
    .tm-dashboard {
        gap: var(--space-md);
    }

    .tm-style-badge {
        padding: var(--space-sm) var(--space-md);
    }

    .tm-style-badge-name {
        font-size: var(--font-size-md);
    }

    .tm-mover-grid {
        grid-template-columns: 1fr;
        gap: var(--space-sm);
    }

    .tm-pick-meta {
        flex-direction: column;
        gap: 2px;
    }

    .tm-nav-row {
        flex-direction: column;
    }
}

/* ── Tab responsive: icon-only at ≤480px ───────────────── */
@media (max-width: 480px) {
    .tm-tab { padding: 0.4rem 0.6rem; font-size: 0.8rem; min-height: 44px; }
    .tm-tab .tm-tab-text { display: none; }
    .tm-tab .tm-tab-icon { margin-right: 0; font-size: 1.2rem; }
    .tm-hero-row .tm-stat-chip { min-width: 80px; }
    .tm-tab-panel { padding: var(--space-md); }
}

/* ── Extra small (≤360px) — Galaxy S8, old phones ─────── */
@media (max-width: 360px) {
    html { font-size: 16px; }
    .tm-hero-row .tm-stat-chip { min-width: 70px; padding: var(--space-xs) var(--space-sm); }
    .tm-stat-chip-label { font-size: 0.7rem; }
    .tm-main { padding: var(--space-sm) !important; }
    .tm-content-card { padding: var(--space-md); }
    .sd-chart-area { height: 180px; }
    .sd-sub-chart-rsi, .sd-sub-chart-mcdx { height: 60px; }
    .sl-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .tm-bottom-label { font-size: 0.65rem; }
    .tm-bottom-icon { font-size: 22px; }
    .tm-tab { padding: 0.3rem 0.5rem; font-size: 0.75rem; }
}

/* ── Desktop (1024px+) ────────────────────────────────── */
@media (min-width: 1024px) {
    .page-container {
        max-width: 720px;
        padding: var(--space-2xl);
    }

    .quick-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ── Landscape mode (phone held sideways) ─────────────── */
@media (max-height: 500px) and (orientation: landscape) {
    .tm-header { height: 44px; padding: 0 var(--space-md); }
    .tm-bottom-bar { height: 44px; }
    .tm-bottom-icon { font-size: 18px; }
    .tm-bottom-label { font-size: 0.6rem; }
    .tm-main { padding-bottom: 56px !important; }
    .sd-chart-area { height: 160px; }
    .sd-sub-chart-rsi, .sd-sub-chart-mcdx { height: 50px; }
    .tm-sidebar { top: 44px; }
    .tm-sidebar-overlay { top: 44px; }
}
