/* Mobile/Tablet responsive overrides */
html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

/* Unified dark mode palette (matches contact page) */
body.darkmode {
    background-color: #0f1115 !important;
    color: #f9fafb !important;
}
body.darkmode input,
body.darkmode select,
body.darkmode textarea {
    background: #0d0f14 !important;
    color: #f9fafb !important;
    border-color: #1f2531 !important;
}

header {
    width: 100%;
    max-width: 100vw;
    left: 0;
    right: 0;
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: 1fr auto 1fr !important;
    align-items: center !important;
    justify-items: center !important;
    padding-left: 3vw !important;
    padding-right: 3vw !important;
}

.dropdown { justify-self: start !important; }
header a { justify-self: center !important; }
header label { justify-self: end !important; }

/* Normalize dropdown typography across all pages/browsers */
.dropbtn,
.dropdown-content,
.dropdown-content a {
    font-family: 'SF Pro Display', 'Segoe UI', Arial, sans-serif !important;
    font-size: 1em !important;
    line-height: 1.2 !important;
}
.dropbtn {
    font-size: 1.1em !important; /* restore Trading size on desktop */
}
.dropdown-content a[style*="pointer-events:none"],
.dropdown-content a[aria-disabled="true"] {
    color: #999 !important;
    cursor: default !important;
}

main { overflow-x: hidden; }
.container { width: 100% !important; max-width: 1200px; margin: 0 auto; padding: 0 16px !important; box-sizing: border-box; }

/* Standardize footer sizing across pages */
footer {
    margin-top: auto !important;
    background: #000000 !important;
    color: #fff !important;
    padding: 2vh 0 !important;
    font-size: 1em !important;
    font-weight: 400 !important;
    font-family: Arial, sans-serif !important;
    width: 100% !important;
    line-height: 1.3 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
}
footer a {
    color: #fff !important;
    text-decoration: none !important;
    display: inline-block !important;
    text-align: center !important;
    transition: color 0.3s;
    margin: 0 auto !important;
}
footer > * {
    margin: 0 auto !important;
    text-align: center !important;
    font-size: 1em !important;
    line-height: 1.3 !important;
    display: block !important;
    width: 100% !important;
}

@media (max-width: 900px) {
    body {
        font-size: 16px;
        overflow-x: hidden;
    }
    header {
        grid-template-columns: 1fr auto 1fr !important;
        justify-items: center !important;
        padding-left: 5vw !important;
        padding-right: 5vw !important;
        padding-top: 14px !important;
        padding-bottom: 14px !important;
        gap: 8px !important;
    }
    header img {
        height: 32px !important;
        max-height: 32px !important;
    }
    .dropbtn {
        padding: 10px 12px !important;
        font-size: 1em !important;
    }
    .dropdown-content {
        min-width: 200px !important;
    }
    .dropdown-content a {
        padding: 12px 14px !important;
        font-size: 0.95em !important;
    }
    .container,
    main,
    .card,
    .card-content,
    .card-header,
    .content,
    .section,
    .page {
        padding: 16px !important;
        width: 100% !important;
    }
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px !important;
    }
    .controls button,
    .controls .pill-button,
    button.pill-button,
    button {
        width: 100%;
        justify-content: center;
    }
    h1 { font-size: 2em !important; }
    h2 { font-size: 1.4em !important; }
    h3 { font-size: 1.2em !important; }
    p, li, span, label { font-size: 1em !important; }
    table { font-size: 14px !important; }
    th, td { padding: 10px 8px !important; }
    table { display: block; overflow-x: auto; }
    footer { padding: 16px !important; }
    /* Guide cards: disable fixed expansion on mobile */
    .guide-card { position: static !important; height: auto !important; width: 100% !important; transform: none !important; }
    .guide-card.expanded { position: fixed; top: 4vh; left: 50%; transform: translateX(-50%); width: 94vw; height: 88vh; }
    #guideOverlay { display: none !important; }
    .guide-grid { grid-template-columns: 1fr !important; }
}

@media (max-width: 720px) {
    /* Market hours layout tightening */
    .hour-markers { margin-left: calc(110px + 0.5em) !important; margin-right: calc(64px + 0.5em) !important; font-size: 0.65em !important; }
    .sessions-container { gap: 0.9em !important; }
    .session-row { gap: 0.6em !important; align-items: flex-start !important; }
    .session-info { width: 110px !important; gap: 0.6em !important; }
    .session-details h3 { font-size: 0.9em !important; }
    .session-details p { font-size: 0.7em !important; }
    .session-bar-container { height: 32px !important; }
    .session-bar { top: 3px !important; bottom: 3px !important; font-size: 0.65em !important; }
    .current-time-indicator { width: 2px !important; }
    .current-time-dot { width: 6px !important; height: 6px !important; top: -3px !important; }
    .session-status { width: auto !important; min-width: 64px !important; font-size: 0.8em !important; justify-content: flex-start !important; }
}

@media (max-width: 600px) {
    /* Shrink status labels further: dot-only to save space */
    .session-status { min-width: 32px !important; gap: 0.3em !important; }
    .session-status .status-text { display: none !important; }
    .session-bar-container { height: 30px !important; }
    .session-details p:last-of-type { display: none !important; } /* hide date line to reduce height */
}

@media (max-width: 520px) {
    /* Simplify timeline further on very small screens */
    .hour-markers { display: none !important; }
    .sessions-container { gap: 0.75em !important; }
    .session-row { gap: 0.5em !important; align-items: flex-start !important; }
    .session-info { width: 110px !important; gap: 0.5em !important; }
    .session-details h3 { font-size: 0.95em !important; }
    .session-details p { margin: 0 !important; font-size: 0.8em !important; }
    .session-bar-container { height: 28px !important; }
    .session-bar { top: 4px !important; bottom: 4px !important; font-size: 0.7em !important; }
    /* Reduce card padding to free horizontal space */
    .card { margin-left: 0 !important; margin-right: 0 !important; }
    .card-header, .card-content { padding: 14px !important; }
}

@media (max-width: 600px) {
    /* Give title breathing room below header on Market Hours */
    main { padding-top: 14vh !important; }
    .content-wrapper { padding-top: 2vh !important; }
    h1 { margin-top: 0 !important; margin-bottom: 1vh !important; }
    .subtitle { margin-top: 0 !important; }
}
