:root {
    /* Colors */
    /* Background Colors */
    --bg-primary: #0f1115; /* Main background */
    --bg-secondary: #2a2a25; /* Secondary background (sidebar) */
    --bg-tertiary: #212220; /* Tertiary background (dropdowns, modal backgrounds) */
    --bg-header: #686349; /* Header background */
    --bg-sidebar: #2a2a25; /* Secondary background (cards, panels, etc.) */
    --bg-content: #979dac; /* Content background */
    --bg-table: #222; /* Table background */
    --bg-table-header: #333; /* Table header background */
    --bg-table-row-odd: #2c2c2c; /* Odd table rows */
    --bg-table-row-even: #3a3a3a; /* Even table rows */
    --bg-dropdown: white; /* Dropdown background */
    --bg-tab: #222; /* Tab background */
    --bg-login-container: rgba(255, 255, 255, 0.9); /* Login container background */
    --bg-dropdown-hover: #e2e6ea; /* Dropdown hover background */
    
    /* Text Colors */
    --text-primary: #e3e5eb; /* Main text color */
    --text-secondary: #ddd; /* Secondary text color (tables) */
    --text-inactive: #979dac; /* Inactive text color */
    --text-content: #e4e6ec; /* Content text color */
    --text-content-label: #686349; /* Content label text color */
    --text-primary-hl: #666; /* Highlighted text color */
    --text-inverse: #000; /* Inverted text color */
    --text-dropdown: #333; /* Dropdown text color */
    --text-dropdown-inactive: #ccc; /* Inactive dropdown text */
    --text-login: #333; /* Login text color */
    --text-status: #007bff; /* Status message color */

    /* Shadow colors */
    --shadow-primary: #555; /* Primary shadow color */
    --shadow-login: rgba(0, 0, 0, 0.2); /* Login shadow */
    
    /* Highlight colors */
    --hl-primary: #0477ee; /* Primary highlight color */
    --hl-secondary: #f50000; /* Secondary highlight color */
    --hl-hover: #7ba077; /* Hover highlight color */
    --hl-active: #7ba077; /* Active element color */
    --hl-link: white; /* Link color */
    --hl-link-hover: #47a3ff; /* Link hover color */
    --hl-toggle: #7ba077; /* Toggle button color */
    --hl-portfolio-header: #7ca178; /* Portfolio header color */
    --hl-info-toggle: #696349; /* Info tab toggle color */
    
    /* Button colors */
    --btn-primary: #007bff; /* Primary button color */
    --btn-primary-hover: #0056b3; /* Primary button hover */
    
    /* Border colors */
    --border-primary: #ddd; /* Primary border color */
    --border-table: #444; /* Table border color */
    
    /* Loader colors */
    --loader-primary: #0477ee; /* Loader primary color */
    --loader-secondary: #1e99f3; /* Loader secondary color */
    --loader-tertiary: #39bdf9; /* Loader tertiary color */
}

/* Scrollbar base */
::-webkit-scrollbar {
    width: 6px; /* Adjust width */
    height: 6px; /* For horizontal scrollbar */
}

/* Track (background) */
::-webkit-scrollbar-track {
    background: #121212; /* Dark background */
}

/* Thumb (draggable part) */
::-webkit-scrollbar-thumb {
    background: #888; /* Light gray */
    border-radius: 6px;
    position: relative;
}

/* Hover effect */
::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Arrows - Top */
::-webkit-scrollbar-button:single-button:decrement {
    display: block;
    height: 24px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="gray"><path d="M12 8l-6 6h12z"/></svg>')
        no-repeat center;
    background-size: cover;
}

/* Arrows - Bottom */
::-webkit-scrollbar-button:single-button:increment {
    display: block;
    height: 24px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="gray"><path d="M12 16l6-6H6z"/></svg>')
        no-repeat center;
    background-size: cover;
}

/* Reset and global styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
    font-size: 14px;
}

/* Full-page layout */
body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Full-page background */
.login-page {
    background: url("img/background.avif") no-repeat center center/cover;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Centered login box */
.login-container {
    background: var(--bg-login-container);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0px 4px 10px var(--shadow-login);
    width: 300px;
    text-align: center;
    animation: fadeIn 0.5s ease-in-out;
}
/* Form styling */
.login-container h2 {
    margin-bottom: 20px;
    font-size: 22px;
    color: var(--text-login);
}
/* Input fields */
.login-container input {
    border: 1px solid var(--border-primary);
}
/* Login button */
.login-container button {
    background: var(--btn-primary);
    color: var(--hl-link);
    border: none;
    cursor: pointer;
    transition: background 0.3s;
}
.login-container input,
.login-container button {
    width: 100%;
    display: block;
    margin: 10px auto; /* Center elements */
    padding: 10px;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box; /* Include padding & border in width */
}
.login-container button:hover {
    background: var(--btn-primary-hover);
}
.login-container button:disabled {
    cursor: wait;
}

/* Status message */
#status-message {
    display: none;
    color: var(--text-status);
    font-size: 0.9em;
    margin-top: 10px;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Loader/spinner */
.loader {
    display: none; /* Initially hidden  */
    width: 50px;
    height: 50px;
    margin: 10px auto; /* Center the spinner */
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--loader-primary);
    -webkit-animation: spin 2s linear infinite; /* Chrome, Opera 15+, Safari 5+ */
    animation: spin 2s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */
}
.loader:before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--loader-secondary);
    -webkit-animation: spin 3s linear infinite; /* Chrome, Opera 15+, Safari 5+ */
    animation: spin 3s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */
}
.loader:after {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: var(--loader-tertiary);
    -webkit-animation: spin 1.5s linear infinite; /* Chrome, Opera 15+, Safari 5+ */
    animation: spin 1.5s linear infinite; /* Chrome, Firefox 16+, IE 10+, Opera */
}
@keyframes spin {
    0% {
        -webkit-transform: rotate(0deg); /* Chrome, Opera 15+, Safari 3.1+ */
        transform: rotate(0deg); /* Firefox 16+, IE 10+, Opera */
    }
    100% {
        -webkit-transform: rotate(360deg); /* Chrome, Opera 15+, Safari 3.1+ */
        transform: rotate(360deg); /* Firefox 16+, IE 10+, Opera */
    }
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    height: 50px;
    background-color: var(--bg-header);
    color: var(--hl-link);
    box-shadow: 0 2px 8px var(--bg-header);
    z-index: 99;
}
.header h1 {
    font-family: "Raleway", sans-serif;
    font-size: 1.5em;
    font-weight: 600;
    /* letter-spacing: 1px; */
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px; /* Space between username and logo */
    position: relative; /* Needed for dropdown positioning */
}
/* Dropdown container to position relative to username */
.dropdown-container {
    position: relative;
    display: inline-block;
}
.user-dropdown {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 10px;
    /* background: transparent;
    border: none; */
    background-color: var(--bg-tertiary);
    /* border: 1px solid #333; */
    border-radius: 5px;

    color: var(--text-content);
    cursor: pointer;
    font-size: 1em;
    transition: color 0.2s ease-in-out;
    white-space: nowrap;
}
.user-dropdown::after {
    content: "▼"; /* Downward arrow */
    font-size: 0.8em;
}
.user-dropdown:hover,
.user-dropdown.active {
    background: var(--bg-table-header);
}

/* Dropdown menu */
.dropdown-menu {
    visibility: hidden; /* Use visibility instead of display */
    opacity: 0;
    position: absolute;
    top: 110%; /* Align slightly below username */
    left: 0;
    background: var(--bg-dropdown);
    /* color: black; */
    /* color: unset; */
    border-radius: 5px;
    box-shadow: 0px 4px 6px var(--shadow-login);
    overflow: hidden;
    z-index: 10;
    transform-origin: top;
    transform: scale(0.95);
    transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out, visibility 0.2s;
    min-width: 100%; /* Ensures at least user-dropdown width */
}
.dropdown-menu.show {
    /* display: block; */
    visibility: visible; /* Makes it appear without instantly displaying */
    opacity: 1;
    transform: scaleY(1);
}
/* Dropdown items */
.dropdown-item {
    /* width: 100%; */
    padding: 10px;
    text-align: left;
    border: none;
    background: none;
    white-space: nowrap;
    font-size: 0.9em;
    color: var(--text-dropdown);
    cursor: pointer;
}
.dropdown-item.inactive {
    color: var(--text-dropdown-inactive);
    cursor: not-allowed;
}
.dropdown-item:not(.inactive):hover {
    background: var(--bg-dropdown-hover);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px; /* was 15px */
}

.qtec-logo {
    height: 30px; /* suggested was 35px */
}

/* Main container */
.container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    padding: 20px;
    overflow-y: auto;
    /* border-right: 2px solid #ddd; */
    /* box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1); */
    box-shadow: 2px 0 10px var(--bg-sidebar);
}
.sidebar h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
}
.sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.sidebar li {
    padding: 3px 12px;
    margin-top: 3px;

    cursor: pointer;
    transition: background 0.3s ease;
}

/* Fund list styles */
#fund-list {
    list-style: none;
    padding: 0;
}

/* company description info tab */

/* NEXT LINE MODIFIED SO IT DOES NOT APPLY TO TABLE */
.info-item .info-text {
    color: var(--text-content);
}

/* fund description  */

/* #fund-description {
    color: #1a5c83;
  } */

/* Styling for each fund option */
.fund-option {
    padding: 10px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}
/* Highlight "All Funds" option */
.all-funds {
    font-weight: bold;
    /* background: #ccc;
    border-bottom: 2px solid #ddd; */
    margin-bottom: 8px;
}
/* Grey out inactive funds */
.fund-option.inactive {
    color: var(--text-inactive);
    /* background: #f50000; */
    cursor: text;
    opacity: 0.6;
}
/* Hover & active effects */
/* .fund-option:hover { */
.fund-option:not(.inactive):not(.active):hover {
    background: var(--hl-hover);
    font-weight: 600;
}
/* .fund-option.all-funds:not(.active):hover {
    background: #aaa;
} */
.fund-option.active {
    pointer-events: none; /* Prevent clicks */
    background: var(--hl-active);
    color: var(--hl-link);
    font-weight: 600;
}
.fund-option.active .fund-icon {
    filter: brightness(0) invert(1); /* White when active */
}

/* Fund icon (for All Funds) */
.fund-option .fund-icon {
    /* width: 16px; */
    height: 1em;
    margin-right: 6px;
    vertical-align: middle;
}

/* MODIFIED FOR FUND LOGO */
/* Main content */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}
.content h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    white-space: nowrap;
}
/* Fund icon (for All Funds) */
.content .fund-icon {
    height: 1em;
    margin-right: 8px;
    vertical-align: middle;
}
.content #fund-header {
    display: flex;
    gap: 16px; /* Space between name and logo */
}

/* Style the dynamically added fund logo */
.content #fund-header .logo {
    height: 1.6em;
    filter: brightness(0) saturate(1) invert(1); /* Makes logo appear white */
}
/* END OF MODIFIED FOR FUND LOGO */

/* company logo beside name */
.company-logo {
    width: 180px;
    background-size: contain;
}

/* Tabs container */
.tabs {
    pointer-events: none; /*  Prevent clicks */
    display: flex;
    /* border-bottom: 2px solid #ddd; */
    /* margin-bottom: 10px; */
}
.tabs.active {
    pointer-events: auto; /* Allow clicks */
    opacity: 1;
}
/* Enable tabs when a fund is selected */
/* Tab buttons */
.tab {
    /* Default: Disable tabs */
    opacity: 0.5; /* Make tabs look inactive */
    padding: 6px 15px;
    border: 1px solid var(--border-primary);
    cursor: pointer;
    font-size: 1em;
    border-radius: 6px 6px 0 0;
    transition: background 0.3s, color 0.3s, border-bottom 0.3s;
    margin-right: 5px;
    background: var(--bg-tab);
    color: var(--text-primary);
   
}
/* .tabs.active .tab:not(.active) { */
/* Active tab styling */
.tab.active {
    pointer-events: none; /* Prevent clicks */
    background: var(--hl-active);
    opacity: 1;
    color: var(--hl-link);
    
    font-weight: bold;
}
/* Hover effect for inactive tabs only */
.tab:not(.active):hover {
    background: var(--hl-hover);
    opacity: 1;
    
}

/* Default tab icon styles */
.tab-icon {
    /* width: 16px; */
    height: 0.8em;
    margin-right: 8px;
    vertical-align: middle;
    transition: filter 0.3s ease;
}

/* Adjust icon for inactive tabs */
.tab:not(.active) .tab-icon {
    filter: brightness(0.3); /* Darken for better contrast */
}

/* Adjust icon for active tab */
.tab.active .tab-icon {
    filter: brightness(5); /* Lighten for contrast */
}

/* Tab content */
.tab-content {
    display: none;
    background: var(--bg-content);
    padding: 15px;
    border-radius: 6px;
    box-shadow: 1px 1px 6px var(--shadow-primary);
}
/* Show active tab */
.tab-content.active {
    display: block;
}

/* Grid layout for fund details */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Two equal columns */
    /* grid-template-columns: 1fr 1fr; Two equal columns */
    /* grid-template-columns: 180px auto; Labels fixed width, values dynamic */
    column-gap: 40px; /* Space between columns */
    row-gap: 12px; /* Space between rows */
    align-items: center; /* Align labels and values at the top */
    width: 100%;
    max-width: 900px; /* Prevents it from being too wide */
 
}

/* Individual row */
.info-item {
    display: flex;
    /* flex-direction: column; /* Stack label above value 
    display: contents; Allows proper column layout */
}
.info-item.hidden {
    display: none;
}

/* Labels */
.info-label {
    font-weight: bold;
    color: var(--text-content-label);
    /* color: #333; */
    text-align: right;
    width: 40%;
    /* align-self: start; */
    padding-right: 10px; /* Small space before value */
    /* white-space: nowrap; Prevents wrapping for short labels */
}

/* Values */
/* NEXT LINE MODIFIED SO IT DOES NOT APPLY TO TABLE */
.info-item .info-value {
    color: var(--text-content);
    /* align-self: start; */
    /* min-width: 0; Prevents flexbox issues with overflow */
    /* overflow-wrap: break-word; Allows text to break if needed */
    width: 60%;
    text-align: left;
}
.info-item.double-column {
    grid-column: span 2; /* Description spans both columns */
    /* display: flex; */
    align-items: flex-start;
    /* text-align: left; */
}
.info-item.double-column .info-label {
    /* Only take up the same space as the normal labels despite spanning two columns */
    width: calc(0.2 * (100% - 40px)); /* 20% of the remaining width */
}


.toggle-btn {
    cursor: pointer;
    color: var(--hl-toggle);
    font-size: 0.9em;
    margin-left: 5px;
}
div #tab-info .toggle-btn {
    color: var(--hl-link);
}





.toggle-btn.hidden {
    display: none;
}
.icon {
    height: 0.8em;
    margin-left: 6px;
    margin-right: 6px;
    vertical-align: middle;
}
/* Flags */
.info-value .fi {
    margin-right: 8px;
}

/* General table styling */
.tab-content table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-table); /* Dark background for dark mode */
    color: var(--text-secondary); /* Light text for contrast */
    border-radius: 8px;
    overflow: hidden;
}

/* Table headers */
.tab-content table thead {
    background-color: var(--bg-table-header);
}

/* MODIFIED FOR TABLE STYLING AND SORTING */
.tab-content table th {
    text-align: left;
    padding: 8px;
    cursor: pointer;
    position: relative;
    user-select: none;
   
}

/* Sort icons */
.tab-content table th[data-order="asc"]::after {
    content: "↑"; /* Ascending arrow */
    margin-left: 8px;
}
.tab-content table th[data-order="desc"]::after {
    content: "↓"; /* Descending arrow */
    margin-left: 8px;
}
.tab-content table th.sortable:not(.active)::after {
    /* content: "⬍"; */ /* Descending arrow */
    content: "⬍";
    font-size: 0.9em;
    margin-left: 8px;
}
/* Highlight the active sorting column */
.tab-content table th.active {
    color: var(--hl-primary); /* Highlight color */
    font-weight: bold;
}
/* END OF MODIFIED FOR TABLE STYLING AND SORTING */

.tab-content table th:hover {
    color: var(--hl-link-hover); /* Highlight on hover */
}

/* Alternate row colors */
.tab-content table tbody tr:nth-child(odd) {
    background-color: var(--bg-table-row-odd);
}

.tab-content table tbody tr:nth-child(even) {
    background-color: var(--bg-table-row-even);
}
/* Row hover effect */
.tab-content table tbody tr:hover {
    background-color: var(--bg-header);
}
/* Table cells */
.tab-content table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-table);
    font-size: 0.9em;
}
.tab-content img.logo {
    max-width: 60px;
    max-height: 30px;
}

/* General table styling */
.tab-content table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-table); /* Dark background for dark mode */
    color: var(--text-secondary); /* Light text for contrast */
    border-radius: 8px;
    overflow: hidden;
}

/* Table headers */
.tab-content table thead {
    background-color: var(--bg-table-header);
}

.tab-content table th {
    text-align: left;
    padding: 8px;
    cursor: pointer;
    position: relative;
    user-select: none;
}

.tab-content table th:hover {
    color: var(--text-content-label); /* Highlight on hover */
}

/* header of table */

#header-portfolio {
    color: var(--hl-portfolio-header);
    background-color: #191c20;
}

/* Alternate row colors */
.tab-content table tbody tr:nth-child(odd) {
    background-color: var(--bg-table-row-odd);
}

.tab-content table tbody tr:nth-child(even) {
    background-color: var(--bg-table-row-even);
}
/* Row hover effect */
.tab-content table tbody tr:hover {
    background-color: var(--bg-tertiary);
}

tbody > tr > td > a {
    color: var(--hl-link);
    text-decoration: none;
    font-size: 0.9em;
}

tbody > tr > td > a:hover {
    color: var(--hl-link);
    text-decoration: underline;
}

/* Table cells */
.tab-content table td {
    padding: 8px;
    font-size: 0.9em;
}
.tab-content table .info-text {
    font-size: 0.9em;
}
.tab-content img.logo {
    max-width: 60px;
    max-height: 30px;
}