/* Custom Variables */
:root {
    --brand-primary: #0c3c7c;
    --brand-secondary: #082a56;
    --brand-accent: #2e62a1;
    --bg-main: #ffffff;
    --card-bg: #ffffff;
    --text-main: #2b3674;
    --text-muted: #a3aed1;
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --shadow-soft: 0px 10px 20px rgba(12, 60, 124, 0.05);
    --shadow-hover: 0px 15px 25px rgba(12, 60, 124, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #ffffff !important;
    color: var(--text-main);
    overflow-x: hidden;
}

.bg-light {
    background-color: white !important;
}

#page-content-wrapper {
    background-color: transparent !important;
    min-height: 100vh;
}

.content-box {
    background-color: #F7F7F7 !important;
    border-radius: 16px;
}

/* Utilities */
.text-dark-blue {
    color: var(--brand-secondary) !important;
}

.bg-brand-dark {
    background-color: var(--brand-secondary) !important;
}

.bg-brand-gradient {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
}

.btn-brand {
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%);
    color: white;
    border: none;
}

.btn-brand:hover {
    background: linear-gradient(135deg, var(--brand-secondary) 0%, var(--brand-primary) 100%);
    color: white;
}

.letter-spacing-1 {
    letter-spacing: 1px;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

.hide-scrollbar {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}

.min-w-200px {
    min-width: 200px;
}

.min-w-250px {
    min-width: 250px;
}

/* Wrapper & Sidebar */
#wrapper {
    /* Removed overflow-x: hidden to allow position: sticky to work */
}

#sidebar-wrapper {
    height: calc(100vh - 24px);
    position: -webkit-sticky;
    position: sticky;
    top: 12px;
    align-self: flex-start;
    overflow-x: hidden;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
    width: 280px;
    background: #F7F7F7;
    border: 2px solid #58585814;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    transition: margin 0.25s ease-out;
    z-index: 1000;
    margin: 12px 0 12px 12px;
    border-radius: 16px;
}

#sidebar-wrapper .list-group::-webkit-scrollbar {
    width: 6px;
}

#sidebar-wrapper .list-group::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

#sidebar-wrapper .list-group {
    width: 280px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
}

.list-group-item {
    background: transparent !important;
    color: var(--brand-primary) !important;
    border: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
    margin: 4px 16px !important;
    width: 200px !important;
    max-width: 200px !important;
    border-radius: 12px !important;
    position: relative;
    padding-left: 20px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.list-group-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 4px;
    background-color: #fec632;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.list-group-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, rgba(254, 198, 50, 0.15) 0%, rgba(254, 198, 50, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.list-group-item>* {
    position: relative;
    z-index: 3;
}

.list-group-item:hover {
    color: var(--brand-secondary) !important;
}

.list-group-item:hover::after {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
    opacity: 1;
}

.list-group-item.active {
    background-color: var(--brand-primary) !important;
    color: #ffffff !important;
    font-weight: 700;
}

.list-group-item.active i {
    color: #ffffff;
}

.list-group-item.active::before,
.list-group-item.active::after {
    opacity: 0;
}

.list-group-item i {
    width: 28px;
    font-size: 1.15rem;
    text-align: center;
    transition: color 0.3s ease;
}

#page-content-wrapper {
    min-width: 0;
    width: 100%;
}

/* Header */
.navbar {
    background-color: #F7F7F7 !important;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.search-bar .input-group-text,
.search-bar .form-control {
    background-color: #f4f7fe !important;
    border-radius: var(--border-radius-md);
}

.search-bar .input-group-text {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.search-bar .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    font-size: 0.9rem;
}

/* Cards & Components */
.card {
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.metric-card {
    display: flex;
    flex-direction: column;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

/* Custom Modern Pastel Backgrounds */
.card-light-1 {
    background: #ffe4e6 !important;
    --card-icon-bg: #f43f5e;
    --card-text: #334155;
}

.card-light-2 {
    background: #e0f2fe !important;
    --card-icon-bg: #3b82f6;
    --card-text: #334155;
}

.card-light-3 {
    background: #f3e8ff !important;
    --card-icon-bg: #a855f7;
    --card-text: #334155;
}

.card-light-4 {
    background: #dcfce7 !important;
    --card-icon-bg: #22c55e;
    --card-text: #334155;
}

.card-light-5 {
    background: #fef3c7 !important;
    --card-icon-bg: #f59e0b;
    --card-text: #334155;
}

.card-light-6 {
    background: #fae8ff !important;
    --card-icon-bg: #d946ef;
    --card-text: #334155;
}

.card-light-7 {
    background: #ccfbf1 !important;
    --card-icon-bg: #14b8a6;
    --card-text: #334155;
}

.card-light-8 {
    background: #ffedd5 !important;
    --card-icon-bg: #f97316;
    --card-text: #334155;
}

.card-light-text {
    color: var(--card-text) !important;
}

.card-light-icon-container {
    border-color: transparent !important;
    color: white !important;
}

.card-gradient-pattern {
    background:
        radial-gradient(rgba(255, 255, 255, 0.15) 2px, transparent 2px),
        linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-secondary) 100%) !important;
    background-size: 20px 20px, 100% 100%;
    background-position: center, 0 0;
    color: white !important;
}

/* Header Styles */
.dashboard-title-icon {
    font-size: 1.5rem !important;
    color: var(--brand-secondary) !important;
    opacity: 0.9;
}

.btn-modern {
    background-color: white !important;
    border: 1px solid #e2e8f0 !important;
    color: #64748b !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    padding: 8px 16px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease;
    gap: 8px;
}

.btn-modern:hover {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.btn-modern i {
    color: #94a3b8 !important;
}

/* Card Layout Reordering */
.metric-card {
    display: grid !important;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    column-gap: 16px;
    align-content: center;
    align-items: center;
}

.metric-card>.d-flex {
    display: contents !important;
}

.metric-card>.d-flex>h6 {
    /* Title */
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    margin: 0 0 6px 0 !important;
    color: #475569 !important;
    font-size: 0.9rem;
    font-weight: 500;
}

.metric-card>div:not(.d-flex) {
    /* Number wrapper */
    grid-column: 1;
    grid-row: 2;
    align-self: center;
}

.metric-card h2 {
    font-size: 2.1rem !important;
    line-height: 1.1;
    margin-bottom: 0 !important;
    font-weight: 700 !important;
    color: var(--card-text) !important;
}

.metric-card>div:not(.d-flex)::after {
    /* Subtext Dummy */
    content: "Yesterday +15%";
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 8px;
    font-weight: 500;
}

.metric-card>.d-flex>div {
    /* Icon box */
    grid-column: 2;
    grid-row: 1 / 4;
    background-color: var(--card-icon-bg) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    display: flex !important;
    margin: 0 !important;
    align-self: center;
    box-shadow: none !important;
    justify-content: center;
}

.metric-card>.d-flex>div>i {
    font-size: 1.5rem !important;
    color: white !important;
    opacity: 1;
}
}

/* Arrow */
.metric-card::after {
    content: "\f061";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 24px;
    right: 24px;
    color: transparent;
    font-size: 1.2rem;
    transform: rotate(-45deg);
    opacity: 0.4;
    -webkit-text-stroke: 2px var(--card-text);
}

.achiever-card {
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    border-radius: 20px !important;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.achiever-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1) !important;
}

/* Modern CSS Carousel */
.modern-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
    gap: 1.5rem;
    padding-bottom: 0.5rem;
}

.modern-carousel::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.modern-carousel>.col-12 {
    scroll-snap-align: start;
    flex: 0 0 calc(25% - 1.125rem);
    /* Default to 4 on large screens */
}

@media (max-width: 1200px) {
    .modern-carousel>.col-12 {
        flex: 0 0 calc(33.333% - 1rem);
        /* 3 cards */
    }
}

@media (max-width: 992px) {
    .modern-carousel>.col-12 {
        flex: 0 0 calc(50% - 0.75rem);
        /* 2 cards */
    }
}

@media (max-width: 768px) {
    .modern-carousel>.col-12 {
        flex: 0 0 85%;
        /* 1 card and a peek */
    }
}

/* Badge dot */
.badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

/* Custom Tabs */
.custom-tabs {
    background-color: rgba(0, 0, 0, 0.1);
}

.custom-tabs .nav-link {
    color: rgba(255, 255, 255, 0.7) !important;
    margin-right: 5px;
    border-radius: 30px;
    transition: all 0.3s;
}

.custom-tabs .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1);
}

.custom-tabs .nav-link.active {
    background-color: white !important;
    color: var(--brand-secondary) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

/* Custom Table */
.custom-table {
    --bs-table-bg: transparent;
    border-collapse: separate;
    border-spacing: 0 10px;
    margin-top: -10px;
}

.custom-table tr {
    background-color: white;
    box-shadow: var(--shadow-soft);
    border-radius: var(--border-radius-md);
    transition: transform 0.2s;
}

.custom-table tr:hover {
    transform: scale(1.01);
}

.custom-table td {
    padding: 15px 20px;
    border: none;
    vertical-align: middle;
}

.custom-table td:first-child {
    border-top-left-radius: var(--border-radius-md);
    border-bottom-left-radius: var(--border-radius-md);
}

.custom-table td:last-child {
    border-top-right-radius: var(--border-radius-md);
    border-bottom-right-radius: var(--border-radius-md);
}

.rank-badge {
    width: 40px;
    height: 40px;
}

/* Responsive Sidebar Toggle */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        margin-left: -280px;
    }

    #wrapper.toggled #sidebar-wrapper {
        margin-left: 0;
    }
}

.search-bar input::placeholder {
    color: #a0aec0 !important;
    font-weight: 400;
}

.search-bar input:-ms-input-placeholder {
    color: #a0aec0 !important;
}

.search-bar input::-ms-input-placeholder {
    color: #a0aec0 !important;
}

.search-bar input,
.search-bar input:focus,
.search-bar input:active {
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

/* --- Modern Animations & Effects --- */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.metric-card,
.achiever-card {
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Stagger Entrance Animations */
.col-xl-3:nth-child(1) .metric-card {
    animation-delay: 0.1s;
}

.col-xl-3:nth-child(2) .metric-card {
    animation-delay: 0.15s;
}

.col-xl-3:nth-child(3) .metric-card {
    animation-delay: 0.2s;
}

.col-xl-3:nth-child(4) .metric-card {
    animation-delay: 0.25s;
}

.col-xl-3:nth-child(5) .metric-card {
    animation-delay: 0.3s;
}

.col-xl-3:nth-child(6) .metric-card {
    animation-delay: 0.35s;
}

.col-xl-3:nth-child(7) .metric-card {
    animation-delay: 0.4s;
}

.col-xl-3:nth-child(8) .metric-card {
    animation-delay: 0.45s;
}

.modern-carousel>.col-12:nth-child(1) .achiever-card {
    animation-delay: 0.5s;
}

.modern-carousel>.col-12:nth-child(2) .achiever-card {
    animation-delay: 0.6s;
}

.modern-carousel>.col-12:nth-child(3) .achiever-card {
    animation-delay: 0.7s;
}

.modern-carousel>.col-12:nth-child(4) .achiever-card {
    animation-delay: 0.8s;
}

/* Shimmer Hover Effect */
.metric-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.1) 50%, rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: all 0.7s ease;
    z-index: 1;
    pointer-events: none;
}

.metric-card:hover::before {
    left: 200%;
}

/* Modern Chart Title Icon (Document shape with two-tone base) */
.modern-stat-icon {
    width: 36px;
    height: 42px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.modern-stat-icon-primary {
    background: linear-gradient(to bottom, #dbeafe 75%, #bfdbfe 75%);
    color: #1d4ed8;
}

.modern-stat-icon-info {
    background: linear-gradient(to bottom, #cff4fc 75%, #aee3f1 75%);
    color: #055160;
}

.modern-stat-icon-danger {
    background: linear-gradient(to bottom, #fee2e2 75%, #fecaca 75%);
    color: #ef4444;
}

.modern-stat-icon-warning {
    background: linear-gradient(to bottom, #fef08a 75%, #fde047 75%);
    color: #ca8a04;
}

.modern-stat-icon-success {
    background: linear-gradient(to bottom, #bbf7d0 75%, #86efac 75%);
    color: #16a34a;
}

/* Small variant for pie charts */
.modern-stat-icon-sm {
    width: 28px;
    height: 34px;
    font-size: 1rem;
    box-shadow: none;
}

.card-gradient-blue {
    background: linear-gradient(135deg, #4da3ff 0%, #2b70ff 100%) !important;
}

.card-gradient-slate {
    background: linear-gradient(135deg, #4d5b76 0%, #2c364c 100%) !important;
}

.card-gradient-purple {
    background: linear-gradient(135deg, #a78bfa 0%, #7c3aed 100%) !important;
}

/* Modern Pie Chart Enhancements */
.hover-lift {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}
.hover-lift:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08) !important;
}

.view-report-btn {
    background-color: #fef2f2;
    color: #ef4444 !important;
    border: 1px solid #fecaca;
    transition: all 0.2s ease;
}
.view-report-btn:hover {
    background-color: #ef4444;
    color: white !important;
    border-color: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

/* Custom Tabs Styling */
.custom-tabs {
    gap: 0.5rem;
}
.custom-tabs .nav-item {
    flex: 0 0 auto;
}
.custom-tabs .nav-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.7) !important;
    padding: 0.5rem 1.25rem !important;
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    gap: 0.4rem;
    transition: all 0.3s ease;
    border-radius: 50rem; /* Full pill shape */
}
.custom-tabs .nav-link i {
    font-size: 1.1rem;
    margin: 0 !important;
}
.custom-tabs .nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255,255,255,0.1);
}
.custom-tabs .nav-link.active {
    background-color: #ffffff !important;
    color: #0c3c7c !important; /* Brand dark blue */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.glass-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    transition: all 0.3s ease;
}
.glass-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.15);
}