/* MMF Dashboard Custom Styles */

/* ─── BASE ─── */

body {
    font-family: 'Inter', sans-serif;
    background-color: #f0f2f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ─── NAVBAR (always dark) ─── */

.navbar-custom {
    background-color: #1e1e2e !important;
    padding: 0.7rem 1rem;
}

.navbar-brand {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.navbar-btn-theme {
    color: rgba(255, 255, 255, 0.6);
    padding: 0.3rem 0.5rem;
    border: none;
    transition: color 0.2s;
    line-height: 1;
}

.navbar-btn-theme:hover {
    color: #fff;
}

/* ─── CARDS ─── */

.card {
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 0.75rem;
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 0.75rem 0.75rem 0 0;
    padding: 0.875rem 1rem;
}

.card-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

/* ─── FOOTER ─── */

footer {
    border-top: 1px solid rgba(0, 0, 0, 0.07);
}

/* ─── CHARTS ─── */

#fundCountsChart,
#netAssetsChart {
    min-height: 300px;
}

/* Fund detail charts */
.card-body canvas#netAssetsChart,
.card-body canvas#portfolioCompositionChart {
    min-height: 350px;
}

/* ─── TABLES ─── */

#fundsTable,
#holdingsTable {
    font-size: 0.875rem;
}

#fundsTable thead th,
#holdingsTable thead th {
    background-color: #f8fafc;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

/* Filter rows */
#fundsTable thead .filter-row th,
#holdingsTable thead .filter-row th {
    padding: 6px;
    background-color: #fff;
    border-top: 1px solid #e2e8f0;
}

.filter-row input.filter-input,
.filter-row .form-control {
    font-size: 0.75rem;
    height: 28px;
    padding: 4px 8px;
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background-color: #fff;
    color: #374151;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.filter-row input.filter-input:focus,
.filter-row .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
    outline: none;
}

.filter-row input.filter-input.numeric,
.filter-row .form-control.numeric {
    font-variant-numeric: tabular-nums;
}

.filter-row input.filter-input::placeholder,
.filter-row .form-control::placeholder {
    font-size: 0.7rem;
    color: #94a3b8;
}

/* Clickable rows */
#fundsTable tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#fundsTable tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.07) !important;
}

/* Net assets column */
.net-assets {
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* ─── BADGES ─── */

.badge {
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.35em 0.6em;
    border-radius: 0.3rem;
    letter-spacing: 0.02em;
}

.badge + .badge {
    margin-left: 0.25rem;
}

/* Category badges */
.badge-government {
    background-color: rgb(54, 162, 235);
    color: #fff;
}

.badge-prime {
    background-color: rgb(34, 139, 34);
    color: #fff;
}

.badge-tax-exempt {
    background-color: rgb(153, 102, 255);
    color: #fff;
}

/* Fund type badges */
.badge-feeder {
    background-color: #ffc107;
    color: #212529;
}

.badge-master {
    background-color: #17a2b8;
    color: #fff;
}

.badge-internal {
    background-color: #6f42c1;
    color: #fff;
}

.badge-treasury {
    background-color: #20c997;
    color: #fff;
}

.badge-retail {
    background-color: #fd7e14;
    color: #fff;
}

.badge-institutional {
    background-color: #343a40;
    color: #fff;
}

.badge-no-feeder {
    background-color: #6c757d;
    color: #fff;
}

/* ─── DATATABLES OVERRIDES ─── */

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.3rem 0.65rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
}

.dataTables_wrapper .dataTables_length select {
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    padding: 0.3rem 2rem 0.3rem 0.65rem;
    background-color: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path fill='%236b7280' d='M6 9L1 4h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.5rem center;
    background-size: 10px;
}

.dataTables_wrapper .dataTables_length select:focus {
    border-color: #6366f1;
    outline: 0;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_info {
    font-size: 0.8rem;
    color: #64748b;
}

/* ─── BUTTONS ─── */

#clearFiltersBtn {
    font-size: 0.8rem;
    padding: 0.3rem 0.65rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

#clearFiltersBtn:hover {
    background-color: #f1f5f9;
}

/* ─── FUND DETAIL ─── */

.card.sticky-top {
    position: -webkit-sticky;
    position: sticky;
    top: 20px;
}

.fund-summary dl dt {
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fund-summary dl dd {
    font-size: 0.875rem;
    word-break: break-word;
    font-weight: 500;
}

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 0;
    font-size: 0.825rem;
}

#fundName {
    margin-bottom: 0.25rem;
    font-weight: 600;
}

/* ─── RESPONSIVE ─── */

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }

    #fundsTable,
    #holdingsTable {
        font-size: 0.75rem;
    }
}

@media (max-width: 992px) {
    .card.sticky-top {
        position: relative;
        top: 0;
    }
}

/* ─────────────────────────────────
   DARK MODE OVERRIDES
   Bootstrap 5.3 handles most things
   via data-bs-theme="dark". These
   override the custom styles above.
   ───────────────────────────────── */

[data-bs-theme="dark"] body {
    background-color: #0f1117;
}

[data-bs-theme="dark"] .card {
    background-color: #1a1d23;
    border-color: #2d3142;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .card-header {
    background-color: #1e2128;
    border-bottom-color: #2d3142;
}

[data-bs-theme="dark"] .card-title {
    color: #f1f5f9;
}

[data-bs-theme="dark"] footer {
    border-top-color: #2d3142;
}

/* Tables */
[data-bs-theme="dark"] #fundsTable thead th,
[data-bs-theme="dark"] #holdingsTable thead th {
    background-color: #1e2128;
    color: #8b949e;
}

[data-bs-theme="dark"] #fundsTable thead .filter-row th,
[data-bs-theme="dark"] #holdingsTable thead .filter-row th {
    background-color: #1a1d23;
    border-top-color: #2d3142;
}

[data-bs-theme="dark"] .filter-row input.filter-input,
[data-bs-theme="dark"] .filter-row .form-control {
    background-color: #141720;
    border-color: #3a3f4b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .filter-row input.filter-input::placeholder,
[data-bs-theme="dark"] .filter-row .form-control::placeholder {
    color: #6b7280;
}

[data-bs-theme="dark"] .filter-row input.filter-input:focus,
[data-bs-theme="dark"] .filter-row .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

[data-bs-theme="dark"] #fundsTable tbody tr:hover {
    background-color: rgba(99, 102, 241, 0.1) !important;
}

/* DataTables controls */
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_filter input {
    background-color: #141720;
    border-color: #3a3f4b;
    color: #e2e8f0;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length select {
    background-color: #141720;
    border-color: #3a3f4b;
    color: #e2e8f0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path fill='%238b949e' d='M6 9L1 4h10z'/></svg>");
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_length,
[data-bs-theme="dark"] .dataTables_wrapper .dataTables_info {
    color: #8b949e;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button {
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background-color: #1e2128 !important;
    color: #fff !important;
}

[data-bs-theme="dark"] .dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background-color: #6366f1 !important;
    border-color: #6366f1 !important;
    color: #fff !important;
}

/* Buttons */
[data-bs-theme="dark"] #clearFiltersBtn {
    border-color: #3a3f4b;
    color: #c9d1d9;
}

[data-bs-theme="dark"] #clearFiltersBtn:hover {
    background-color: #1e2128;
    color: #fff;
}

/* Fund detail sidebar */
[data-bs-theme="dark"] .fund-summary dl dt {
    color: #6b7280;
}

[data-bs-theme="dark"] .fund-summary dl dd {
    color: #e2e8f0;
}

/* Breadcrumb */
[data-bs-theme="dark"] .breadcrumb a {
    color: #7c8cff;
}

/* Selects (class/ownership dropdowns on fund detail) */
[data-bs-theme="dark"] select.form-select {
    background-color: #141720;
    border-color: #3a3f4b;
    color: #e2e8f0;
}

/* Feeder badge needs higher contrast in dark */
[data-bs-theme="dark"] .badge-feeder {
    background-color: #c49a00;
    color: #fff;
}
