/* ===== Quantylab — Compass Theme ===== */

/* --- DataTables Layout Alignment --- */
div.dt-container .dt-layout-cell {
    display: flex !important;
    align-items: center !important;
}
div.dt-container .dt-buttons {
    display: flex !important;
    align-items: center !important;
}

/* --- DataTables CSV Button --- */
.dt-btn-csv {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 30px !important;
    padding: 0 8px !important;
    margin: 0 !important;
    font-size: 14px !important;
    border: 1px solid #d4d4d8 !important;
    border-radius: 5px !important;
    background: #fafafa !important;
    color: #3f3f46 !important;
    cursor: pointer;
    transition: background 0.15s;
    box-sizing: border-box !important;
}
.dt-btn-csv:hover { background: #e4e4e7 !important; }
html.dark .dt-btn-csv {
    border-color: #3f3f46 !important;
    background: #27272a !important;
    color: #d4d4d8 !important;
}
html.dark .dt-btn-csv:hover { background: #3f3f46 !important; }

/* --- DataTables Controls --- */
div.dt-container .dt-search input,
div.dt-container select {
    height: 30px !important;
    padding: 0 10px !important;
    font-size: 14px !important;
    line-height: 28px !important;
    border: 1px solid #d4d4d8 !important;
    border-radius: 5px !important;
    box-sizing: border-box !important;
}
html.dark div.dt-container select,
html.dark div.dt-container .dt-search input {
    border-color: #3f3f46 !important;
    background: #27272a !important;
    color: #d4d4d8 !important;
}
div.dt-container .dt-paging button.dt-paging-button {
    padding: 0 6px !important;
    font-size: 14px !important;
    min-width: 30px;
    min-height: 30px;
    border-radius: 5px !important;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }
html.dark ::-webkit-scrollbar-thumb { background: #3f3f46; }
html.dark ::-webkit-scrollbar-thumb:hover { background: #52525b; }

.sidebar-panel::-webkit-scrollbar { width: 4px; }
.sidebar-panel::-webkit-scrollbar-thumb { background: #d4d4d8; border-radius: 999px; }
.sidebar-panel::-webkit-scrollbar-thumb:hover { background: #a1a1aa; }
html.dark .sidebar-panel::-webkit-scrollbar-thumb { background: #3f3f46; }
html.dark .sidebar-panel::-webkit-scrollbar-thumb:hover { background: #52525b; }

/* --- Sidebar --- */
@media (max-width: 1023px) {
    .sidebar-panel {
        transform: translateX(-100%);
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .sidebar-panel.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgb(0 0 0 / 0.3);
    }
}

/* --- Active nav link --- */
.nav-link.active {
    background: rgba(0,0,0,0.06);
    color: #18181b;
}
html.dark .nav-link.active {
    background: rgba(255,255,255,0.08);
    color: #f4f4f5;
}

/* --- Plotly chart responsiveness --- */
.chart-container .js-plotly-plot,
.chart-container .plotly {
    width: 100% !important;
}
.chart-container .js-plotly-plot .plot-container {
    width: 100% !important;
}
.chart-container .js-plotly-plot .svg-container {
    width: 100% !important;
}
.chart-container .modebar { opacity: 0; transition: opacity 0.2s; }
.chart-container:hover .modebar { opacity: 1; }

/* --- Tailwind-style tables (dashboard) --- */
.tw-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}
.tw-table th,
.tw-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    white-space: nowrap;
}
.tw-table th {
    font-weight: 600;
    color: #71717a;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid #e4e4e7;
}
html.dark .tw-table th {
    color: #a1a1aa;
    border-bottom-color: #3f3f46;
}
.tw-table td {
    border-bottom: 1px solid #f4f4f5;
    color: #3f3f46;
}
html.dark .tw-table td {
    border-bottom-color: #27272a;
    color: #d4d4d8;
}
.tw-table tbody tr:last-child td {
    border-bottom: none;
}
.tw-table tbody tr:hover {
    background: #fafafa;
}
html.dark .tw-table tbody tr:hover {
    background: #27272a;
}
.tw-table a {
    color: #3f3f46;
    text-decoration: none;
    transition: color 0.15s;
}
.tw-table a:hover {
    color: #03A94D;
}
html.dark .tw-table a {
    color: #d4d4d8;
}
html.dark .tw-table a:hover {
    color: #03A94D;
}

/* --- DataTables tables --- */
.table-container { -webkit-overflow-scrolling: touch; }

.table-container table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    font-variant-numeric: tabular-nums;
}

.table-container table th,
.table-container table td {
    padding: 0.625rem 1rem;
    text-align: left;
    white-space: nowrap;
}

.table-container table th {
    font-weight: 600;
    color: #52525b;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fafafa;
    border-bottom: 2px solid #e4e4e7;
    position: sticky;
    top: 0;
    z-index: 1;
}
html.dark .table-container table th {
    color: #a1a1aa;
    background: #18181b;
    border-bottom-color: #3f3f46;
}

.table-container table td {
    border-bottom: 1px solid #f4f4f5;
    color: #3f3f46;
}
html.dark .table-container table td {
    border-bottom-color: #27272a;
    color: #d4d4d8;
}

.table-container table tbody tr {
    transition: background-color 0.1s ease;
}
.table-container table tbody tr:hover {
    background: #fafafa;
}
html.dark .table-container table tbody tr:hover {
    background: #27272a;
}
.table-container table tbody tr:last-child td {
    border-bottom: none;
}

/* Zebra striping */
.table-container table tbody tr:nth-child(even) {
    background: #fafafa;
}
.table-container table tbody tr:nth-child(even):hover {
    background: #f4f4f5;
}
html.dark .table-container table tbody tr:nth-child(even) {
    background: #1a1a1e;
}
html.dark .table-container table tbody tr:nth-child(even):hover {
    background: #27272a;
}

/* --- Cards --- */
.card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 0 0 1px rgb(9 9 11 / 0.05);
    overflow: hidden;
    transition: box-shadow 0.2s ease;
}
.card:hover {
    box-shadow: 0 0 0 1px rgb(9 9 11 / 0.07), 0 4px 8px -2px rgb(9 9 11 / 0.04);
}
html.dark .card {
    background: #18181b;
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.06);
}
html.dark .card:hover {
    box-shadow: 0 0 0 1px rgb(255 255 255 / 0.1), 0 4px 8px -2px rgb(0 0 0 / 0.3);
}

/* --- Form focus --- */
input:focus, select:focus, textarea:focus {
    box-shadow: 0 0 0 3px rgb(3 169 77 / 0.1);
}
html.dark input:focus, html.dark select:focus, html.dark textarea:focus {
    box-shadow: 0 0 0 3px rgb(3 169 77 / 0.2);
}

/* --- Pill/chip --- */
.pill {
    transition: all 0.15s ease;
}
.pill:active {
    transform: scale(0.97);
}

/* --- Link resets --- */
.no-underline { text-decoration: none !important; }
.no-underline:hover { text-decoration: none !important; }

/* --- Ad container --- */
.ad-container { margin: 1rem 0; }

/* --- DataTables --- */
div.dt-container {
    font-size: 0.6875rem !important;
    color: #a1a1aa !important;
}
div.dt-container div.dt-layout-row {
    margin: 0.3rem 0 !important;
}
div.dt-container div.dt-layout-row:first-child {
    margin-top: 0 !important;
    margin-bottom: 0.3rem !important;
}
div.dt-container .dt-search input,
div.dt-container .dt-input {
    padding: 2px 6px !important;
    border: 1px solid #e4e4e7 !important;
    border-radius: 3px !important;
    font-size: 0.9375rem !important;
    height: 30px !important;
    line-height: 1 !important;
    color: #a1a1aa !important;
    background: white !important;
}
html.dark div.dt-container .dt-search input,
html.dark div.dt-container .dt-input {
    border-color: #3f3f46 !important;
    background: #18181b !important;
    color: #a1a1aa !important;
}
div.dt-container select.dt-input {
    padding: 2px 18px 2px 6px !important;
    height: 30px !important;
    font-size: 0.9375rem !important;
}
div.dt-container .dt-search input:focus {
    border-color: #a1a1aa !important;
    outline: none;
    box-shadow: 0 0 0 1px rgb(161 161 170 / 0.1);
}
html.dark div.dt-container .dt-search input:focus {
    border-color: #71717a !important;
    box-shadow: 0 0 0 1px rgb(161 161 170 / 0.15);
}
div.dt-container .dt-length,
div.dt-container .dt-search,
div.dt-container .dt-info,
div.dt-container .dt-paging {
    font-size: 0.9375rem !important;
    color: #a1a1aa !important;
}
div.dt-container .dt-info {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
div.dt-container .dt-paging .dt-paging-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 1.875rem !important;
    height: 1.875rem !important;
    padding: 0 6px !important;
    margin-left: 2px !important;
    border: 1px solid transparent !important;
    border-radius: 5px !important;
    background: transparent !important;
    color: #a1a1aa !important;
    font-size: 0.9375rem !important;
    font-weight: 500;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
div.dt-container .dt-paging .dt-paging-button:hover {
    background: #f4f4f5 !important;
    border-color: #e4e4e7 !important;
    color: #18181b !important;
}
html.dark div.dt-container .dt-paging .dt-paging-button:hover {
    background: #27272a !important;
    border-color: #3f3f46 !important;
    color: #f4f4f5 !important;
}
div.dt-container .dt-paging .dt-paging-button.current,
div.dt-container .dt-paging .dt-paging-button.current:hover {
    background: #18181b !important;
    border-color: #18181b !important;
    color: #fff !important;
    font-weight: 600;
}
html.dark div.dt-container .dt-paging .dt-paging-button.current,
html.dark div.dt-container .dt-paging .dt-paging-button.current:hover {
    background: #f4f4f5 !important;
    border-color: #f4f4f5 !important;
    color: #18181b !important;
}
div.dt-container .dt-paging .dt-paging-button.disabled,
div.dt-container .dt-paging .dt-paging-button.disabled:hover,
div.dt-container .dt-paging .dt-paging-button.disabled:active {
    opacity: 0.3;
    cursor: default;
    background: transparent !important;
    border: 1px solid transparent !important;
    box-shadow: none !important;
    color: #a1a1aa !important;
}
div.dt-container .dt-paging .ellipsis {
    padding: 0 0.25em !important;
}
div.dt-container table.dataTable thead th {
    cursor: pointer;
    position: relative;
}

/* --- Material Symbols --- */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 20;
}

/* --- Dark mode: DataTables library overrides --- */
html.dark table.dataTable thead th,
html.dark table.dataTable thead td {
    border-bottom-color: #3f3f46 !important;
}
html.dark table.dataTable tbody tr {
    background-color: transparent !important;
}
html.dark table.dataTable.stripe tbody tr.odd,
html.dark table.dataTable.display tbody tr.odd {
    background-color: #1a1a1e !important;
}
html.dark table.dataTable tbody tr:hover,
html.dark table.dataTable.hover tbody tr:hover,
html.dark table.dataTable.display tbody tr:hover {
    background-color: #27272a !important;
}
html.dark table.dataTable.order-column tbody tr > .sorting_1,
html.dark table.dataTable.display tbody tr > .sorting_1 {
    background-color: transparent !important;
}
html.dark div.dt-container select.dt-input {
    border-color: #3f3f46 !important;
    background-color: #18181b !important;
    color: #a1a1aa !important;
}

/* --- Dark mode: Plotly chart background --- */
html.dark .chart-container .js-plotly-plot .plot-container,
html.dark .chart-container .js-plotly-plot .main-svg {
    background: transparent !important;
}
html.dark .chart-container .js-plotly-plot .bg {
    fill: #18181b !important;
}
html.dark .chart-container .js-plotly-plot .gridlayer line {
    stroke: #27272a !important;
}
html.dark .chart-container .js-plotly-plot .zerolinelayer line {
    stroke: #3f3f46 !important;
}
html.dark .chart-container .js-plotly-plot text {
    fill: #a1a1aa !important;
}
html.dark .chart-container .js-plotly-plot .legendtext {
    fill: #a1a1aa !important;
}

/* --- Dark mode: Global element overrides --- */
/* Inputs, selects, textareas */
html.dark input[type="text"],
html.dark input[type="number"],
html.dark input[type="date"],
html.dark input[type="email"],
html.dark input[type="password"],
html.dark input[type="search"],
html.dark select,
html.dark textarea {
    background-color: #18181b;
    color: #d4d4d8;
    border-color: #3f3f46;
}
html.dark input::placeholder,
html.dark textarea::placeholder {
    color: #52525b;
}
/* Ring-based inputs (Tailwind ring-zinc-200) */
html.dark [class*="ring-zinc-200"] {
    --tw-ring-color: #3f3f46;
}
html.dark [class*="ring-zinc-950"] {
    --tw-ring-color: rgb(63 63 70 / 0.3);
}
/* Common text color overrides for content area */
html.dark .text-zinc-900 { color: #f4f4f5; }
html.dark .text-zinc-800 { color: #e4e4e7; }
html.dark .text-zinc-700 { color: #d4d4d8; }
html.dark .text-zinc-600 { color: #a1a1aa; }
/* Background overrides */
html.dark .bg-white { background-color: #18181b; }
html.dark .bg-zinc-50 { background-color: #18181b; }
html.dark .bg-zinc-100 { background-color: #27272a; }
/* Borders */
html.dark .border-zinc-100 { border-color: #27272a; }
html.dark .border-zinc-200 { border-color: #3f3f46; }
/* Pill unselected state */
html.dark .pill.bg-zinc-100 {
    background-color: #27272a;
    color: #d4d4d8;
}
html.dark .pill.bg-zinc-100:hover {
    background-color: #3f3f46;
}
/* Hover states */
html.dark .hover\:bg-zinc-50:hover { background-color: #27272a; }
html.dark .hover\:bg-zinc-200:hover { background-color: #3f3f46; }
