/* ============================================================
   Flowbite Admin Dashboard style theme
   Works with Bootstrap 5.3's data-bs-theme="light|dark" switch
   ============================================================ */

:root,
[data-bs-theme="light"] {
    --fb-bg: #f9fafb;
    --fb-surface: #ffffff;
    --fb-surface-2: #f3f4f6;
    --fb-border: #e5e7eb;
    --fb-text: #111827;
    --fb-text-muted: #6b7280;
    --fb-primary: #1a56db;
    --fb-primary-soft: #e1effe;
    --fb-success: #057a55;
    --fb-success-soft: #def7ec;
    --fb-danger: #e02424;
    --fb-danger-soft: #fde8e8;
    --fb-warning: #c27803;
    --fb-warning-soft: #fdf6b2;
    --fb-info: #0e7490;
    --fb-info-soft: #cffafe;
    --fb-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

[data-bs-theme="dark"] {
    --fb-bg: #111827;
    --fb-surface: #1f2937;
    --fb-surface-2: #374151;
    --fb-border: #374151;
    --fb-text: #f9fafb;
    --fb-text-muted: #9ca3af;
    --fb-primary: #3f83f8;
    --fb-primary-soft: #233876;
    --fb-success: #31c48d;
    --fb-success-soft: #0b3d2e;
    --fb-danger: #f98080;
    --fb-danger-soft: #4c1d1d;
    --fb-warning: #e3a008;
    --fb-warning-soft: #3f2e04;
    --fb-info: #67e8f9;
    --fb-info-soft: #033a45;
    --fb-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

body {
    background-color: var(--fb-bg);
    color: var(--fb-text);
    transition: background-color .15s ease, color .15s ease;
}

/* ---------- Cards ---------- */
.fb-card {
    background-color: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: 0.75rem;
    box-shadow: var(--fb-shadow);
    transition: background-color .15s ease, border-color .15s ease;
}

    .fb-card .card-header {
        background-color: transparent;
        border-bottom: 1px solid var(--fb-border);
        font-weight: 600;
        color: var(--fb-text);
    }

    .fb-card table {
        color: var(--fb-text);
        margin-bottom: 0;
    }

    .fb-card thead th {
        color: var(--fb-text-muted);
        font-size: .75rem;
        text-transform: uppercase;
        border-bottom: 1px solid var(--fb-border);
        font-weight: 600;
    }

    .fb-card tbody td {
        border-bottom: 1px solid var(--fb-border);
        vertical-align: middle;
    }

    .fb-card tbody tr:last-child td {
        border-bottom: none;
    }

.text-muted-fb {
    color: var(--fb-text-muted) !important;
}

/* ---------- Stat card icon badge ---------- */
.fb-icon-badge {
    width: 48px;
    height: 48px;
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

    .fb-icon-badge.primary {
        background: var(--fb-primary-soft);
        color: var(--fb-primary);
    }

    .fb-icon-badge.success {
        background: var(--fb-success-soft);
        color: var(--fb-success);
    }

    .fb-icon-badge.danger {
        background: var(--fb-danger-soft);
        color: var(--fb-danger);
    }

    .fb-icon-badge.warning {
        background: var(--fb-warning-soft);
        color: var(--fb-warning);
    }

    .fb-icon-badge.info {
        background: var(--fb-info-soft);
        color: var(--fb-info);
    }

.fb-stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--fb-text);
}

.fb-stat-label {
    font-size: .8rem;
    color: var(--fb-text-muted);
    font-weight: 500;
}

.fb-trend-up {
    color: var(--fb-success);
    font-weight: 600;
    font-size: .8rem;
}

.fb-trend-down {
    color: var(--fb-danger);
    font-weight: 600;
    font-size: .8rem;
}

/* ---------- Badges (status pills) ---------- */
.fb-badge {
    display: inline-block;
    padding: .25rem .6rem;
    border-radius: 9999px;
    font-size: .72rem;
    font-weight: 600;
}

    .fb-badge.primary {
        background: var(--fb-primary-soft);
        color: var(--fb-primary);
    }

    .fb-badge.success {
        background: var(--fb-success-soft);
        color: var(--fb-success);
    }

    .fb-badge.danger {
        background: var(--fb-danger-soft);
        color: var(--fb-danger);
    }

    .fb-badge.warning {
        background: var(--fb-warning-soft);
        color: var(--fb-warning);
    }

    .fb-badge.secondary {
        background: var(--fb-surface-2);
        color: var(--fb-text-muted);
    }

/* ---------- Links / buttons ---------- */
.fb-link {
    color: var(--fb-primary);
    font-weight: 500;
    font-size: .85rem;
    text-decoration: none;
}

    .fb-link:hover {
        text-decoration: underline;
    }

.fb-btn-outline {
    border: 1px solid var(--fb-border);
    color: var(--fb-text);
    background: transparent;
    border-radius: 0.5rem;
    font-size: .85rem;
    padding: .35rem .75rem;
}

    .fb-btn-outline:hover {
        background: var(--fb-surface-2);
    }

/* ---------- Page header + FY badge ---------- */
.fb-page-title {
    color: var(--fb-text);
    font-weight: 700;
}

.fb-fy-badge {
    background: var(--fb-primary-soft);
    color: var(--fb-primary);
    border-radius: 9999px;
    padding: .4rem .9rem;
    font-weight: 600;
    font-size: .85rem;
}

/* ============================================================
   Sidebar (Flowbite-style)
   ============================================================ */
.fb-sidebar {
    width: 250px;
    min-height: 100vh;
    background-color: var(--fb-surface);
    border-right: 1px solid var(--fb-border);
    display: flex;
    flex-direction: column;
    transition: background-color .15s ease, border-color .15s ease;
}

.fb-sidebar-brand {
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--fb-border);
    display: flex;
    align-items: center;
    gap: .6rem;
}

    .fb-sidebar-brand .fb-brand-icon {
        width: 34px;
        height: 34px;
        border-radius: 0.5rem;
        background: var(--fb-primary-soft);
        color: var(--fb-primary);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.05rem;
    }

    .fb-sidebar-brand h5 {
        margin: 0;
        font-weight: 700;
        color: var(--fb-text);
        font-size: 1rem;
    }

.fb-sidebar-nav {
    padding: .75rem .6rem;
    flex-grow: 1;
    overflow-y: auto;
}

.fb-sidebar-section {
    color: var(--fb-text-muted);
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 0 .6rem;
    margin-top: 1.1rem;
    margin-bottom: .35rem;
}

.fb-sidebar-nav .fb-nav-link {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .5rem .6rem;
    border-radius: 0.5rem;
    color: var(--fb-text-muted);
    font-size: .875rem;
    font-weight: 500;
    text-decoration: none;
    margin-bottom: 2px;
}

    .fb-sidebar-nav .fb-nav-link i {
        font-size: 1rem;
        width: 18px;
        text-align: center;
        flex-shrink: 0;
    }

    .fb-sidebar-nav .fb-nav-link:hover {
        background-color: var(--fb-surface-2);
        color: var(--fb-text);
    }

    .fb-sidebar-nav .fb-nav-link.active {
        background-color: var(--fb-primary-soft);
        color: var(--fb-primary);
        font-weight: 600;
    }

/* thin scrollbar for the sidebar */
.fb-sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.fb-sidebar-nav::-webkit-scrollbar-thumb {
    background-color: var(--fb-border);
    border-radius: 3px;
}

/* ---------- Theme toggle switch ---------- */
.fb-theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    background: var(--fb-surface);
    border: 1px solid var(--fb-border);
    border-radius: 9999px;
    padding: .35rem .9rem;
    cursor: pointer;
    color: var(--fb-text);
    font-size: .85rem;
    font-weight: 500;
    user-select: none;
}

    .fb-theme-toggle:hover {
        background: var(--fb-surface-2);
    }
