/* ==========================================================================
CSS CUSTOM PROPERTIES (CSS VARIABLES)
========================================================================== */

    /* Light theme variables (default) */
    :root {
        /* Typography */
        --font-family: 'Trebuchet MS', Helvetica, Arial, sans-serif;
        
        /* Layout */
        --table-width: 100%;
        --header-height: 28px;
        --row-height: 30px;
        --border-width: 1px;
        --font-size: 14px;
        --border-collapse: collapse;
        --cell-padding: 5px 8px;
        --navbar-width: 100%;
        
        /* Colors - Light Theme */
        --body-bg: #202837;
        --thead-bg: #212529;
        --text-color: #000000;
        --border-color: #dddddd;
        --bold-text-color: #000000;
        --normal-text-color: #000000;
        --text-hover-color: inherit;
        
        /* Table highlighting and animations */
        --highlight-bg: rgba(25, 135, 84, 1);
        --fade-odd-from: rgba(25, 135, 84, 1);
        --fade-odd-to: #ffffff;
        --fade-even-from: rgba(25, 135, 84, 1);
        --fade-even-to: #d9e1f2;
        --detail-even-bg: #d9e1f2;
        --detail-odd-bg: #ffffff;
        
        /* Articles table colors */
        --article-text-color: #000000;
        --article-header-bg: #212529;
        --article-header-text: #ffffff;
        --article-odd-bg: #ffffff;
        --article-even-bg: #d9e1f2;
        --article-link-color: #000000;
        --article-link-hover: #333333;
    }

    /* Dark theme overrides */
    [data-theme="dark"] {
        /* Colors - Dark Theme */
        --body-bg: #202837;
        --thead-bg: #212529;
        --text-color: #A0AEC0;
        --border-color: #252C3B;
        --bold-text-color: #A0AEC0;
        --normal-text-color: #A0AEC0;
        --text-hover-color: whitesmoke;
        
        /* Table highlighting and animations - Dark */
        --highlight-bg: rgba(74, 85, 104, 1);
        --fade-odd-from: rgba(74, 85, 104, 1);
        --fade-odd-to: #2E3749;
        --fade-even-from: rgba(74, 85, 104, 1);
        --fade-even-to: #1A202C;
        --detail-even-bg: #1A202C;
        --detail-odd-bg: #2E3749;
        
        /* Articles table colors - Dark */
        --article-text-color: #A0AEC0;
        --article-header-bg: #212529;
        --article-odd-bg: #2E3749;
        --article-even-bg: #1A202C;
        --article-link-color: #A0AEC0;
        --article-link-hover: #ffffff;
    }

/* ==========================================================================
KEYFRAME ANIMATIONS
========================================================================== */

    @keyframes fadeout-odd {
        0% {background-color: var(--fade-odd-from);}
        100% {background-color: var(--fade-odd-to);}
    }

    @keyframes fadeout-even {
        0% {background-color: var(--fade-even-from);}
        100% {background-color: var(--fade-even-to);}
    }

/* ==========================================================================
BASE LAYOUT & STRUCTURE
========================================================================== */
    
    .index-body {
        background-color: var(--body-bg);
        padding: 73px 16px 16px 16px;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    .index-container {
        width: 100%;
        max-width: 1300px;
        height: calc(100vh - 73px);
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        box-shadow:
            0 -8px 16px -4px #03a9f4,
            8px 0 16px -4px #03a9f4,
            0 8px 16px -4px #03a9f4,
            -8px 0 16px -4px #03a9f4;
        border-radius: 8px;
        overflow: hidden;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    body::-webkit-scrollbar {
        display: none;
    }

/* ==========================================================================
TABLE BASE STYLES
========================================================================== */

    table {
        width: 100%;
        border-collapse: collapse;
    }

/* ==========================================================================
SPOT TABLE STYLES
========================================================================== */

    .spot-table-wrapper {
        flex: 1;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .spot-table-wrapper::-webkit-scrollbar {
        display: none;
    }

    #spot-table {
        flex: 1;
        height: 100%;
        font-family: var(--font-family);
        font-size: var(--font-size);
        border-collapse: var(--border-collapse);
        width: var(--table-width);
        color: var(--text-color);
    }

    #spot-table th {
        height: var(--header-height);
        padding: 0 8px;
        text-align: left;
        background-color: var(--thead-bg);
        color: white;
    }

    #spot-table tbody tr {
        height: var(--row-height);
    }
    
    #spot-table td {
        height: var(--row-height);
        border: var(--border-width) solid var(--border-color);
        padding: var(--cell-padding);
        line-height: 1.2;
        vertical-align: middle;
    }

    /* Spot table column-specific styling */
    #spot-table th:nth-child(1), 
    #spot-table td:nth-child(1) {
        padding-left: 16px;
    }

    #spot-table th:nth-child(2), 
    #spot-table td:nth-child(2) {
        text-align: right;
        padding-right: 16px;
    }

    #spot-table th:nth-child(3), 
    #spot-table td:nth-child(3),
    #spot-table th:nth-child(4), 
    #spot-table td:nth-child(4),
    #spot-table th:nth-child(7), 
    #spot-table td:nth-child(7) {
        padding-left: 16px;
    }

    #spot-table th:nth-child(5), 
    #spot-table td:nth-child(5),
    #spot-table th:nth-child(6), 
    #spot-table td:nth-child(6),
    #spot-table th:nth-child(8), 
    #spot-table td:nth-child(8) {
        text-align: center;
    }

    #spot-table th:last-child,
    #spot-table td:last-child,
    #dxworld-article td:last-child {
        width: 150px; /* Adjust this value based on your date/time format */
        min-width: 150px;
        max-width: 150px;
        text-align: center;
    }

    /* Spot table highlighting and animations */
    #spot-table tr.highlight {
        background-color: var(--highlight-bg);
    }

    .fadeout-odd {
        animation: fadeout-odd 3s forwards;
    }

    .fadeout-even {
        animation: fadeout-even 3s forwards;
    }

/* ==========================================================================
DX WORLD ARTICLES TABLE
========================================================================== */

    .dxworld-table-wrapper {
        flex-shrink: 0;
    }

    #dxworld-table {
        display: flex;
        flex-direction: column;
        height: 177px;
        color: var(--article-text-color);
        border-collapse: collapse;
        width: 100%;
        font-family: var(--font-family);
        font-size: var(--font-size);
    }

    .dxworld-thead {
        background-color: var(--article-header-bg) !important;
        display: table;
        width: 100%;
    }
    
    .dxworld-thead th {
        background-color: var(--article-header-bg) !important;
        color: var(--article-header-text);
        padding-left: 16px;
        height: var(--header-height);
        line-height: 1.2;
        vertical-align: middle;       
    }

    .dxworld-thead th:first-child {
        width: calc(100% - 150px); 
        text-align: left;
        padding-left: 16px;
    }
    
    .dxworld-thead th:last-child {
        width: 150px; /* Match the date column width */
        text-align: center;
        padding-right: 16px;
    }

    #dxworld-table td {
        line-height: 1.2;
        height: var(--row-height);
        padding: var(--cell-padding);
    }

    #dxworld-table tbody {
        display: block;
        overflow-y: auto;
        flex: 1;
        -ms-overflow-style: none;
        scrollbar-width: none;
    }

    #dxworld-table tbody::-webkit-scrollbar {
        display: none;
    }

    #dxworld-table tbody tr {
        display: table;
        width: 100%;
    }

    #dxworld-article tr:nth-child(odd) {
        background-color: var(--article-odd-bg);
    }

    #dxworld-article tr:nth-child(even) {
        background-color: var(--article-even-bg);
    }

    /* Article content styling */
        .dx-inline-article {
        display: inline;
    }

    .dx-article-title {
        font-weight: bold;
        white-space: normal;
        color: var(--article-link-color);
        text-decoration: none;
        padding-left: 12px;
    }

    .dx-article-title:hover {
        color: var(--article-link-hover);
    }

    #dxworld-article td:first-child {
        max-width: 0;
        width: calc(100% - 150px);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #dxworld-article td:first-child:hover {
        white-space: normal;
        overflow: visible;
    }

    #dxworld-article td:nth-child(2) {
        text-align: center;
        vertical-align: middle;
        border-left: var(--border-width) solid var(--border-color);
    }

/* ==========================================================================
TEXT STYLING COMPONENTS
========================================================================== */

    .bold-text {
        font-weight: bold;
        color: var(--bold-text-color);
        text-decoration: none;
    }

    .bold-text:hover {
        color: var(--text-hover-color);
        text-decoration: none;
    }

    .normal-text {
        font-weight: normal;
        color: var(--normal-text-color);
        text-decoration: none;
    }

    .normal-text:hover {
        color: var(--text-hover-color);
        text-decoration: none;
    }

/* ==========================================================================
DETAIL ROW COMPONENTS
========================================================================== */

    .detail-even {
        background-color: var(--detail-even-bg) !important;
    }

    .detail-odd {
        background-color: var(--detail-odd-bg) !important;
    }

    .detail-row-flex-container {
        display: flex;
        width: 100%;
    }

    .detail-label {
        width: 21%;
        text-align: right;
        margin-right: 10px;
    }

    .detail-value {
        text-align: left;
        flex-grow: 1;
    }

/* ==========================================================================
NAVIGATION COMPONENTS
========================================================================== */

    #bottomNavbar {
        background-color: #212529 !important;
        flex-shrink: 0;
        width: var(--navbar-width);
    }

    .bottom-navbar-nav {
        display: flex;
        justify-content: center;
        margin: 0 auto;
        width: 100%;
    }

    .nav-item-centered {
        margin: 0 auto;
    }

    .no-vertical-padding {
        padding-top: 0;
        padding-bottom: 0;
    }

    .nav-link-small {
        padding-top: 0;
        padding-bottom: 0;
        font-size: 0.75rem;
    }

/* ==========================================================================
UTILITY CLASSES
========================================================================== */

    .hide {
        display: none;
    }

/* ==========================================================================
RESPONSIVE DESIGN
========================================================================== */

    /* Small screens */
    @media (max-width: 768px) {
        .hide-on-small-screens {
            display: none;
        }
    }

    /* Medium screens */
    @media screen and (min-width: 769px) and (max-width: 1400px) {
        .hide-on-medium-screens {
            display: none;
        }
    }

    /* Hide article summary and "Live Feed" text on screens less than 1400px */
    @media screen and (max-width: 1400px) {
        .dx-article-summary {
            display: none;
        }

        .live-feed-text {
            display: none;
        }
    }

    .index-container {
        /* Calculate height to show exactly N rows */
        height: calc(var(--header-height) + (30 * var(--row-height)));
        overflow-y: auto;
    }

    /* 28 + (# Rows * 30) + 177 */
    @media (min-height: 370px) and (max-height: 400px) {
        .index-container { height: 390px; }
    }

    @media (min-height: 400px) and (max-height: 430px) {
        .index-container { height: 420px; }
    }

    @media (min-height: 430px) and (max-height: 460px) {
        .index-container { height: 450px; }
    }
    
    @media (min-height: 460px) and (max-height: 490px) {
        .index-container { height: 480px; }
    }

    @media (min-height: 490px) and (max-height: 520px) {
        .index-container { height: 510px; }
    }

    @media (min-height: 520px) and (max-height: 550px) {
        .index-container { height: 540px; }
    }

    @media (min-height: 550px) and (max-height: 580px) {
        .index-container { height: 570px; }
    }

    @media (min-height: 580px) and (max-height: 610px) {
        .index-container { height: 600px; }
    }

    @media (min-height: 610px) and (max-height: 640px) {
        .index-container { height: 630px; }
    }
    
    @media (min-height: 640px) and (max-height: 670px) {
        .index-container { height: 660px; }
    }

    @media (min-height: 670px) and (max-height: 700px) {
        .index-container { height: 690px; }
    }

    @media (min-height: 700px) and (max-height: 730px) {
        .index-container { height: 690px; }
    }

    @media (min-height: 730px) and (max-height: 760px) {
        .index-container { height: 690px; }
    }

    @media (min-height: 760px) and (max-height: 790px) {
        .index-container { height: 690px; }
    }

    @media (min-height: 790px) and (max-height: 820px) {
        .index-container { height: 690px; }
    }

    @media (min-height: 820px) and (max-height: 850px) {
        .index-container { height: 720px; }
    }

    @media (min-height: 850px) and (max-height: 880px) {
        .index-container { height: 750px; }
    }

    @media (min-height: 880px) and (max-height: 910px) {
        .index-container { height: 780px; }
    }

    @media (min-height: 910px) and (max-height: 940px) {
        .index-container { height: 810px; }
    }

    @media (min-height: 940px) and (max-height: 970px) {
        .index-container { height: 840px; }
    }

    @media (min-height: 970px) and (max-height: 1000px) {
        .index-container { height: 870px; }
    }

    @media (min-height: 1000px) and (max-height: 1030px) {
        .index-container { height: 900px; }
    }

    @media (min-height: 1030px) and (max-height: 1060px) {
        .index-container { height: 930px; }
    }

    @media (min-height: 1060px) and (max-height: 1090px) {
        .index-container { height: 960px; }
    }

    @media (min-height: 1090px) {
        .index-container { height: 990px; }
    }

    /* DX World Articles Show/Hide Button */
    .dxworld-toggle-btn {
        background: none;
        border: none;
        color: var(--article-header-text);
        font-size: 14px;
        cursor: pointer;
    }

    .dxworld-toggle-btn[aria-expanded="true"]::after {
        content: " Close ✖";
    }