@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');
/* static/styles/brutalist.css (Unified & Corrected) */

/* --- Universal Reset & Font --- */
*, *::before, *::after { box-sizing: border-box; }

/* --- THEME DEFINITION --- */
:root {
    /* Light Mode (Default) */
    --bg-color: #f1f1f1;
    --text-color: #1a1a1a;
    --accent-color: #65ca96;
    --card-bg-color: #f1f1f1;
    --border-color: #1a1a1a;
    --shadow-color: #1a1a1a;
    --link-hover-color: #65ca96;
    --subtle-bg-color: #e0e0e0; /* For things like inactive tabs */
    --navbar-link: #d47500;
    --navbar-active: #0b9b6f;
    --subtle-text-color: #6c757d;
    
    /* Semantic colors for LIGHT MODE */
    --profit-color: #1E8449;
    --loss-color: #C0392B;
    --flash-success: #1E8449;
}

html.dark-mode {
    /* Dark Mode Theme */
    --bg-color: #1a1a1a;
    --text-color: #f1f1f1;
    --accent-color: #242b64;
    --card-bg-color: #2a2a2a;
    --border-color: #f1f1f1;
    --shadow-color: #f1f1f1;
    --link-hover-color: #4b5acf;
    --subtle-bg-color: #3a3a3a; /* For things like inactive tabs */
    --navbar-link: #FF8C00;
    --navbar-active: #0ac98e;
    --subtle-text-color: #adb5bd;

    /* Semantic colors for DARK MODE (redefined) */
    --profit-color: #58D68D; /* A pleasant, readable light green */
    --loss-color: #F1948A;   /* A soft, readable light red */
    --flash-success: #1E8449;
}

/*
  ==================================================================
  ANTI-FLICKER SNIPPET
  This hides the body until the theme is determined by the loader script,
  preventing the flash of the wrong theme.
  ==================================================================
*/
html:not(.theme-applied) body {
    visibility: hidden;
}
html.theme-applied body {
    visibility: visible;
}

/* --- BASE & TYPOGRAPHY --- */
html { font-size: 13px; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
    font-family: 'Space Mono', monospace;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

h1, h2, h3, h4, h5 { font-family: 'Space Mono', monospace; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }
a { color: var(--text-color); font-weight: 700; }
a:hover { color: var(--link-hover-color); }

/* --- MAIN LAYOUT CONTAINERS --- */
.auth-container, .dashboard-container, .summary-container {
    width: 100%;
    margin: 0 auto;
    padding: 0.5rem;
}
@media (min-width: 768px) {
    .auth-container, .dashboard-container, .summary-container {
        padding: 2.5rem;
    }
}

.summary-container {
    margin: 15px 5px 0px -5px;
}

.auth-container {
    max-width: 420px;
    background-color: var(--card-bg-color);
    border: 3px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: 8px 8px 0 var(--shadow-color);
    transition: all 0.2s ease-in-out;
}
.dashboard-container, .summary-container { max-width: 1400px; }

/* --- CARD COMPONENT --- */
.card {
    background: var(--card-bg-color);
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    margin-bottom: 2rem;
    transition: all 0.15s ease-in-out;
    padding: 0.5rem; /* Mobile-first: no padding */
}
@media (min-width: 768px) {
    .card { padding: 1.5rem; } /* Padding for larger screens */
}
.card:hover {
    transform: translate(8px, 8px);
    box-shadow: none;
}

.card-vizzu {
    min-height: 400px;
    background: var(--card-bg-color);
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    margin-bottom: 2rem;
    transition: all 0.15s ease-in-out;
    padding: 0.5rem; /* Mobile-first: no padding */
}
@media (min-width: 768px) {
    .card-vizzu { 
        padding: 1.5rem;  /* Padding for larger screens */
        min-height: unset;
    }
}
.card-vizzu:hover {
    transform: translate(8px, 8px);
    box-shadow: none;
}

#timeseriesVZ {
    height: 400px;
}
@media (mid-width: 768px) {
    #timeseriesVZ {
        height: unset;
    }
}

/* --- GRID LAYOUTS --- */
.dashboard-grid, .summary-grid {
    display: grid;
    grid-template-columns: 1fr; /* Single column on mobile */
    gap: 2rem;
}
@media (min-width: 992px) {
    .dashboard-grid, .summary-grid {
        grid-template-columns: repeat(2, 1fr); /* Two columns on desktop */
        /* grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); */
    }
}

.grid-column {
    min-width: 0;
}

/* --- FORMS & BUTTONS --- */
.form-group { position: relative; margin-bottom: 2rem; }
label {
    position: absolute; top: 0.8rem; left: 0.8rem; font-weight: 700;
    background-color: var(--card-bg-color); padding: 0 0.3rem;
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    pointer-events: none;
}
.label-active { transform: translateY(-1.7rem) scale(0.9); color: var(--link-hover-color); }
input[type="email"], input[type="text"], input[type="password"] {
    width: 100%; padding: 0.8rem; border: 3px solid var(--border-color);
    background-color: transparent; color: var(--text-color);
    font-family: 'Space Mono', monospace; font-size: 1rem;
    outline: none; transition: all 0.2s ease-in-out;
}
input:focus { border-color: var(--accent-color); box-shadow: 4px 4px 0 var(--accent-color); }

.btn {
    display: block; width: 100%; padding: 1rem;
    border: 3px solid var(--border-color); background-color: var(--accent-color);
    color: var(--text-color); box-shadow: 4px 4px 0 var(--shadow-color);
    font-family: 'Space Mono', monospace; font-size: 1.1rem; font-weight: 700;
    text-align: center; text-decoration: none; cursor: pointer;
    transition: all 0.15s ease-in-out; position: relative;
}
.btn:hover, .btn:focus { 
    transform: translate(4px, 4px); 
    box-shadow: none; 
    color: var(--text-color);
}
.btn-google { background-color: var(--card-bg-color); }

.form-link { text-align: center; margin-top: 1.5rem; }
.form-link a {
    color: var(--text-color);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 4px;
}
.form-link a:hover { color: var(--accent-color); }

/* --- ANIMATIONS & HTMX INDICATORS --- */
/* ADDED: Pulse animation for HTMX requests */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

/* ADDED: Shake animation for form errors */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.shake { animation: shake 0.3s ease-in-out; }

/* ADDED: Apply pulse animation via HTMX class */
.htmx-request .btn { animation: pulse 0.8s infinite; }

/* ADDED: HTMX indicator styles */
.htmx-indicator {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 200ms ease-in;
    font-weight: 700;
}
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request .btn-text { opacity: 0; } /* Hide text instead of display:none to prevent layout shift */

/* --- TABLES --- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { border: 1px solid var(--border-color); padding: 0.5rem; }
.data-table thead th { background-color: var(--accent-color); color: var(--text-color); }
.data-table .text-right { text-align: right; }

.data-table td[style] a {
    color: inherit;
    font-weight: inherit;
}

/* --- RESPONSIVE SCROLLING TABLE --- */
/* .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; } */
.table-wrapper { 
    overflow: auto; /* This creates the horizontal scrollbar */
    -webkit-overflow-scrolling: touch; 
    width: 100%; /* THIS IS THE CRITICAL FIX: Constrains the wrapper to the width of its parent card */
    margin-bottom: 1rem;
    position: relative;
}
.table-wrapper .data-table th, .table-wrapper .data-table td { white-space: nowrap; }
.table-wrapper .data-table th { position: sticky; top: 0; z-index: 10; }
.table-wrapper .data-table th:first-child, .table-wrapper .data-table td:first-child {
    position: sticky; left: 0; z-index: 5;
    background-color: var(--card-bg-color);
}
.table-wrapper .data-table th:first-child { z-index: 15; background-color: var(--accent-color); }


/* --- DataTables 2.x Integration (Brutalist Themed & Correctly Aligned) --- */
/* This is the base style for BOTH the top and bottom rows of controls */
.row {
    display: flex !important;
    flex-wrap: wrap; /* Allows items to stack on mobile */
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center;
    gap: 1.5rem; /* Provides consistent spacing */
}
.dt-layout-row {
    display: flex !important;
    flex-wrap: wrap; /* Allows items to stack on mobile */
    justify-content: space-between; /* Pushes items to opposite ends */
    align-items: center;
    gap: 1.5rem; /* Provides consistent spacing */
    margin: 0.25rem !important;
}

.dt-layout-row.dt-layout-table {
    overflow: auto;
}

/* Add margin between the top controls and the table */
.dt-layout-row:has(.dt-search) {
    margin-bottom: 0.5rem;
}

/* Add margin between the table and the bottom controls */
.dt-layout-row:has(.dt-info) {
    margin-top: 0.5rem;
}

/* This ensures the table itself takes up the full width */
.dt-table {
    width: 100%;
}

/* Style the "Show X entries" and "Search:" labels */
.dt-length {
    width: fit-content;
    margin: 0.25em 0 !important;
}
.dt-length label,
.dt-search label {
    display: none;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Style the search input and the length dropdown */

div.dt-container .dt-input {
    background-color: var(--card-bg-color) !important;
    background: var(--card-bg-color) !important;
}

.dt-search input,
.dt-length select {
    background-color: var(--card-bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
    padding: 0.4rem 0.6rem;
    font-family: 'Space Mono', monospace;
    border-radius: 0;
    flex-grow: 1;
}
.dt-search input:focus,
.dt-length select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 4px 4px 0 var(--accent-color);
}

/* Style the "Showing 1 to 10 of 57 entries" info text */

.dt-info {
    display: none;
    font-weight: 700;
    color: var(--text-color);
}
@media (min-width: 768px) {
    .dt-info {
        display: inherit;
    }
}
/* --- BRUTALIST PAGINATION --- */
.dt-paging {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0.3rem;
    margin: auto;
}
.dt-paging .dt-paging-button {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-color);
    background-color: var(--card-bg-color) !important;
    border: 3px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.15s ease-in-out;
}
.dt-paging .dt-paging-button:hover {
    background: var(--accent-color) !important;
    color: var(--text-color);
    border-color: var(--border-color);
    transform: translate(4px, 4px);
    box-shadow: none;
}
.dt-paging .dt-paging-button.current,
.dt-paging .dt-paging-button.current:hover {
    margin: 0.5rem !important;
    background: var(--accent-color) !important;
    color: var(--text-color);
    border-color: var(--border-color);
    box-shadow: none;
    transform: translate(4px, 4px);
    z-index: 3;
}
.dt-paging .dt-paging-button.disabled,
.dt-paging .dt-paging-button.disabled:hover {
    color: var(--subtle-text-color);
    background: var(--subtle-bg-color) !important;
    border-color: var(--border-color);
    box-shadow: none;
    transform: none;
    cursor: default;
}

/* Apply the base brutalist table styles */
.table-wrapper table {
    width: 100%;
    border-collapse: collapse;
}
.table-wrapper table th,
.table-wrapper table td {
    border: 1px solid var(--border-color);
    padding: 0.5rem;
    text-align: left;
}
.table-wrapper table thead th {
    background-color: var(--accent-color);
    color: var(--text-color);
    font-weight: 700;
}

/*
  DARK MODE OVERRIDE: This is the critical part.
  It forces the correct background and text color on headers and the first
  column in dark mode, overriding any inline styles from Pandas.
*/
html.dark-mode .table-wrapper table th,
html.dark-mode .table-wrapper table td {
}

html.dark-mode #peers_link,
html.dark-mode td.data.col5 {
    color: #1a1a1a !important;
}

/* Re-apply the correct header background for dark mode */
html.dark-mode .table-wrapper table thead th {
    background-color: var(--accent-color) !important;
}

/* Control font size inside Pandas HTML tables */
td.data.col0, td.data.col1, td.data.col2, td.data.col3, td.data.col4, td.data.col5 {
    font-size: 1.0rem !important;
    font-family: 'Space Mono', monospace !important;
}

th.col_heading.level0 {
    font-size: 1.0rem !important;
    font-family: 'Space Mono', monospace !important;
}

html.dark-mode td.data.col0,
html.dark-mode td.data.col1,
html.dark-mode td.data.col2,
html.dark-mode td.data.col3,
html.dark-mode td.data.col4,
html.dark-mode td.data.col5 {
    font-size: 1.0rem !important;
    font-family: 'Space Mono', monospace !important;
}

html.dark-mode th.col_heading.level0 {
    font-size: 1.0rem !important;
    font-family: 'Space Mono', monospace !important;
}

/* Ensure striped rows look correct on these tables too */
/* html.dark-mode .table-wrapper table tr:nth-child(even) { */
/*     background-color: var(--subtle-bg-color) !important; */
/* } */

/* --- TABS (AlpineJS) - Improved for Responsiveness --- */
.tabsX .tab-container {
    display: flex;
    flex-wrap: wrap; /* THIS IS THE KEY: Allows buttons to wrap to the next line */
    justify-content: center; /* Optional: Centers the buttons for a cleaner look */
    gap: 0.5rem; /* Adds consistent spacing between all buttons */
    border-bottom: 3px solid var(--border-color);
    margin-bottom: 1.5rem;
    padding-bottom: 1rem; /* Adds space below the buttons before the border */
}

.tabsX .tab-button {
    padding: 0.8rem 1.5rem;
    font-weight: 700;
    cursor: pointer;
    border: 3px solid transparent;
    background-color: var(--subtle-bg-color);
    color: var(--text-color);
    
    /* Make buttons grow on smaller screens for a better mobile feel */
    flex-grow: 1;
    text-align: center;
}

/* On larger screens, buttons don't need to grow */
@media (min-width: 768px) {
    .tabsX .tab-button {
        flex-grow: 0;
    }
}

.tabsX .tab-button.active { 
    color: var(--text-color);
    background-color: var(--card-bg-color); 
    border-color: var(--border-color); 
    box-shadow: 4px 4px 0 var(--shadow-color);
    transform: translate(-2px, -2px);
}

/* --- NOTIFICATIONS & MESSAGES --- */
@keyframes pop-in {
    from { opacity: 0; transform: translateY(15px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-container .server-message {
    color: var(--loss-color) !important; font-weight: 700;
    text-align: center; margin-bottom: 1rem;
    animation: pop-in 0.4s ease-out forwards;
}
.flash-success {
    color: var(--flash-success); background-color: #DFF2BF;
    border: 3px solid var(--flash-success); padding: 1rem;
    margin-bottom: 1rem; font-weight: 700; text-align: center;
    animation: pop-in 0.4s ease-out forwards;
}
.save-success-message {
    position: fixed; top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background-color: var(--accent-color); color: var(--text-color);
    padding: 1.5rem 2.5rem; font-weight: 700;
    border: 3px solid var(--border-color); box-shadow: 8px 8px 0 var(--shadow-color);
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 1; transform: translate(-50%, -50%) scale(0.9);
}
.save-success-message.is-visible { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* --- OVERLAY MENU --- */
.menu-trigger {
    color: var(--text-color);
    position: fixed; top: 0.5rem; left: 0.5rem; width: 30px; height: 30px;
    background-color: var(--card-bg-color); border: 3px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color); z-index: 9998;
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: all 0.15s ease-in-out;
}
.menu-trigger:hover { transform: translate(4px, 4px); box-shadow: none; }
.menu-trigger .material-icons { font-size: 1.5rem; }

@media (min-width: 768px) {
    .menu-trigger {
        top: 1rem;
        left: 1rem;
        width: 50px;
        height: 50px;
    }
    .material-icons {
        font-size: 2.5rem;
    }
}

.overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(241, 241, 241, 0.95); z-index: 9999;
    display: flex; justify-content: center; align-items: center; overflow-y: auto;
}
html.dark-mode .overlay { background-color: rgba(26, 26, 26, 0.95); } /* Dark mode overlay background */

.overlay-content {
    /* Layout: A vertical flex container */
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Pushes footer to the bottom */

    /* Sizing */
    width: 90%;
    max-width: 1200px; /* Set a max-width for large screens */
    height: 95%;
    max-height: 1700px; /* Set a max-height */

    /* Theming */
    background: var(--card-bg-color);
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    
    /* Animation */
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    opacity: 0;
    transform: translateY(-30px);
}

.overlay-content.is-visible { opacity: 1; transform: translateY(0); }

.overlay-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 250px;
    margin-top: auto;
    margin-bottom: auto;
}

.overlay-main-content {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2rem;
    padding: 2rem; /* Add padding inside the scroll area */
    overflow-y: auto; /* CRITICAL: Only this area will scroll */
}

.overlay-footer {
    display: flex;
    justify-content: space-around;
    width: 100%;
    flex-shrink: 0; /* Prevents the footer from shrinking */
    
    /* Theming */
    background-color: var(--subtle-bg-color);
    border-top: 3px solid var(--border-color);
}

.overlay-footer .footer-nav-link {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 0.5rem;
    height: 65px;
    color: var(--text-color);
    text-decoration: none;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    transition: background-color 0.2s ease-in-out, color 0.2s ease-in-out;
}
.overlay-footer .footer-nav-link:hover {
    color: var(--navbar-link);
}
.overlay-footer .footer-nav-link.nav__link--active {
    color: var(--navbar-active);
    font-weight: 700;
}
.overlay-footer .footer-nav-icon {
    font-size: 1.6rem;
    margin-bottom: 4px;
}

.overlay-link {
    width: fit-content; margin: 0 0 0 12%;
    /* position: relative; left: 25%; right: 25%; */
    display: flex; align-items: center; justify-content: flex-start;
    gap: 0.8rem; font-size: 1.2rem; font-weight: 700;
    color: var(--text-color); text-decoration: none; padding: 0rem;
    transition: color 0.2s ease-in-out;
}
@media (min-width: 400px) { .overlay-link { margin: 0 0 0 20%; font-size: 1.2rem; } }
@media (min-width: 500px) { .overlay-link { margin: 0 0 0 25%; font-size: 1.5rem; } }
@media (min-width: 1000px) { .overlay-link { margin: 0 0 0 35%; font-size: 1.5rem; } }
/* .overlay-link { color: var(--text-color); } */
.overlay-link:hover { color: var(--navbar-link); }


.closebtn {
    position: absolute; top: 1rem; right: 2.5rem; font-size: 4rem;
    color: var(--text-color); background: none; border: none;
    cursor: pointer; line-height: 1; z-index: 2;
}

/* --- DARK MODE TOGGLE --- */
.dark-mode-trigger {
    position: fixed; bottom: 0.5rem; left: 0.5rem; width: 30px; height: 30px;
    background-color: var(--card-bg-color); border: 3px solid var(--border-color);
    box-shadow: 4px 4px 0 var(--shadow-color); z-index: 9998;
    cursor: pointer; display: flex; justify-content: center; align-items: center;
    transition: all 0.15s ease-in-out; padding: 0;
}
@media (min-width: 768px) {
    .dark-mode-trigger {
        bottom: 1rem;
        left: 1rem;
        width: 50px;
        height: 50px;
    }
    .material-icons {
        font-size: 2.5rem;
    }
}

.dark-mode-trigger:hover { transform: translate(4px, 4px); box-shadow: none; }
.dark-mode-trigger .material-icons { font-size: 1.5rem; color: var(--text-color); }
}

/* --- Header & Form Specifics --- */
.summary-header {
    text-align: center;
}

.summary-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
    margin: 1.5rem auto 0;
}
.summary-form2 {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 500px;
    margin: 1.5rem auto 0;
}

.form-input {
    display: flex;
    align-items: center;
    border: 3px solid var(--border-color);
    padding: 0.5rem;
}

.form-input:focus-within {
    border-color: var(--accent-color);
    box-shadow: 4px 4px 0 var(--accent-color);
}

.form-input i {
    margin-right: 0.5rem;
}

.form-input input {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 1rem;
    font-family: 'Space Mono', monospace;
    color: var(--text-color);
}

@media (min-width: 768px) {
    .summary-form {
        flex-direction: row;
    }
    .summary-form2 {
        flex-direction: column;
    }
    .form-input {
        flex-grow: 1;
    }
    .btn {
        width: auto;
        padding: 1rem 1.5rem;
    }
}


/* --- Company Profile Section --- */
.company-profile {
    display: flex;
    align-items: center; /* Vertically align logo and text */
    gap: 1.5rem;         /* Creates space between the logo and the text */
    margin-bottom: 1rem; /* Adds some space below the profile section */
}

#img-logo {
    /* Set max dimensions to constrain the image */
    max-width: 100px;
    max-height: 100px;

    /* Ensure the image scales properly without distortion */
    object-fit: contain;
    width: fit-content;
    height: fit-content;

    /* Optional: Add styling consistent with the brutalist theme */
    border: 2px solid var(--border-color);
    background-color: #fff; /* Ensures transparent logos have a background */
    flex-shrink: 0; /* Prevents the image from shrinking if the text is long */
}

.company-profile h4 {
    margin: 0 0 0.5rem 0; /* Adjust spacing for the company name */
}

.company-profile a {
    font-weight: normal; /* Optional: makes the website link less prominent */
}

.company-about {
    line-height: 1.6; /* Improve readability of the description */
}


/* --- Action Buttons --- */
.action-buttons {
    display: flex;
    flex-wrap: wrap; /* Allows buttons to wrap on smaller screens */
    gap: 1rem;
}

.action-buttons .btn {
    flex-grow: 1; /* Allows buttons to grow and fill the space */
    width: auto; /* Overrides the default 100% width */
}


/* --- Chart & Widget Containers --- */
/* .tradingview-widget-container, */
/* #chart, */
/* #PlotlyJS_TS, */
/* #PlotlyJS_SF, */
/* #HC_heatmap, */
/* #timeseriesVZ { */
/*     min-height: 350px; /* Ensure chart containers have a minimum height */ */
/* } */

/* --- Utility --- */
.text-right {
    text-align: right;
}

/* --- Separator (e.g., "OR" in forms) --- */
.separator {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-color);
    margin: 1.5rem 0; /* Spacing above and below the separator */
    font-weight: 700;
    font-family: 'Space Mono', monospace;
}

/* Creates the horizontal lines on either side of the text */
.separator::before,
.separator::after {
    content: '';
    flex: 1;
    border-bottom: 2px solid var(--border-color);
}

/* Adds spacing between the lines and the text */
.separator:not(:empty)::before {
    margin-right: .5em;
}

.separator:not(:empty)::after {
    margin-left: .5em;
}

html.dark-mode .dataTables_length label,
html.dark-mode .dataTables_filter label,
html.dark-mode .dataTables_info {
    color: var(--text-color) !important;
}

html.dark-mode .dataTables_filter input,
html.dark-mode .dataTables_length select {
    background-color: var(--card-bg-color) !important;
    color: var(--text-color) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 0; /* Optional: for a sharper look */
    padding: 0.3rem 0.5rem;
}

/* Styles the pagination buttons (e.g., "Previous", "1", "2", "Next") */
html.dark-mode .dataTables_paginate .paginate_button {
    color: var(--text-color) !important; /* Use !important to override default styles */
    border: 1px solid var(--border-color);
    margin: 0 2px;
}

/* Hover state for pagination buttons */
html.dark-mode .dataTables_paginate .paginate_button:hover {
    background: var(--accent-color);
    color: var(--text-color) !important;
    border-color: var(--accent-color);
}

/* The currently active page button */
html.dark-mode .dataTables_paginate .paginate_button.current,
html.dark-mode .dataTables_paginate .paginate_button.current:hover {
    background: var(--accent-color);
    color: var(--text-color) !important;
    border: 2px solid var(--border-color);
    box-shadow: 3px 3px 0 var(--shadow-color);
    transform: translate(-2px, -2px);
}

/* Disabled pagination buttons (e.g., "Previous" on the first page) */
html.dark-mode .dataTables_paginate .paginate_button.disabled,
html.dark-mode .dataTables_paginate .paginate_button.disabled:hover {
    color: #888 !important; /* A muted color for the disabled state */
    background: var(--subtle-bg-color);
    border-color: var(--subtle-bg-color);
    box-shadow: none;
    transform: none;
}

/* --- Iframe Container --- */
.iframe-container {
    position: relative;
    width: 100%;
    border: 3px solid var(--border-color);
    margin: 1rem 0; /* Adds space above and below the iframe */
}

.iframe-container iframe {
    display: block;
    width: 100%;
    min-height: 100px; /* CHANGED to min-height */
    height: 0; /* Start with zero height, will be expanded by JS */
    border: none;
    transition: height 0.3s ease-in-out; /* Optional: Adds a smooth resize animation */
}

#market_summary.js-plotly-plot {
    min-height: 950px;
}

@media (min-width: 768px) {
    #market_summary.js-plotly-plot {
        min-height: 750px;
    }
}

/* --- Brutalist Modal (Alpine.js) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9998; /* Below the main menu overlay */
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--card-bg-color);
    border: 3px solid var(--border-color);
    box-shadow: 8px 8px 0 var(--shadow-color);
    padding: 1.5rem;
    max-width: 90%;
    max-height: 90vh; /* Max height to keep it on screen */
    overflow-y: auto; /* Allow content to scroll if it's too tall */
    position: relative;
}

.modal-close-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--loss-color);
    color: var(--card-bg-color);
    border: 3px solid var(--border-color);
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    cursor: pointer;
    padding: 0.2rem 0.6rem;
}
.modal-close-button:hover {
    background: var(--border-color);
    color: var(--card-bg-color);
}

.modal-content img {
    max-width: 100%;
    height: auto;
    display: block;
}

select {
    width: 100%;
    padding: 0.8rem;
    border: none; /* Remove default border inside the .form-input */
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Space Mono', monospace;
    font-size: 1rem;
    outline: none;
    -webkit-appearance: none; /* Removes default OS styling */
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
}

/* --- Brutalist Accordion (Alpine.js) --- */
.accordion-item {
    border: 3px solid var(--border-color);
    margin-bottom: 1.5rem; /* Replaces the old <br> tags */
}

.accordion-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1rem 1.5rem;
    background-color: var(--subtle-bg-color);
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.accordion-trigger:hover {
    background-color: var(--accent-color);
}

.accordion-trigger h4 {
    margin: 0;
    font-size: 1.1rem;
}

.accordion-icon {
    font-size: 1.8rem;
    font-weight: 700;
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Rotate the icon when the 'active' class is present */
.accordion-trigger.active .accordion-icon {
    transform: rotate(45deg);
}

.accordion-content {
    padding: 1.5rem;
    /* This is necessary for the x-collapse transition to work smoothly */
    overflow: hidden;
    transition: height 0.3s ease-in-out;
}
.accordion-content p {
    margin: 0;
    line-height: 1.6;
}

#testVizzuCanvas {
	width: 360px;
	height: 400px;
}

@media screen and (min-width: 720px) {
    #testVizzuCanvas {
        margin-left: -5%;
        width: 550px;
        height: 400px;
    }
}

/* --- PANDAS HTML TABLE DARK MODE FIX --- */
.table-wrapper.pandas-table-container table tr:nth-of-type(odd) {
    color: #1a1a1a;
}

.highcharts-figure {
    margin-block-start: 0.1em;
    margin-block-end: 0.1em;
    margin-inline-start: 0.1em;
    margin-inline-end: 0.1em;
}
