﻿/* =============================================================================
   GOLD DASHBOARD - Complete Standalone Stylesheet
   TradingView-inspired with gold accent theming
   v0.2.0
   ============================================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global smooth interactions */
html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
    /* Prevent iOS rubber-band bounce — app should feel native, not browser-like */
    overscroll-behavior: none;
}

/* Touch-friendly buttons with scale feedback */
button, a, [role="button"] {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Smooth transitions for interactive elements */
button:not([disabled]),
.chart-btn,
.panel-card,
.nav-link {
    transition: transform var(--duration) var(--ease),
                box-shadow var(--duration) ease,
                background var(--duration) ease,
                border-color var(--duration) ease;
}

:root {
    /* Backgrounds — navy-tinted darks (JP Morgan influence) */
    --bg-primary: #111620;
    --bg-secondary: #171c28;
    --bg-tertiary: #1e2433;
    --bg-hover: #2a3144;
    --border-color: #2a3144;
    --border-subtle: #1e2433;

    /* Text palette — refined gray scale */
    --text-primary: #d4d8e1;
    --text-secondary: #7d8494;
    --text-muted: #565d6f;

    /* Accent system (JP Morgan teal) */
    --gold-accent: #12647E;
    --gold-light: #7ab8cc;
    --gold-dark: #0d4d62;
    --gold-glow: transparent;

    /* Semantic colors */
    --green: #26a69a;
    --red: #ef5350;
    --blue: #2962ff;

    /* Font stacks (JP Morgan lineage) */
    --font-body: 'Open Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'SF Mono', 'Consolas', monospace;
    --font-brand: 'Open Sans', system-ui, sans-serif;

    /* Motion (JP Morgan easing) */
    --ease: cubic-bezier(.25, .1, .25, 1);
    --duration: .18s;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
    font-feature-settings: "cv11", "ss01";
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

/* Custom selection — gold-tinted */
::selection {
    background: rgba(18, 100, 126, 0.18);
    color: var(--gold-light);
}

/* Accessible focus rings — accent colored */
:focus-visible {
    outline: 2px solid var(--gold-accent);
    outline-offset: 2px;
}

/* =============================================================================
   LOADING OVERLAY
   ============================================================================= */

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111620;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Skip loader on warm reloads */
html.skip-loader .loading-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.fill-loader {
    position: relative;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fill-text-outline,
.fill-text-filled {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: clamp(48px, 12vw, 96px);
    letter-spacing: 2px;
    display: inline-block;
    -webkit-user-select: none;
    user-select: none;
}

.fill-text-outline {
    color: rgba(18, 100, 126, 0.10);
}

.fill-text-filled {
    position: absolute;
    top: 0;
    left: 0;
    color: #d4d8e1;
    width: 0%;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =============================================================================
   CONTAINER & LAYOUT
   ============================================================================= */

.container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    gap: 0;
}

/* =============================================================================
   HEADER
   ============================================================================= */

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-wordmark {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: 20px;
    color: #e8eaed;
    letter-spacing: -0.01em;
    white-space: nowrap;
    line-height: 1;
}

.brand-page-label {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 13px;
    color: var(--gold-accent);
    letter-spacing: 0.5px;
    white-space: nowrap;
    line-height: 1;
    padding-left: 10px;
    border-left: 1px solid rgba(18, 100, 126, 0.25);
}

.symbol-badge {
    background: linear-gradient(135deg, rgba(18, 100, 126, 0.2) 0%, rgba(13, 77, 98, 0.2) 100%);
    border: 1px solid rgba(18, 100, 126, 0.3);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--gold-light);
    letter-spacing: 0.02em;
    font-family: var(--font-mono);
}

.timeframe-badge {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.price-display {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.current-price {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Price flash animations */
.current-price.flash-up {
    animation: flashUp 0.6s ease;
}

.current-price.flash-down {
    animation: flashDown 0.6s ease;
}

@keyframes flashUp {
    0% { color: var(--text-primary); }
    25% { color: var(--green); }
    100% { color: var(--text-primary); }
}

@keyframes flashDown {
    0% { color: var(--text-primary); }
    25% { color: var(--red); }
    100% { color: var(--text-primary); }
}

.price-change {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.price-change.positive { color: var(--green); }
.price-change.negative { color: var(--red); }

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    transition: all var(--duration) var(--ease);
}

.nav-link i {
    width: 14px;
    height: 14px;
}

.nav-link:hover {
    background: var(--bg-hover);
    border-color: var(--gold-accent);
    color: var(--gold-light);
}

.nav-link:active {
    transform: scale(0.94);
}

/* Action buttons (settings, help) */
.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.action-btn i {
    width: 16px;
    height: 16px;
}

.action-btn:hover {
    background: var(--bg-hover);
    border-color: var(--gold-accent);
    color: var(--gold-light);
}

.action-btn:active {
    transform: scale(0.92);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.online {
    background: var(--green);
    /* no glow */
}

.status-dot.offline {
    background: var(--gold-accent);
    animation: pulse 2s ease-in-out infinite;
}

.status-dot.closed {
    background: #94a3b8;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* =============================================================================
   SESSION TICKER
   ============================================================================= */

.session-ticker {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 6px 16px;
    background: rgba(17, 22, 32, 0.92);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 12px;
}

.session-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(18, 100, 126, 0.12);
    border: 1px solid rgba(18, 100, 126, 0.25);
}

.session-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold-accent);
    animation: pulse 2s ease-in-out infinite;
}

.session-badge-text {
    font-size: 10px;
    font-weight: 700;
    color: var(--gold-light);
    letter-spacing: 0.08em;
    font-family: var(--font-mono);
}

.session-track {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.session-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.session-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.session-label {
    color: var(--text-muted);
}

.session-time {
    color: var(--text-primary);
    font-weight: 600;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.session-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: var(--font-mono);
}

.session-status.active {
    background: rgba(38, 166, 154, 0.15);
    color: var(--green);
}

.session-status.inactive {
    background: rgba(93, 96, 107, 0.15);
    color: var(--text-muted);
}

.session-status.upcoming {
    background: rgba(41, 98, 255, 0.15);
    color: var(--blue);
}

.session-sep {
    color: var(--border-color);
}

/* =============================================================================
   CHART SECTION
   ============================================================================= */

.chart-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    min-width: 0;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-subtle);
    gap: 12px;
    flex-wrap: wrap;
}

.ohlcv-display {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.ohlcv-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 8px;
}

.ohlcv-label:first-child {
    margin-left: 0;
}

.ohlcv-value {
    color: var(--text-secondary);
    font-weight: 600;
}

.ohlcv-value.high { color: var(--green); }
.ohlcv-value.low { color: var(--red); }

.ohlcv-sep {
    color: var(--border-color);
    margin: 0 6px;
}

.ohlcv-info {
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--font-body);
    font-style: italic;
}

.chart-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.range-group,
.timeframe-group,
.overlay-group {
    display: flex;
    gap: 4px;
}

.chart-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 6px;
}

.chart-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.chart-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.chart-btn:active {
    transform: scale(0.92);
}

.chart-btn.active {
    background: rgba(18, 100, 126, 0.15);
    color: var(--gold-light);
}

.chart-btn.toggle-btn {
    padding: 6px 8px;
}

.chart-btn.toggle-btn i {
    width: 14px;
    height: 14px;
}

.chart-btn.toggle-btn.active {
    background: rgba(18, 100, 126, 0.2);
    color: var(--gold-light);
}

.refresh-btn {
    padding: 6px 8px;
}

.refresh-btn i {
    width: 14px;
    height: 14px;
    transition: transform 0.3s ease;
}

.refresh-btn.spinning i {
    animation: spin 0.5s linear;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

#goldChart {
    flex: 1;
    position: relative;
    min-height: 300px;
}

/* =============================================================================
   BIAS WIDGET (Top-left overlay)
   ============================================================================= */

.bias-widget {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 10;
    background: rgba(23, 28, 40, 0.94);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    min-width: 140px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: border-color 0.3s var(--ease);
}

.bias-widget.bullish {
    border-color: rgba(38, 166, 154, 0.4);
}

.bias-widget.bearish {
    border-color: rgba(239, 83, 80, 0.4);
}

.bias-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-light);
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.bias-label.bullish { color: var(--green); }
.bias-label.bearish { color: var(--red); }

.bias-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.bias-fill {
    height: 100%;
    width: 50%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold-accent));
    border-radius: 2px;
    transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.bias-fill.bullish {
    background: linear-gradient(90deg, var(--green), #4cceac);
}

.bias-fill.bearish {
    background: linear-gradient(90deg, #e57373, var(--red));
}

.bias-meta {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.bias-hint {
    margin-top: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.52);
    font-family: var(--font-mono);
    letter-spacing: 0.01em;
}

/* =============================================================================
   COUNTDOWN TIMER (Green pill style, matching BTC)
   ============================================================================= */

.chart-countdown {
    position: absolute;
    bottom: 12px;
    right: 12px;
    z-index: 10;
    background: rgba(38, 166, 154, 0.12);
    border: 1px solid rgba(38, 166, 154, 0.3);
    border-radius: 999px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--green);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.chart-countdown.closed {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.28);
    color: #cbd5e1;
}

/* =============================================================================
   SITE FOOTER (matches BTC)
   ============================================================================= */

.site-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 38px;
    padding: 6px 16px;
    background: rgba(23, 28, 40, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(42, 49, 68, 0.5);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    flex-shrink: 0;
    position: relative;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--duration) var(--ease);
    z-index: 1;
}

.footer-link:hover {
    color: var(--gold-accent);
}

.footer-link i {
    width: 14px;
    height: 14px;
}

.footer-copyright {
    line-height: 1.2;
}

.footer-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-align: center;
    pointer-events: auto;
}

.footer-contact-text {
    color: var(--text-muted);
    line-height: 1.2;
}

.footer-contact-link {
    color: var(--gold-accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

.footer-contact-link:hover {
    color: var(--gold-light);
}

/* =============================================================================
   CONTROL PANEL
   ============================================================================= */

.control-panel {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    overflow-y: auto;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.panel-header-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gold-light);
    font-family: var(--font-brand);
}

.panel-header-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Panel Cards */
.panel-card {
    margin: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
    position: relative;
}

.panel-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold-accent), transparent);
    opacity: 0;
    transition: opacity 0.35s var(--ease);
    border-radius: 10px 10px 0 0;
}

.panel-card:first-of-type {
    margin-top: 12px;
}

.panel-card:hover {
    border-color: rgba(18, 100, 126, 0.25);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(18, 100, 126, 0.06);
}

.panel-card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.card-header.collapsible {
    cursor: pointer;
    user-select: none;
    transition: color var(--duration) var(--ease);
}

.card-header.collapsible:hover {
    color: var(--gold-accent);
}

.collapse-icon {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.25s var(--ease);
}

.card-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.card-body {
    padding: 12px 14px;
    max-height: 800px;
    transition: max-height 0.35s var(--ease), opacity 0.25s ease, padding 0.3s ease;
    overflow: hidden;
}

.card-body.collapsed {
    max-height: 0 !important;
    padding-top: 0;
    padding-bottom: 0;
    opacity: 0;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-icon {
    width: 15px;
    height: 15px;
    color: var(--gold-accent);
}

.card-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(18, 100, 126, 0.12);
    color: var(--gold-accent);
    font-family: var(--font-mono);
}

/* Metric Rows */
.metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
    margin: 0 -2px;
    padding-left: 2px;
    padding-right: 2px;
    border-radius: 3px;
    transition: background var(--duration) var(--ease);
}

.metric-row:hover {
    background: rgba(18, 100, 126, 0.04);
}

.metric-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.metric-row:first-child {
    padding-top: 0;
}

.metric-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
    text-align: right;
}

.metric-value.muted {
    color: var(--text-muted);
}

.metric-value.bullish {
    color: var(--green);
}

.metric-value.bearish {
    color: var(--red);
}

.metric-value.neutral-bias {
    color: var(--gold-light);
}

.metric-value.confidence-high {
    color: var(--green);
}

.metric-value.confidence-mid {
    color: var(--gold-light);
}

/* Key Levels */
.levels-body {
    padding: 10px 14px;
}

.level-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    border-bottom: 1px dashed var(--border-subtle);
    border-radius: 4px;
    transition: background var(--duration) var(--ease);
}

.level-row:hover {
    background: rgba(18, 100, 126, 0.04);
}

.level-row:last-child {
    border-bottom: none;
}

.level-marker {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.level-marker.above { background: var(--green); }
.level-marker.below { background: var(--red); }
.level-marker.neutral { background: var(--gold-accent); }

.level-label {
    flex: 1;
    font-size: 12px;
    color: var(--text-secondary);
}

.level-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* =============================================================================
   CALENDAR CARD
   ============================================================================= */

.calendar-card .card-body {
    padding: 0;
}

.calendar-next-up {
    padding: 12px 14px;
    background: rgba(18, 100, 126, 0.04);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s var(--ease);
}

/* Urgency states */
.calendar-next-up.approaching {
    background: rgba(18, 100, 126, 0.12);
}

.calendar-next-up.imminent-cal {
    background: rgba(239, 83, 80, 0.08);
    border-color: rgba(239, 83, 80, 0.3);
}

@keyframes approachGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

@keyframes imminentGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.next-up-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.next-up-badge {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.1em;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--gold-accent);
    color: var(--bg-primary);
    font-family: var(--font-mono);
}

.next-up-countdown {
    font-size: 12px;
    font-weight: 700;
    color: var(--gold-light);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.next-up-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.next-up-currency {
    font-weight: 700;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* Currency color coding */
.next-up-currency.usd { color: #4caf50; }
.next-up-currency.eur { color: #2196f3; }
.next-up-currency.gbp { color: #f44336; }
.next-up-currency.jpy { color: #ff9800; }
.next-up-currency.cad { color: #e91e63; }
.next-up-currency.aud { color: #009688; }
.next-up-currency.nzd { color: #607d8b; }
.next-up-currency.chf { color: #9c27b0; }

.next-up-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.next-up-details {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
    font-family: var(--font-mono);
}

.calendar-list {
    max-height: 420px;
    overflow-y: auto;
}

.calendar-loading,
.calendar-empty {
    padding: 20px 14px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
}

.calendar-day {
    border-bottom: 1px solid var(--border-color);
}

.calendar-day:last-child {
    border-bottom: none;
}

.calendar-day-header {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(42, 46, 57, 0.5);
    font-size: 11px;
}

.calendar-day-name {
    font-weight: 600;
    color: var(--text-secondary);
}

.calendar-day-date {
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.calendar-event {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 12px;
    border-bottom: 1px solid var(--border-subtle);
    border-left: 2px solid transparent;
    transition: background var(--duration) var(--ease), border-color var(--duration) var(--ease);
}

.calendar-event:last-child {
    border-bottom: none;
}

.calendar-event:hover {
    background: rgba(18, 100, 126, 0.03);
    border-left-color: var(--gold-accent);
}

.calendar-event-time {
    width: 50px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.calendar-event-currency {
    font-weight: 700;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    min-width: 32px;
}

/* Currency color coding for event list */
.calendar-event-currency.usd { color: #4caf50; }
.calendar-event-currency.eur { color: #2196f3; }
.calendar-event-currency.gbp { color: #f44336; }
.calendar-event-currency.jpy { color: #ff9800; }
.calendar-event-currency.cad { color: #e91e63; }
.calendar-event-currency.aud { color: #009688; }
.calendar-event-currency.nzd { color: #607d8b; }
.calendar-event-currency.chf { color: #9c27b0; }

.calendar-event-title {
    flex: 1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-impact {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.calendar-event-impact.impact-high {
    background: var(--red);
}

.calendar-footer {
    display: flex;
    justify-content: space-between;
    padding: 8px 14px;
    font-size: 10px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    font-family: var(--font-mono);
}

/* Panel Footer */
.panel-footer {
    margin-top: auto;
    padding: 12px 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.panel-footer-text {
    font-size: 11px;
    color: var(--text-muted);
}

/* =============================================================================
   SETTINGS DRAWER
   ============================================================================= */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.settings-overlay.open {
    opacity: 1;
    visibility: visible;
}

.settings-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    flex-direction: column;
}

.settings-drawer.open {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.settings-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.settings-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--duration) var(--ease);
}

.settings-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.settings-close i {
    width: 18px;
    height: 18px;
}

.settings-body {
    padding: 16px;
    flex: 1;
    overflow-y: auto;
}

.setting-group {
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.setting-group:last-child {
    border-bottom: none;
}

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.setting-info {
    flex: 1;
    min-width: 0;
}

.setting-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: block;
    margin-bottom: 4px;
    cursor: pointer;
}

.setting-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-hover);
    border-radius: 22px;
    transition: background 0.25s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.25s ease, background 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--gold-accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
    background: #fff;
}

/* =============================================================================
   HELP MODAL
   ============================================================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid rgba(18, 100, 126, 0.1);
    border-radius: 14px;
    width: 90%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-icon {
    width: 20px;
    height: 20px;
    color: var(--gold-accent);
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    transition: all var(--duration) var(--ease);
}

.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.modal-close i {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.help-body {
    line-height: 1.6;
}

.help-kicker {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-accent);
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.help-section {
    margin-bottom: 4px;
}

.help-section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.help-icon {
    width: 16px;
    height: 16px;
    color: var(--gold-accent);
}

.help-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.help-list li {
    position: relative;
    padding: 4px 0 4px 16px;
    font-size: 13px;
    color: var(--text-secondary);
}

.help-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--gold-accent);
}

.help-strong {
    font-weight: 600;
    color: var(--text-primary);
}

.help-desc {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.help-note {
    font-size: 12px;
    color: var(--text-muted);
    padding: 8px 12px;
    background: rgba(18, 100, 126, 0.04);
    border-radius: 6px;
    border-left: 2px solid rgba(18, 100, 126, 0.4);
    margin-top: 8px;
}

.help-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 0;
}

/* Help modal states */
.help-states {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 8px;
}

.help-state {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(18, 100, 126, 0.03);
    border: 1px solid var(--border-subtle);
    transition: background var(--duration) var(--ease);
}

.help-state:hover {
    background: rgba(18, 100, 126, 0.06);
}

.help-state .state-name {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    white-space: nowrap;
    min-width: 72px;
    font-family: var(--font-mono);
}

.help-state .state-desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.help-state.bullish .state-name { color: var(--green); }
.help-state.neutral-state .state-name { color: var(--gold-accent); }
.help-state.bearish .state-name { color: var(--red); }

/* =============================================================================
   VERSION BADGE
   ============================================================================= */

.version-badge {
    position: fixed;
    bottom: 8px;
    right: 12px;
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
    font-family: var(--font-mono);
    pointer-events: none;
    z-index: 1000;
}

/* =============================================================================
   CONTEXT MENU
   ============================================================================= */

.chart-context-menu {
    position: fixed;
    z-index: 9999;
    min-width: 180px;
    background: rgba(23, 28, 40, 0.96);
    border: 1px solid rgba(18, 100, 126, 0.12);
    border-radius: 10px;
    padding: 6px 0;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: none;
}

.chart-context-menu.visible {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration) var(--ease);
}

.context-menu-item i {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.context-menu-item:hover {
    background: var(--bg-hover);
    color: var(--gold-light);
}

.context-menu-item:hover i {
    opacity: 1;
}

.context-menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
}

/* =============================================================================
   CLIPBOARD TOAST
   ============================================================================= */

.clipboard-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-tertiary);
    border: 1px solid var(--gold-accent);
    color: var(--gold-light);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font-mono);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s var(--ease);
    z-index: 99999;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(18, 100, 126, 0.15);
}

.clipboard-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* =============================================================================
   SCROLLBAR (refined)
   ============================================================================= */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(18, 100, 126, 0.12);
    border-radius: 3px;
    transition: background 0.15s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(18, 100, 126, 0.28);
}

/* =============================================================================
   RESPONSIVE - TABLET
   ============================================================================= */

@media (max-width: 1100px) {
    .main-content {
        flex-direction: column;
    }

    .chart-section {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        min-height: 50vh;
    }

    .control-panel {
        width: 100%;
        max-height: 50vh;
    }
}

/* =============================================================================
   NEWS HANGOVER BANNER + BIAS WIDGET MODIFIER
   ============================================================================= */

.hangover-banner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(255, 183, 77, 0.10);
    border-bottom: 1px solid rgba(255, 183, 77, 0.20);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.03em;
    color: #ffb74d;
    z-index: 10;
}

.hangover-banner.hangover-high {
    background: rgba(255, 152, 0, 0.12);
    border-bottom-color: rgba(255, 152, 0, 0.30);
}

.hangover-banner.hangover-medium {
    background: rgba(255, 183, 77, 0.08);
    border-bottom-color: rgba(255, 183, 77, 0.15);
}

.hangover-banner-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    stroke: #ffb74d;
}

.hangover-banner-text {
    color: #ffb74d;
    opacity: 0.85;
}

.hangover-banner-event {
    color: rgba(255, 183, 77, 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.hangover-banner-timer {
    margin-left: auto;
    color: #ffb74d;
    font-weight: 600;
    white-space: nowrap;
}

/* Bias widget — hangover active modifier */
.bias-widget.hangover-active {
    border-color: rgba(255, 183, 77, 0.30);
}

/* Bias hint — hangover note styling */
.bias-hint.hangover-hint {
    color: #ffb74d;
    opacity: 0.85;
}


/* =============================================================================
   RESPONSIVE - MOBILE
   ============================================================================= */

@media (max-width: 768px) {
    /* Hangover banner — compact on mobile */
    .hangover-banner {
        padding: 4px 10px;
        padding-left: calc(10px + env(safe-area-inset-left, 0px));
        padding-right: calc(10px + env(safe-area-inset-right, 0px));
        gap: 5px;
        font-size: 8px;
    }

    .hangover-banner-icon {
        width: 10px;
        height: 10px;
    }

    .hangover-banner-event {
        max-width: 100px;
        font-size: 8px;
    }

    .hangover-banner-timer {
        font-size: 8px;
    }

    .header {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 8px 12px;
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
        padding-right: calc(8px + env(safe-area-inset-right, 0px));
    }

    .header-left {
        flex: 1;
        min-width: 0;
        justify-content: flex-start;
        overflow: hidden;
    }

    .header-right {
        flex-shrink: 0;
        justify-content: flex-end;
        gap: 6px;
    }

    .brand {
        gap: 8px;
        overflow: hidden;
    }

    .brand-wordmark {
        font-size: 15px;
    }

    .brand-page-label {
        font-size: 11px;
        padding-left: 8px;
    }

    .symbol-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .timeframe-badge {
        display: none;
    }

    .price-display {
        display: flex;
        align-items: baseline;
        gap: 4px;
    }

    .current-price {
        font-size: 14px;
    }

    .price-change {
        font-size: 10px;
    }

    .nav-link {
        padding: 5px;
        flex-shrink: 0;
    }

    .nav-link span {
        display: none;
    }

    .nav-link i {
        width: 14px;
        height: 14px;
    }

    .action-btn {
        width: 28px;
        height: 28px;
        flex-shrink: 0;
    }

    .action-btn i {
        width: 14px;
        height: 14px;
    }

    .status-indicator {
        display: none;
    }

    .session-ticker {
        display: none;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .ohlcv-display {
        flex-wrap: wrap;
    }

    .control-panel {
        display: none;
    }

    .range-group {
        display: none;
    }

    .site-footer {
        padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    }

    .site-footer .footer-center {
        display: none;
    }

    .version-badge {
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 480px) {
    .brand-page-label {
        display: none;
    }
}

/* Landscape orientation on small screens */
@media (max-height: 500px) and (orientation: landscape) {
    .session-ticker {
        display: none;
    }
}

/* =============================================================================
   MOBILE FAB CONTAINER
   ============================================================================= */

.mobile-fab-container {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    z-index: 500;
    gap: 8px;
}

.mobile-fab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(23, 28, 40, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.2s var(--ease);
}

.mobile-fab-btn:active {
    transform: scale(0.94);
    background: var(--bg-tertiary);
}

.mobile-fab-btn i {
    width: 16px;
    height: 16px;
}

.mobile-fab-btn.news-fab {
    background: rgba(18, 100, 126, 0.08);
}

.mobile-fab-btn.news-fab i {
    color: var(--gold-accent);
}

.mobile-fab-btn.news-fab:not(:active) {
    animation: fabPulseGold 3s ease-in-out infinite;
}

@keyframes fabPulseGold {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.mobile-fab-btn.levels-fab i {
    color: var(--blue);
}

.fab-count {
    background: var(--gold-accent);
    color: var(--bg-primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    font-family: var(--font-mono);
}

/* =============================================================================
   DRAWER SYSTEM (Shared)
   ============================================================================= */

.drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 550;
}

.drawer-backdrop.open {
    display: block;
}

.drawer-handle {
    display: flex;
    justify-content: center;
    padding: 10px;
}

.drawer-handle-bar {
    width: 40px;
    height: 4px;
    background: rgba(18, 100, 126, 0.2);
    border-radius: 2px;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.drawer-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    color: var(--text-primary);
}

.drawer-header h3 i {
    width: 16px;
    height: 16px;
    color: var(--gold-accent);
}

.drawer-close {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--duration) var(--ease);
}

.drawer-close:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.drawer-close i {
    width: 20px;
    height: 20px;
}

.drawer-content {
    padding: 12px 16px;
    max-height: 38vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* =============================================================================
   MOBILE NEWS DRAWER
   ============================================================================= */

.mobile-news-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 22, 32, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(18, 100, 126, 0.08);
    border-radius: 20px 20px 0 0;
    max-height: 55vh;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 600;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -10px 48px rgba(0, 0, 0, 0.5);
}

.mobile-news-drawer.open {
    transform: translateY(0);
}

/* News drawer Next Up */
.news-drawer-next {
    background: linear-gradient(135deg, rgba(18, 100, 126, 0.12) 0%, rgba(13, 77, 98, 0.08) 100%);
    border: 1px solid rgba(18, 100, 126, 0.25);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 12px;
}

.news-drawer-next .next-up-badge {
    display: inline-block;
    background: var(--gold-accent);
    color: var(--bg-primary);
    font-size: 9px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.news-drawer-next-content {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.news-drawer-next-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.news-drawer-next-currency {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

.news-drawer-next-title {
    font-size: 11px;
    color: var(--text-secondary);
    flex: 1;
    min-width: 100%;
}

.news-drawer-next-countdown {
    font-size: 11px;
    color: var(--gold-light);
    font-weight: 600;
    font-family: var(--font-mono);
}

/* News drawer list */
.news-drawer-list {
    max-height: 28vh;
    overflow-y: auto;
}

.news-drawer-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.news-drawer-item:last-child {
    border-bottom: none;
}

.news-drawer-item-time {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 45px;
    font-family: var(--font-mono);
}

.news-drawer-item-currency {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.news-drawer-item-title {
    flex: 1;
    font-size: 11px;
    color: var(--text-primary);
    line-height: 1.3;
}

.news-drawer-item-impact {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-top: 4px;
    flex-shrink: 0;
}

.news-drawer-item-impact.high {
    background: var(--red);
}

.news-drawer-item-impact.medium {
    background: var(--gold-accent);
}

.news-drawer-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 12px;
}

.news-drawer-day-header {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px 0;
    margin-top: 4px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}

.news-drawer-day-header:first-child {
    margin-top: 0;
    border-top: none;
    padding-top: 0;
}

/* =============================================================================
   MOBILE LEVELS DRAWER
   ============================================================================= */

.mobile-levels-drawer {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 22, 32, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-top: 1px solid rgba(18, 100, 126, 0.08);
    border-radius: 20px 20px 0 0;
    max-height: 55vh;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 600;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -10px 48px rgba(0, 0, 0, 0.5);
}

.mobile-levels-drawer.open {
    transform: translateY(0);
}

.drawer-levels-list {
    margin-bottom: 16px;
}

.drawer-level-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-subtle);
}

.drawer-level-row:last-child {
    border-bottom: none;
}

.drawer-level-row .level-value {
    font-size: 14px;
}

.drawer-bias-snapshot {
    background: rgba(18, 100, 126, 0.04);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
}

.drawer-bias-header {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--gold-accent);
    margin-bottom: 10px;
    font-family: var(--font-mono);
}

.drawer-bias-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.drawer-bias-row:last-child {
    border-bottom: none;
}

.drawer-bias-label {
    font-size: 12px;
    color: var(--text-muted);
}

.drawer-bias-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Show FABs and drawers on mobile */
@media (max-width: 768px) {
    .mobile-fab-container {
        display: flex;
        /* Clear the tab bar (56px + safe-area) */
        bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    }

    .mobile-news-drawer,
    .mobile-levels-drawer {
        display: block;
        /* Push drawer above tab bar */
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }

    .control-panel .calendar-card {
        display: none;
    }

    .version-badge {
        display: none;
    }
}

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .mobile-fab-container {
        display: flex;
    }

    .mobile-news-drawer,
    .mobile-levels-drawer {
        display: block;
    }
}

/* =============================================================================
   CARD ENTRY ANIMATIONS
   ============================================================================= */

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-card {
    animation: cardFadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.panel-card:nth-child(2) { animation-delay: 0.05s; }
.panel-card:nth-child(3) { animation-delay: 0.1s; }
.panel-card:nth-child(4) { animation-delay: 0.15s; }

/* =============================================================================
   PWA ENHANCEMENTS
   ============================================================================= */

/* ── Page Fade-In Transition ─────────────────────────────────────────────── */
body {
    animation: pageFadeIn 0.3s ease-out;
}

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

/* ── Hidden Scrollbars (native feel) ─────────────────────────────────────── */
*::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ── Haptic-Style Tap Feedback ───────────────────────────────────────────── */
button:active:not([disabled]),
a:active,
[role="button"]:active,
.panel-card:active,
.chart-btn:active {
    transform: scale(0.97);
    transition: transform 0.05s ease;
}

/* ── Pull-to-Refresh Indicator ───────────────────────────────────────────── */
.pull-refresh-indicator {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-60px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

.pull-refresh-indicator.visible {
    opacity: 1;
}

.pull-refresh-indicator.refreshing {
    opacity: 1;
}

.pull-refresh-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-top-color: var(--gold-accent);
    border-radius: 50%;
}

.pull-refresh-indicator.refreshing .pull-refresh-spinner {
    animation: pullSpin 0.8s linear infinite;
}

@keyframes pullSpin {
    to { transform: rotate(360deg); }
}

/* ── Bottom Tab Bar ──────────────────────────────────────────────────────── */
.tab-bar {
    display: none;
}

@media (max-width: 768px) {
    .tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9000;
        background: rgba(17, 22, 32, 0.94);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        backdrop-filter: blur(24px) saturate(180%);
        border-top: 0.5px solid rgba(42, 49, 68, 0.6);
        padding-bottom: env(safe-area-inset-bottom, 0px);
        justify-content: space-around;
        align-items: stretch;
    }

    .tab-bar-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        padding: 8px 0 6px;
        background: none;
        border: none;
        color: var(--text-muted);
        text-decoration: none;
        font-size: 10px;
        font-weight: 500;
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease;
        cursor: pointer;
    }

    .tab-bar-item i {
        width: 22px;
        height: 22px;
        stroke-width: 1.5;
    }

    .tab-bar-item.active {
        color: var(--gold-accent);
    }

    .tab-bar-item:active {
        transform: scale(0.92);
        transition: transform 0.05s ease;
    }

    /* Hide header nav link & settings/help on mobile since tab bar replaces them */
    .nav-link,
    .action-btn {
        display: none !important;
    }

    /* Offset bottom content so it's not hidden behind the tab bar */
    .container {
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    }
}
