/* Site-wide styles that used to sit inside <style> tags in Views\Shared\_Layout.cshtml.
   Moved here so browsers can cache them. Loaded right after VL.css, in the same order as before. */

/* No white box behind a list of cards. Only the mobile pages draw cards (.alert-card, .m-card),
   so desktop pages are not affected. */
.content-placeholder:has(.alert-card, .m-card),
.content-placeholder:has(.alert-card, .m-card)::before,
.content-placeholder:has(.alert-card, .m-card)::after,
.content-placeholder:has(.alert-card, .m-card) .modern-trades-container,
.content-placeholder:has(.alert-card, .m-card) .modern-trades-container::before,
.content-placeholder:has(.alert-card, .m-card) .modern-trades-container::after,
.content-placeholder:has(.alert-card, .m-card) .trades-table-wrapper,
.content-placeholder:has(.alert-card, .m-card) .dataTables_wrapper,
.content-placeholder:has(.alert-card, .m-card) .dt-container,
.content-placeholder:has(.alert-card, .m-card) table,
.content-placeholder:has(.alert-card, .m-card) tbody,
.content-placeholder:has(.alert-card, .m-card) tr,
.content-placeholder:has(.alert-card, .m-card) td {
    background: transparent !important;
    background-color: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

/* Mobile card pages (Trades, Clusters, Alert Logs, Earnings...): the rule above clears the box behind
   the cards, which also stripped the page title of its box. This puts the title back in its own rounded
   glass box, the same look as the Daily Highlights title. */
.content-placeholder:has(.alert-card, .m-card) .trades-header {
    margin-bottom: 8px;
    border-radius: 12px;
    border: 1px solid var(--glass-border, rgba(128, 128, 128, 0.25));
    background: var(--glass-bg-light) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    backdrop-filter: blur(30px) !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06) !important; /* small, so the list's edge doesn't clip it */
}

/* Grid footer: "Showing 1 to 100 of 1,100 entries" on the left, page buttons on the right, in their own
   rounded glass box just below the grid (moved there by a script in _Layout.cshtml). */
.grid-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin-top: 10px;
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid var(--glass-border, rgba(128, 128, 128, 0.25));
    background: var(--glass-bg-light);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    box-shadow: 0 8px 32px var(--glass-shadow);
    font-size: 13px;
    color: var(--text-secondary);
}

    .grid-footer .dataTables_info,
    .grid-footer .dt-info,
    .grid-footer .dataTables_paginate,
    .grid-footer .dt-paging {
        float: none !important;
        margin: 0 !important;
        padding: 0 !important;
        font-size: 13px !important;
        color: var(--text-secondary) !important;
    }

    .grid-footer .dt-paging nav,
    .grid-footer .dataTables_paginate > span {
        display: inline-flex;
        align-items: center;
        gap: 2px;
    }

    /* Page buttons: dark, easy-to-read numbers, a soft highlight on hover, the current page in solid blue. */
    .grid-footer .paginate_button,
    .grid-footer .dt-paging-button {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        min-width: 32px;
        height: 30px;
        padding: 0 8px !important;
        margin: 0 !important;
        border: 1px solid transparent !important;
        border-radius: 8px !important;
        background: transparent !important;
        font-size: 14px !important;
        font-weight: 600;
        color: var(--text-primary) !important;
        box-shadow: none !important;
        cursor: pointer;
    }

        .grid-footer .paginate_button:hover,
        .grid-footer .dt-paging-button:hover {
            background: rgba(2, 136, 209, 0.12) !important;
            border-color: rgba(2, 136, 209, 0.35) !important;
            color: var(--text-primary) !important;
        }

        .grid-footer .paginate_button.current,
        .grid-footer .dt-paging-button.current {
            background: #0288d1 !important;
            border-color: #0288d1 !important;
            color: #ffffff !important;
        }

        .grid-footer .paginate_button.disabled,
        .grid-footer .dt-paging-button.disabled {
            opacity: 0.35;
            cursor: default;
            background: transparent !important;
            border-color: transparent !important;
        }

    .grid-footer .ellipsis {
        padding: 0 4px;
        color: var(--text-secondary);
    }

/* Videos page: each video is its own card (same look as the cards elsewhere), sitting directly on the page
   under the title box - no outer box around the grid. A round play button sits on each thumbnail. */
.modern-trades-container:has(> .youtube-videos) {
    background: transparent !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    overflow: visible !important;
}

.modern-trades-container > .youtube-videos {
    padding: 0 !important;
}

.youtube-videos .video-item {
    border-radius: 14px;
    border: 1px solid var(--glass-border, rgba(128, 128, 128, 0.25));
    background: var(--bg-secondary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

    .youtube-videos .video-item:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
    }

.youtube-videos .video-thumbnail::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 52px;
    height: 52px;
    margin: -26px 0 0 -26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='9 7 18 12 9 17' fill='white'/%3E%3C/svg%3E") center / 26px no-repeat;
    transition: background-color 0.2s ease;
}

.youtube-videos .video-item:hover .video-thumbnail::after {
    background-color: rgba(2, 136, 209, 0.9);
}

.youtube-videos .video-info {
    padding: 12px 14px 14px 14px;
}

.youtube-videos .video-title {
    font-weight: 600;
    line-height: 1.35;
}

/* Icon links (video, help "?", Excel...): no underline. The space after the icon inside the link
   was being underlined, which showed as a small "_" next to the icon. */
a:has(> svg),
a:has(> img) {
    text-decoration: none !important;
}

/* Title-bar icons (Excel, video, help "?"): all centered on the same line. The Excel icon is a button
   and the others are links, which the browser lined up slightly differently, so the video icon sat a
   little higher than the "?". */
.trades-header a:has(> svg),
.trades-header a:has(> img),
.trades-header button:has(> img),
.trades-header button:has(> svg) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    vertical-align: middle !important;
    line-height: 0;
}

    .trades-header a:has(> svg) > svg,
    .trades-header a:has(> img) > img,
    .trades-header button:has(> img) > img,
    .trades-header button:has(> svg) > svg {
        display: block;
    }

/* Desktop grid pages (Trades, Clusters, Cluster Bombs, Levels, Alert Logs, volume pages...): the page title
   sits in its own rounded glass box, with the grid in a second box below it - the same look as the
   Daily Highlights title. Before, the title was a strip joined to the top of the grid.
   Only containers that hold BOTH a title and a grid are changed; a title-only box (Daily Highlights) is not. */
@media (min-width: 769px) {
    .modern-trades-container:has(> .trades-header):has(> .trades-table-wrapper) {
        background: transparent !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        overflow: visible !important;
        border-radius: 0 !important;
    }

        .modern-trades-container:has(> .trades-header):has(> .trades-table-wrapper) > .trades-header {
            margin-bottom: 10px;
            border-radius: 12px !important;
            border: 1px solid var(--glass-border, rgba(128, 128, 128, 0.25));
            box-shadow: 0 8px 32px var(--glass-shadow);
            -webkit-backdrop-filter: blur(30px);
            backdrop-filter: blur(30px);
        }

        .modern-trades-container:has(> .trades-header):has(> .trades-table-wrapper) > .trades-table-wrapper {
            border-radius: 12px !important;
            box-shadow: 0 8px 32px var(--glass-shadow);
            -webkit-backdrop-filter: blur(30px);
            backdrop-filter: blur(30px);
        }

    /* When the rows have their own box (.grid-body, added by a script in _Layout.cshtml), the old grid box
       around it turns invisible: it can be taller than the rows, which showed as a gray band under the
       last row and pale corners around the rounded edge. */
    /* Rounded and trimmed to the same curve as the grid, so nothing behind the grid can poke out past its
       rounded corners as a square gray corner. */
    .modern-trades-container:has(> .trades-header):has(> .trades-table-wrapper) > .trades-table-wrapper:has(.grid-body) {
        background: transparent !important;
        box-shadow: none !important;
        -webkit-backdrop-filter: none !important;
        backdrop-filter: none !important;
        border-radius: 12px !important;
        overflow: hidden !important;
        padding: 0 !important;
    }

        .modern-trades-container:has(> .trades-header):has(> .trades-table-wrapper) > .trades-table-wrapper:has(.grid-body) :is(.dataTables_wrapper, .dt-container, .dt-layout-row, .dt-layout-cell, .dt-layout-table) {
            background: transparent !important;
            box-shadow: none !important;
            margin: 0 !important;
            padding: 0 !important;
        }

    /* !important: Trades has a script that switches off trimming on the boxes around its grid; this keeps the
       rounded corners trimmed anyway. */
    /* Same edge, background and shadow as the title box and footer box, so all three match. */
    .grid-body {
        border-radius: 12px;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        border: 1px solid var(--glass-border, rgba(128, 128, 128, 0.25));
        background: var(--glass-bg-light);
        box-shadow: 0 8px 32px var(--glass-shadow);
        -webkit-backdrop-filter: blur(30px);
        backdrop-filter: blur(30px);
    }

        .grid-body > table {
            margin: 0 !important;
        }

            /* No divider line under the last row - it curved into the rounded corners as a gray mark. */
            .grid-body > table > tbody > tr:last-child > td,
            .grid-body > table > tbody > tr:last-child > th {
                border-bottom: none !important;
            }

            .grid-body > table {
                border-bottom: none !important;
            }

    /* (The grid's corner cells used to be rounded here too. Not needed now that .grid-body trims the
       corners, and it left a sliver of background showing in each rounded corner.) */
}

/* Phones: newsletter articles clear the fixed site header, same 60px the mobile pages use.
   Each article carries its own copy of the .nl-page styles, so this one rule covers them all.
   "body .nl-page" outranks the articles' own ".nl-page" padding. */
@media (max-width: 768px) {
    body .nl-page {
        padding-top: 60px;
    }
}

/* Mobile only: hide the social/contact icons in the footer.
   768px matches the breakpoint the mobile menu script already uses. */
@media (max-width: 768px) {
    #footer .social-links {
        display: none !important;
    }
}

/* Footer view switch (Auto / Mobile / Desktop) - replaces the old dropdown. */
.view-mode-switch {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.view-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 30px;
    padding: 4px 12px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #ffffff;
    font-size: 12px;
    line-height: 1;
    opacity: 0.85;
    cursor: pointer;
    white-space: nowrap;
}

    .view-mode-option:hover {
        opacity: 1;
        background: rgba(255, 255, 255, 0.12);
    }

    .view-mode-option.active {
        opacity: 1;
        font-weight: 600;
        background: #ffffff;
        color: #0288b5;
        cursor: default;
    }

[data-theme="dark"] .view-mode-option.active {
    background: var(--accent-blue);
    color: #ffffff;
}

/* Mobile only: compact footer.
   Row 1 = short copyright on the left, view switch on the right.
   Row 2 = admin stats (admins only), in smaller text.
   Desktop footer is unchanged. */
@media (max-width: 768px) {
    #footer {
        display: grid !important;
        grid-template-columns: 1fr auto;
        align-items: center;
        column-gap: 8px;
        row-gap: 2px;
        padding: 6px 10px !important;
        min-height: 0 !important;
        height: auto !important;
    }
        /* Let the copyright and admin stats sit directly in the footer's grid. */
        #footer .footer-links {
            display: contents !important;
        }

        #footer .footer-copyright {
            grid-column: 1;
            grid-row: 1;
            font-size: 11px;
            text-align: left;
            margin: 0 !important;
        }

        #footer .copyright-long {
            display: none;
        }

        #footer .footer-view-mode {
            grid-column: 2;
            grid-row: 1;
            padding-left: 0 !important;
            margin: 0 !important;
        }

        #footer .footer-admin-stats {
            grid-column: 1 / -1;
            grid-row: 2;
            margin: 0 !important;
        }

            #footer .footer-admin-stats td {
                font-size: 10px;
                padding: 0 !important;
                text-align: left;
            }

    .view-mode-switch {
        padding: 2px;
    }

    .view-mode-option {
        min-height: 26px;
        padding: 3px 9px;
        font-size: 11px;
        gap: 4px;
    }
}

/* Very narrow phones: drop the little icons so the switch still fits beside the copyright. */
@media (max-width: 360px) {
    .view-mode-option svg {
        display: none;
    }
}

/* Left nav pin. The pin only shows while the menu is open. Pinned = the menu stays open. */
.nav-pin-row {
    display: flex;
    justify-content: flex-end;
    padding: 4px 8px 0 8px;
}

.left-nav:not(.expanded) .nav-pin-row {
    display: none;
}

.nav-pin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-primary);
    opacity: 1;
    cursor: pointer;
}

    /* Solid pin, same color as the text: black in light mode, the light text color in dark mode. */
    .nav-pin-btn svg {
        fill: currentColor;
        stroke: currentColor;
    }

    .nav-pin-btn:hover {
        background: rgba(128, 128, 128, 0.15);
    }

.left-nav.pinned .nav-pin-btn svg {
    transform: rotate(45deg);
}

/* Phones use the slide-out menu, so no pin there. */
@media (max-width: 768px) {
    .nav-pin-row {
        display: none !important;
    }
}

/* Counts after Trades / Trade Clusters / Trade Cluster Bombs, e.g. "Trades [25K]". */
.nav-count {
    margin-left: 4px;
    opacity: 0.7;
}

/* Dark mode: the open menu item (e.g. "Aggregate Volume") gets a deeper blue so its white text is easy to read. */
[data-theme="dark"] .left-nav .nav-item.active,
[data-theme="dark"] .left-nav .nav-item.active:hover {
    background: #0277bd !important;
    background-color: #0277bd !important;
    color: #ffffff !important;
}

/* Round logo in the top right: the VL bars, "VL" and the ring, drawn in code so they stay sharp at this small size.
   White circle in light mode, dark gray circle in dark mode. */
.user-avatar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3ClinearGradient id='r' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%230a5ed8'/%3E%3Cstop offset='1' stop-color='%2300c6ff'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%2300c6ff'/%3E%3Cstop offset='1' stop-color='%230a5ed8'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='50' cy='50' r='46' fill='%23ffffff' stroke='url(%23r)' stroke-width='7'/%3E%3Cg fill='url(%23b)'%3E%3Crect x='26' y='32' width='8' height='16'/%3E%3Crect x='36' y='26' width='8' height='22'/%3E%3Crect x='46' y='19' width='8' height='29'/%3E%3Crect x='56' y='26' width='8' height='22'/%3E%3Crect x='66' y='32' width='8' height='16'/%3E%3C/g%3E%3Ctext x='50' y='80' text-anchor='middle' font-family='Arial, Helvetica, sans-serif' font-weight='900' font-size='32' letter-spacing='1' fill='%232f2f2f'%3EVL%3C/text%3E%3C/svg%3E") !important;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 50%;
}

[data-theme="dark"] .user-avatar {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3ClinearGradient id='r' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%230a5ed8'/%3E%3Cstop offset='1' stop-color='%2300c6ff'/%3E%3C/linearGradient%3E%3ClinearGradient id='b' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%230a5ed8'/%3E%3Cstop offset='1' stop-color='%2300c6ff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Ccircle cx='50' cy='50' r='46' fill='%232f2f2f' stroke='url(%23r)' stroke-width='7'/%3E%3Cg fill='url(%23b)'%3E%3Crect x='26' y='32' width='8' height='16'/%3E%3Crect x='36' y='26' width='8' height='22'/%3E%3Crect x='46' y='19' width='8' height='29'/%3E%3Crect x='56' y='26' width='8' height='22'/%3E%3Crect x='66' y='32' width='8' height='16'/%3E%3C/g%3E%3Ctext x='50' y='80' text-anchor='middle' font-family='Arial, Helvetica, sans-serif' font-weight='900' font-size='32' letter-spacing='1' fill='%23f2f2f2'%3EVL%3C/text%3E%3C/svg%3E") !important;
}

/* Filter panels: the Reset / Apply buttons are moved to the top of the panel, under the "Filters" title
   (see MoveFilterButtonsToTop). These undo the "stuck to the bottom" styling they had. */
.filters-actions-top {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    margin-top: 0 !important;
    border-top: none !important;
    border-bottom: 1px solid var(--border-color);
}

/* The "VLES:" label in the header is bold in both light and dark mode. */
#ExhaustionScores td a.ticker-link {
    font-weight: 700 !important;
}

/* Dark mode: the VLES scores in the header sit in a soft pill (like light mode) with brighter text. */
[data-theme="dark"] #ExhaustionScores {
    border-collapse: separate !important;
    border-spacing: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
}

    [data-theme="dark"] #ExhaustionScores td {
        background: transparent !important;
        color: #e6edf3 !important;
    }

        [data-theme="dark"] #ExhaustionScores td:first-child {
            padding-left: 12px !important;
        }

        [data-theme="dark"] #ExhaustionScores td:last-child {
            padding-right: 12px !important;
        }

        [data-theme="dark"] #ExhaustionScores td a {
            color: #e6edf3 !important;
        }

            [data-theme="dark"] #ExhaustionScores td a.ticker-link {
                color: #6cc4f5 !important;
                font-weight: 700;
            }

/* The menu item for the page you're on: blue bar on the left, light blue background, bold text. */
.left-nav .nav-submenu-item.current {
    background: rgba(2, 136, 209, 0.18) !important;
    box-shadow: inset 3px 0 0 #0288d1;
    font-weight: 600;
}

[data-theme="dark"] .left-nav .nav-item.active .nav-text,
[data-theme="dark"] .left-nav .nav-item.active .nav-icon {
    color: #ffffff !important;
    font-weight: 600;
}

/* VLES on phones: the wide header table is swapped for its own thin row under the header.
   Example: VLES   Total [108]   30D [4]   90D [7]   365D [15]
   Each number sits in a green / yellow / red pill. Tapping a score opens its chart.
   Desktop is unchanged. */
.vles-strip {
    display: none;
}

@media (max-width: 768px) {
    #VlesHeaderScores {
        display: none !important;
    }

    #Header {
        flex-wrap: wrap !important;
        height: auto !important;
    }

    .vles-strip {
        display: flex;
        flex-basis: 100%;
        width: 100%;
        box-sizing: border-box;
        align-items: center;
        justify-content: space-between;
        gap: 6px;
        margin-top: 4px;
        padding: 6px 10px;
        border-top: 1px solid rgba(128, 128, 128, 0.25);
        font-size: 12px;
        white-space: nowrap;
    }
}

.vles-strip a {
    color: var(--text-primary) !important;
    text-decoration: none !important;
}

[data-theme="light"] .vles-strip {
    border-top-color: rgba(255, 255, 255, 0.4);
}

    [data-theme="light"] .vles-strip a {
        color: #ffffff !important;
    }

.vles-strip-label {
    font-weight: 800;
    letter-spacing: 0.5px;
}

.vles-seg {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    opacity: 0.95;
}

.vles-badge {
    display: inline-block;
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 10px;
    line-height: 20px;
    text-align: center;
    font-weight: 700;
    background: rgba(128, 128, 128, 0.35);
    color: #ffffff;
}

.vles-green {
    background: var(--success-green) !important;
    color: #ffffff !important;
}

.vles-yellow {
    background: var(--warning-yellow) !important;
    color: #000000 !important;
}

.vles-red {
    background: var(--accent-red) !important;
    color: #ffffff !important;
}
