/* HSL Custom Variable Declarations for Rich Aesthetics */
:root {
    /* Default Dark Mode Styling Theme Values */
    --bg-primary: 222 47% 11%;     /* #0f172a */
    --bg-secondary: 222 47% 16%;   /* #1e293b */
    --bg-glass: 222 47% 16% / 0.65;
    --border-color: 222 47% 25% / 0.5;
    --text-primary: 210 40% 98%;   /* #f8fafc */
    --text-secondary: 215 25% 70%; /* #94a3b8 */
    
    --primary: 217 91% 60%;        /* #3b82f6 */
    --primary-glow: 217 91% 60% / 0.3;
    --success: 142 70% 45%;
    --danger: 350 89% 60%;
    --warning: 38 92% 50%;
    --info: 188 78% 60%;
    
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    /* Responsive Light Mode Styling Theme Values */
    --bg-primary: 210 20% 98%;     /* #f8fafc */
    --bg-secondary: 0 0% 100%;     /* #ffffff */
    --bg-glass: 0 0% 100% / 0.75;
    --border-color: 210 20% 90%;
    --text-primary: 222 47% 11%;   /* #0f172a */
    --text-secondary: 215 16% 47%; /* #64748b */
    
    --primary: 217 91% 55%;
    --primary-glow: 217 91% 55% / 0.15;
    --success: 142 76% 36%;
    --danger: 350 89% 50%;
    --warning: 38 92% 45%;
    --info: 188 78% 45%;
    
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

body {
    background-color: hsl(var(--bg-primary));
    color: hsl(var(--text-primary));
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    transition: var(--transition-smooth);
    overflow-x: hidden;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: hsl(var(--bg-primary));
}
::-webkit-scrollbar-thumb {
    background: hsl(var(--border-color));
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--primary));
}

/* Dashboard Layout */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

/* Sidebar Styling */
#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: hsl(var(--bg-secondary));
    border-right: 1px solid hsl(var(--border-color));
    transition: var(--transition-smooth);
    z-index: 999;
}

#sidebar.active {
    margin-left: -260px;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid hsl(var(--border-color));
}

.sidebar-header i {
    font-size: 1.8rem;
    color: hsl(var(--primary));
    text-shadow: 0 0 10px hsl(var(--primary-glow));
}

.sidebar-header span {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.5px;
    margin-left: 0.75rem;
}

#sidebar ul.components {
    padding: 1rem 0.75rem;
}

#sidebar ul li {
    list-style: none;
    margin-bottom: 0.25rem;
}

#sidebar ul li a {
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    color: hsl(var(--text-secondary));
    text-decoration: none;
    border-radius: 10px;
    transition: var(--transition-smooth);
}

#sidebar ul li a i {
    margin-right: 0.75rem;
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

#sidebar ul li a:hover, 
#sidebar ul li.active a {
    color: #ffffff;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, #2563eb 100%);
    box-shadow: 0 4px 12px hsl(var(--primary-glow));
}

/* Page Content */
#content {
    width: 100%;
    min-height: 100vh;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

/* Top Navbar */
.navbar {
    padding: 0.75rem 1.5rem;
    background: hsl(var(--bg-secondary)) !important;
    border-bottom: 1px solid hsl(var(--border-color));
    transition: var(--transition-smooth);
}

.theme-toggle-btn {
    background: none;
    border: none;
    color: hsl(var(--text-secondary));
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
}

.theme-toggle-btn:hover {
    color: hsl(var(--primary));
}

/* Cards & Glassmorphism */
.glass-card {
    background: hsl(var(--bg-glass));
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    border: 1px solid hsl(var(--border-color));
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--transition-smooth);
    color: hsl(var(--text-primary));
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.15);
}

/* Dynamic Hover and Focus Effects */
.btn-primary {
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, #2563eb 100%);
    border: none;
    box-shadow: 0 4px 12px hsl(var(--primary-glow));
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px hsl(var(--primary-glow));
}

/* Metrics and Dashboard Widgets */
.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
}

.metric-trend {
    font-size: 0.85rem;
    font-weight: 600;
}

/* DataTables Styling Override */
.dataTables_wrapper {
    color: hsl(var(--text-primary)) !important;
}

table.dataTable {
    background-color: transparent !important;
    border-collapse: collapse !important;
    border-color: hsl(var(--border-color)) !important;
}

table.dataTable thead th {
    background-color: hsl(var(--bg-primary)) !important;
    color: hsl(var(--text-primary)) !important;
    border-bottom: 2px solid hsl(var(--border-color)) !important;
    padding: 12px !important;
}

table.dataTable tbody td {
    background-color: transparent !important;
    color: hsl(var(--text-primary)) !important;
    border-bottom: 1px solid hsl(var(--border-color)) !important;
    padding: 12px !important;
}

.dataTables_paginate .paginate_button {
    color: hsl(var(--text-secondary)) !important;
    background: hsl(var(--bg-secondary)) !important;
    border: 1px solid hsl(var(--border-color)) !important;
    border-radius: 8px !important;
}

.dataTables_paginate .paginate_button.current {
    background: hsl(var(--primary)) !important;
    color: white !important;
}

/* Pulse Animation for Alerts/Status */
.pulse-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 0 0 0 rgba(var(--primary), 0.7);
}

.pulse-indicator-success {
    background: #10b981;
    animation: pulse-success 1.6s infinite;
}

.pulse-indicator-danger {
    background: #ef4444;
    animation: pulse-danger 1.6s infinite;
}

@keyframes pulse-success {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

@keyframes pulse-danger {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Modals glassmorphic style */
.modal-content {
    background: hsl(var(--bg-secondary));
    border: 1px solid hsl(var(--border-color));
    color: hsl(var(--text-primary));
    border-radius: 16px;
}
.modal-header {
    border-bottom: 1px solid hsl(var(--border-color));
}
.modal-footer {
    border-top: 1px solid hsl(var(--border-color));
}

.avatar-initials {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, hsl(var(--primary)) 0%, #2563eb 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
}

/* Autocomplete Dropdown Custom Style Rules */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 1060 !important; /* Render above Bootstrap modals (1055) */
    background-color: hsl(var(--bg-secondary)) !important;
    border: 1px solid hsl(var(--border-color)) !important;
    border-radius: 10px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
    padding: 0.5rem 0;
}
.autocomplete-item {
    display: block;
    width: 100%;
    padding: 0.6rem 1rem;
    clear: both;
    font-weight: 400;
    color: hsl(var(--text-secondary)) ;
    text-align: inherit;
    text-decoration: none;
    white-space: nowrap;
    background-color: transparent;
    border: 0;
    transition: var(--transition-smooth);
    font-size: 0.875rem;
    cursor: pointer;
}
.autocomplete-item:hover {
    background-color: hsl(var(--primary)) !important;
    color: #ffffff !important;
}
