:root {
    --primary-blue: #2563EB;
    --primary-green: #22C55E;
    --primary-cyan: #38BDF8;
    --bg-white: #F8FAFC;
    --text-dark: #0F172A;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --card-radius: 16px;
}

body {
    background-color: var(--bg-white);
    color: var(--text-dark);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-dark);
    font-weight: 700;
}

.text-primary-blue { color: var(--primary-blue); }
.text-primary-green { color: var(--primary-green); }
.text-primary-cyan { color: var(--primary-cyan); }

/* Buttons */
.btn-primary {
    background-color: var(--primary-blue);
    border-color: var(--primary-blue);
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--primary-blue);
    border-color: var(--primary-blue);
    border-radius: 8px;
    font-weight: 600;
}

.btn-outline-primary:hover {
    background-color: var(--primary-blue);
    color: white;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    background: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.app-card {
    margin-bottom: 1rem;
    position: relative;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.app-card .card-body {
    padding: 1.25rem;
}

.app-icon-placeholder {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-cyan));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 1rem;
}

/* Badges */
.badge {
    padding: 0.5em 0.8em;
    border-radius: 6px;
    font-weight: 600;
}

/* Mobile Navigation & Utilities */
.pb-safe {
    padding-bottom: env(safe-area-inset-bottom);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: translateY(-2px);
}

.hover-scale:active {
    transform: scale(0.95);
}

.bg-success { background-color: var(--primary-green) !important; }
.bg-warning { background-color: #F59E0B !important; color: white; } /* Adjusted warning for better contrast */
.bg-danger { background-color: #EF4444 !important; }

/* Dashboard Stats */
.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.stat-icon.blue { background-color: rgba(37, 99, 235, 0.1); color: var(--primary-blue); }
.stat-icon.green { background-color: rgba(34, 197, 94, 0.1); color: var(--primary-green); }
.stat-icon.red { background-color: rgba(239, 68, 68, 0.1); color: #EF4444; }

.stat-content {
    flex-grow: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #64748B;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Sidebar Customization */
.custom-sidebar {
    width: 280px !important;
    max-width: 85vw !important;
}

/* Desktop Sidebar & Content Adjustment */
@media (min-width: 992px) {
    .custom-sidebar {
        position: fixed !important;
        top: 73px; /* Adjust based on header height */
        left: 0;
        bottom: 0;
        z-index: 1000;
        overflow-y: auto;
        background-color: #fff;
        border-right: 1px solid #e9ecef;
        transform: none !important;
        visibility: visible !important;
        box-shadow: none !important;
        padding-top: 1rem;
    }
    
    .main-content {
        margin-left: 280px;
        max-width: none !important;
        width: auto !important;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Ensure the sidebar backdrop is hidden on desktop if it accidentally triggers */
    .offcanvas-backdrop {
        display: none !important;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .container {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .mobile-header {
        position: sticky;
        top: 0;
        z-index: 1000;
        background: rgba(248, 250, 252, 0.95);
        backdrop-filter: blur(10px);
        padding-top: 1rem;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid rgba(0,0,0,0.05);
    }

    h1.h2 {
        font-size: 1.75rem;
        margin-bottom: 0;
    }
    
    .stat-card {
        padding: 1rem;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .stat-value {
        font-size: 1.5rem;
        margin-bottom: 0;
    }

    .custom-sidebar {
        width: 50% !important;
    }

    .footer-disclaimer {
        font-size: 0.7rem;
        line-height: 1.4;
        max-width: 320px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* Utilities */
.hover-scale {
    transition: transform 0.2s ease;
}
.hover-scale:hover {
    transform: scale(1.05);
}

.min-width-0 {
    min-width: 0 !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Animated Gradient Text - Professional Look */
@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.animated-gradient-text {
    /* Professional Blue-Green Gradient */
    background: linear-gradient(300deg, #2563EB, #22C55E, #38BDF8, #2563EB);
    background-size: 300% 300%;
    
    /* Text Clip Properties */
    -webkit-background-clip: text !important;
    background-clip: text !important;
    
    /* Color Transparency */
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    
    /* Animation */
    animation: gradient-animation 8s ease infinite;
}

/* Accordion Icon Rotation */
.rotate-icon {
    transition: transform 0.3s ease;
}

/* Rotate the icon when the collapsible section is expanded.
   Bootstrap toggles 'collapsed' class on the trigger button.
   When 'collapsed' is missing, it means it is expanded.
   However, we want to target the state where aria-expanded="true".
*/
.card-header[aria-expanded="true"] .rotate-icon {
    transform: rotate(180deg);
}

/* Custom Table Row Hover for Div-based Tables */
.hover-bg {
    transition: background-color 0.2s ease;
}
.hover-bg:hover {
    background-color: rgba(0, 0, 0, 0.02);
}
