/* =============================================================================
   mobile.css
   TradeCheetah responsive / mobile overrides.
   Loaded in base.html after all other stylesheets.
   ============================================================================= */

/* ══════════════════════════════════════════════════════════════════════════════
   DESKTOP DEFAULTS
══════════════════════════════════════════════════════════════════════════════ */
:root {
    --header-h-desktop: 130px;
    --header-h-mobile:  56px;
}

#upper-container {
    height: var(--header-h-desktop);
    background-color: #fff;
    width: 100%;
    z-index: 999;
    position: fixed;
    top: 0;
}

#mobile-header { display: none; }
#mobile-nav-drawer { display: none; }

#lower-container {
    top: var(--header-h-desktop);
    position: relative;
    background-color: #edf0f1;
    min-height: 560px;
}

/* Hide short label on desktop */
.trade-short{ display: none; }

#mobile-sub-notice{
    background:#283D4F;
    color:#C9D6D6;
    text-align:center;
    padding:0.75rem 1rem;
    font-size:0.8rem;
    letter-spacing:0.5px;
    border-bottom:1px solid rgba(255,255,255,.1);
    display: none;
}

/* ══════════════════════════════════════════════════════════════════════════════
   MOBILE MARKET STATUS PILL
══════════════════════════════════════════════════════════════════════════════ */
.mobile-market-status {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
}

.mobile-market-status.market-open {
    background: rgba(111, 230, 112, 0.15);
    color: #6FE670;
    border: 1px solid rgba(111, 230, 112, 0.3);
}

.mobile-market-status.market-pre,
.mobile-market-status.market-post {
    background: rgba(255, 165, 0, 0.15);
    color: #FFA500;
    border: 1px solid rgba(255, 165, 0, 0.3);
}

.mobile-market-status.market-closed {
    background: rgba(224, 85, 85, 0.15);
    color: #e05555;
    border: 1px solid rgba(224, 85, 85, 0.3);
}

/* ══════════════════════════════════════════════════════════════════════════════
   DRAWER USER SUMMARY
══════════════════════════════════════════════════════════════════════════════ */
.drawer-user-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 12px;
}

.drawer-user-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.drawer-user-left .avatar {
    border-radius: 50%;
    border: 2px solid rgba(34, 190, 179, 0.3);
    object-fit: cover;
}

.drawer-market-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.drawer-market-info .mobile-market-status {
    margin-bottom: 2px;
}

/* ══════════════════════════════════════════════════════════════════════════════
   DRAWER TICKER SEARCH
══════════════════════════════════════════════════════════════════════════════ */
.drawer-ticker-search {
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.drawer-ticker-search form {
    display: flex;
    gap: 6px;
}

.drawer-ticker-search input[type="text"] {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 7px 12px;
    color: #C9D6D6;
    font-size: 0.85rem;
    outline: none;
    font-family: inherit;
}

.drawer-ticker-search input[type="text"]::placeholder {
    color: #536472;
}

.drawer-ticker-search input[type="text"]:focus {
    border-color: rgba(34, 190, 179, 0.5);
    background: rgba(34, 190, 179, 0.05);
}

.drawer-ticker-search button {
    background: #22BEB3;
    color: #0a1628;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
    font-family: 'Oswald', sans-serif;
    text-transform: uppercase;
}

.drawer-ticker-search button:hover {
    background: #1aa89e;
}

/* ── Top-level links ── */
.drawer-top-link {
    display: block;
    padding: 0.875rem 1.5rem;
    color: #C9D6D6;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    text-decoration: none;
}
.drawer-top-link:hover { color: #22BEB3; background: rgba(34,190,179,.08); }

/* ── Toggle buttons (Positions / Scanners) ── */
.drawer-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.875rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 1px solid rgba(255,255,255,.06);
    color: #C9D6D6;
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    text-align: left;
}
.drawer-toggle:hover { color: #22BEB3; background: rgba(34,190,179,.08); }

/* Chevron rotates when open */
#mobile-nav-drawer .drawer-chevron {
    transition: transform 0.2s ease;
    flex-shrink: 0;
    color: #536472;
}
#mobile-nav-drawer .drawer-toggle.open .drawer-chevron {
    transform: rotate(90deg);
    color: #22BEB3;
}

/* ── Sub-section container ── */
.drawer-sub {
    background: rgba(0,0,0,.15);
    border-bottom: 1px solid rgba(255,255,255,.06);
}

/* ── Sub-links ── */
#mobile-nav-drawer .drawer-sub-link {
    display: block;
    padding: 0.6rem 1.5rem 0.6rem 2.5rem;
    color: #8a9ba8;
    font-family: 'Oswald', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,.04);
    text-decoration: none;
}
#mobile-nav-drawer .drawer-sub-link:hover { color: #22BEB3; background: rgba(34,190,179,.06); }
#mobile-nav-drawer .drawer-sub-link:last-child { border-bottom: none; }

/* ══════════════════════════════════════════════════════════════════════════════
   ≤ 1300px — HIDE DESKTOP HEADER, SHOW SLIM MOBILE BAR + DRAWER
══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1300px) {

    #upper-container { display: none !important; }

    #mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: var(--header-h-mobile);
        background: #283D4F;
        z-index: 9999;
        padding: 0 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,.3);
    }
    #mobile-header .avatar {
        border-radius: 50%;
        border: 1px solid #6d6e70;
    }

    #lower-container { top: var(--header-h-mobile) !important; }

    #footer { top: 80px; }

    /* ── Full-screen nav drawer ─────────────────────────────────────────── */
    #mobile-nav-drawer {
        display: none;
        position: fixed;
        top: var(--header-h-mobile);
        left: 0; right: 0; bottom: 0;
        background: #1e2f3d;
        z-index: 9998;
        overflow-y: auto;
        padding: 0 0 1rem 0;
    }
    #mobile-nav-drawer.open { display: block; }

    #mobile-nav-drawer a {
        display: block;
        padding: 0.875rem 1.5rem;
        color: #C9D6D6;
        font-family: 'Oswald', sans-serif;
        font-size: 1rem;
        text-transform: uppercase;
        letter-spacing: 1px;
        border-bottom: 1px solid rgba(255,255,255,.06);
        text-decoration: none;
    }
    #mobile-nav-drawer a:hover,
    #mobile-nav-drawer a.active {
        color: #22BEB3;
        background: rgba(34,190,179,.08);
    }
    #mobile-nav-drawer .drawer-section {
        padding: 0.5rem 1.5rem 0.25rem;
        font-size: 0.65rem;
        text-transform: uppercase;
        letter-spacing: 2px;
        color: #536472;
        margin-top: 0.5rem;
    }
    #mobile-nav-drawer .drawer-footer {
        padding: 1.5rem;
        border-top: 1px solid rgba(255,255,255,.08);
        margin-top: 1rem;
    }
    #mobile-nav-drawer .drawer-footer a {
        border: none;
        display: inline-block;
        padding: 0.5rem 1rem;
        background: #22BEB3;
        color: #fff;
        border-radius: 4px;
        font-size: 0.85rem;
        margin-right: 0.5rem;
        margin-bottom: 0.5rem;
    }

    /* User summary block overrides inside media query */
    .drawer-user-summary {
        padding: 12px 1.5rem;
    }

    /* Ticker search inside media query */
    .drawer-ticker-search {
        padding: 10px 1.5rem;
    }

    #main { padding: 0.75rem !important; }
    .logged-container { padding: 0 0.5rem; }
    #subscriptions .logged-container,
    #privacy .logged-container,
    #contact .logged-container { width: inherit; }

    /* Footer: stack columns, show all links */
    #footer .row {
        flex-direction: column !important;
        gap: 0.75rem;
    }
    #footer .row > div {
        flex: 0 0 100% !important;
        width: 100% !important;
    }
    #right-footer {
        justify-content: flex-start !important;
        flex-wrap: wrap !important;
    }
    #right-footer li { float: none !important; }

    /* Profile page has no #main — scroll at lower-container level */
    #profile #lower-container {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    /* fake-header sits inside overflow:auto so width:100% gets clipped */
    #profile #nav-profile #fake-header {
        position: fixed;
        top: var(--header-h-mobile);
        left: 0;
        right: 0;
        width: 100%;
    }
}


/* ══════════════════════════════════════════════════════════════════════════════
   ≤ 900px — HORIZONTAL SCROLL FOR THE MATRIX
══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    #free-subs .product {
        width: 100% !important;
        margin-left: 0 !important;
        padding: 0px !important;
    }
    #free-subs .form-holder { margin: 5px; }
    #contact #main > div:last-of-type { display: none; }
    #contact #main form { width: 90%; }

    /* Hide HelpCrunch and HelpScout chat widgets */
    iframe[src*="helpcrunch.com"],
    #helpcrunch-container,
    .helpcrunch-iframe-wrapper,
    iframe[src*="helpscout.net"],
    #beacon-container,
    .BeaconFabButtonFrame,
    .BeaconContainer { display: none !important; }

    #main {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #matrix { min-width: 780px !important; }

    #positions-overview #x_axis #positions-pane #data li .info,
    #positions-overview #x_axis #positions-pane #data li .info > span,
    #positions-overview #x_axis #positions-pane #data li .info span.ticker,
    #positions-overview #x_axis #positions-pane #data li .info span.type,
    #positions-overview #x_axis #positions-pane #data li .days,
    #positions-overview #x_axis #positions-pane #data li .days > span,
    #positions-overview #x_axis #positions-pane #data li > span > span {
        white-space: nowrap;
    }

    #positions-overview #x_axis #positions-pane #data li {
        height: auto !important;
        min-height: 55px;
        overflow: visible !important;
    }

    #positions-overview #x_axis #positions-pane #header li {
        font-size: 0.75rem !important;
        letter-spacing: 0 !important;
        padding: 0 1px !important;
        line-height: 4em;
    }

    #footer ul li.qmc-footer-text { width: 100%; }
    #positions-overview #x_axis .report #legend { display: none; }

    #matrix { min-width: 680px !important; }
    #positions-overview #matrix #y_axis div#count span { font-size: 1.4em !important; }

    .trade-open,
    .trade-closed { display: none; }
    .trade-short { display: inline; }

    .position-button { display: none; }
    .stock-trade-detail { display: none !important; }

    #success, #success-no {
        background-position: center top !important;
        background-size: 50px auto !important;
        padding: 70px 1rem 1.5rem !important;
        margin: 1rem auto !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    #mobile-sub-notice { display: block; }
    #mobile-sub-notice strong { color: #22BEB3; }
}


/* ══════════════════════════════════════════════════════════════════════════════
   ≤ 600px — EXTRA SMALL (phone portrait)
══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {
    #matrix { min-width: 680px !important; }
    #positions-overview #matrix #y_axis div#count span { font-size: 1.4em !important; }

    #matrix #y_axis .type { display: none; }
    #main-login .form-holder { width: 80%; }
}