/**
 * RBT-Bank System - Modern UI Design
 * Clean, minimal, and professional design with single color scheme
 */

/* ========== CSS Variables - Centralized Color System ========== */
/* 
 * CHANGE COLORS HERE TO UPDATE ENTIRE APPLICATION
 * Simply modify the values below to change the color scheme
 */
:root {
    /* ===== PRIMARY BRAND COLOR ===== */
    /* Change these to update the main brand color throughout the app */
    --primary: #2563eb;              /* Main brand color - buttons, links, active states */
    --primary-hover: #1d4ed8;        /* Hover state for primary elements */
    --primary-light: #dbeafe;        /* Light background for primary elements */
    --primary-dark: #1e40af;         /* Dark variant of primary color */
    
    /* ===== NEUTRAL COLORS ===== */
    /* Base colors for text, backgrounds, and borders */
    --white: #ffffff;
    --black: #000000;
    --gray-50: #f9fafb;              /* Lightest gray - page background */
    --gray-100: #f3f4f6;             /* Very light gray - card backgrounds */
    --gray-200: #e5e7eb;             /* Light gray - borders */
    --gray-300: #d1d5db;             /* Medium-light gray - input borders */
    --gray-400: #9ca3af;             /* Medium gray - placeholder text */
    --gray-500: #6b7280;             /* Medium-dark gray - secondary text */
    --gray-600: #4b5563;             /* Dark gray - body text */
    --gray-700: #374151;             /* Darker gray - headings */
    --gray-800: #1f2937;             /* Very dark gray - primary text */
    --gray-900: #111827;             /* Darkest gray - emphasis text */
    
    /* ===== SEMANTIC COLORS ===== */
    /* Status and feedback colors */
    --success: #10b981;              /* Success messages, positive actions */
    --success-hover: #059669;        /* Success hover state */
    --success-light: #d1fae5;        /* Success background */
    
    --warning: #f59e0b;              /* Warning messages */
    --warning-hover: #d97706;        /* Warning hover state */
    --warning-light: #fef3c7;        /* Warning background */
    
    --danger: #ef4444;               /* Error messages, delete actions */
    --danger-hover: #dc2626;         /* Danger hover state */
    --danger-light: #fee2e2;         /* Danger background */
    
    --info: #06b6d4;                 /* Info messages */
    --info-hover: #0891b2;           /* Info hover state */
    --info-light: #cffafe;           /* Info background */
    
    /* ===== LAYOUT DIMENSIONS ===== */
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --border-radius-xl: 20px;
    
    /* ===== SHADOWS ===== */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* ===== TRANSITIONS ===== */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* ===== SPACING ===== */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* ===== FONT SIZES ===== */
    --font-xs: 12px;
    --font-sm: 13px;
    --font-base: 14px;
    --font-md: 15px;
    --font-lg: 16px;
    --font-xl: 18px;
    --font-2xl: 20px;
    --font-3xl: 24px;
    --font-4xl: 28px;
    --font-5xl: 32px;
}

/* ========== Base Styles ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-800);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========== Sidebar Component ========== */
/* 
 * Sidebar Navigation
 * - Fixed positioning on desktop (≥1024px)
 * - Hidden by default on mobile/tablet (<1024px)
 * - Animated slide-in/out with transform for performance
 * - Uses CSS custom properties for consistent sizing
 */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
}

/* Sidebar toggle button - hidden by default on desktop */
.sidebar-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--gray-700);
    font-size: 20px;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
    line-height: 1;
}

.sidebar-toggle:hover {
    color: var(--primary);
    background: var(--gray-100);
    border-radius: var(--border-radius-sm);
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: none;
}

/* Toggle button visibility handled in responsive sidebar section below */

/* ========== Responsive Sidebar Styles ========== */
/* 
 * Sidebar Responsive Behavior
 * Organized by breakpoint in ascending order for clarity
 * - Desktop (≥1024px): Sidebar always visible, fixed position
 * - Tablet/Mobile (<1024px): Sidebar hidden, slides in from left
 * - Uses transform for GPU acceleration and smooth 60fps animations
 * - Hardware acceleration enabled with will-change property
 */

/* Tablet & Mobile (<1024px) - Sidebar hidden by default */
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        transform: translateX(-100%);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        z-index: 1050;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        will-change: transform;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        margin-right: 12px;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* Extra Small (<480px) - Adjust sidebar width */
@media (max-width: 479px) {
    .sidebar {
        width: 280px;
        max-width: 85%;
    }
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--gray-200);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--gray-900);
    font-weight: 700;
    font-size: 20px;
}

.sidebar-logo i {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--border-radius-sm);
    font-size: 20px;
}

/* Navigation Menu */
.nav-menu {
    padding: 24px 16px;
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
    font-weight: 500;
    font-size: 14px;
}

.nav-link:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary);
}

.nav-icon {
    width: 20px;
    margin-right: 12px;
    font-size: 18px;
}

/* Submenu */
.nav-item.has-submenu > .nav-link {
    position: relative;
}

.submenu-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: var(--transition-fast);
}

.nav-item.has-submenu.active > .nav-link .submenu-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    list-style: none;
    padding: 4px 0 4px 48px;
    max-height: 0;
    overflow: hidden;
    transition: var(--transition);
}

.nav-item.has-submenu.active .nav-submenu {
    max-height: 500px;
}

.nav-submenu .nav-link {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========== Main Content ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    padding: 15px;
}

@media (max-width: 1023px) {
    .main-content {
        margin-left: 0;
        padding: 24px 16px;
    }
}

@media (max-width: 479px) {
    .main-content {
        padding: 16px 12px;
    }
}

/* Header */
.content-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Mobile header adjustments */
@media (max-width: 1023px) {
    .content-header {
        padding: 0 16px;
        height: 60px;
    }
    
    .header-left {
        gap: 8px;
    }
}

.header-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Hide header-right on mobile */
@media (max-width: 767px) {
    .header-right {
        display: none;
    }
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--gray-50);
    border-radius: var(--border-radius-lg);
    cursor: pointer;
    transition: var(--transition-fast);
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--gray-900);
}

.user-role {
    font-size: 12px;
    color: var(--gray-500);
}

/* Content Area */
.content {
    padding: 32px;
}

.page-content {
    padding: 0;
}

/* ========== Page Header ========== */
.page-header {
    margin-bottom: 32px;
    padding: 0;
}

.page-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--gray-500);
    margin: 4px 0 0 0;
}

.page-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Mobile page actions - stack vertically */
@media (max-width: 767px) {
    .page-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .page-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .page-header {
        margin-bottom: 24px;
    }
    
    .page-title {
        font-size: 24px;
    }
}

/* Tablet page actions - 2 columns */
@media (max-width: 1023px) and (min-width: 768px) {
    .page-actions {
        flex-wrap: wrap;
    }
    
    .page-actions .btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 120px;
    }
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--gray-500);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item a {
    color: var(--gray-500);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb-item a:hover {
    color: var(--primary);
}

.breadcrumb-item.active {
    color: var(--gray-900);
    font-weight: 500;
}

/* ========== Cards ========== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-hover);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-700);
}

.form-label .required {
    color: var(--danger);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    background: var(--white);
    color: var(--gray-900);
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control:disabled {
    background: var(--gray-100);
    cursor: not-allowed;
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-light);
}

.invalid-feedback {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--danger);
}

.form-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    background: var(--white);
    color: var(--gray-900);
    cursor: pointer;
    transition: var(--transition-fast);
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-text {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--gray-500);
}

/* Search Input */
.search-box {
    position: relative;
    width: 100%;
    max-width: 400px;
}

.search-box input {
    padding-left: 40px;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
}

/* ========== Tables ========== */
.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--gray-200);
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--gray-50);
}

.table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.table td {
    padding: 16px 20px;
    font-size: 14px;
    color: var(--gray-800);
    border-bottom: 1px solid var(--gray-200);
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Responsive table for mobile */
@media (max-width: 767px) {
    .table-wrapper {
        overflow-x: auto;
        margin: 0 -16px;
        padding: 0 16px;
    }
    
    .table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .table th {
        padding: 12px 10px;
        font-size: 11px;
    }
    
    .table td {
        padding: 12px 10px;
        font-size: 13px;
    }
    
    /* Horizontal scroll indicator */
    .table-wrapper::after {
        content: '';
        display: block;
        height: 4px;
        background: linear-gradient(to right, transparent, var(--primary), transparent);
        margin-top: -4px;
    }
}

/* Responsive table for tablet */
@media (max-width: 1023px) and (min-width: 768px) {
    .table {
        font-size: 13px;
    }
    
    .table th {
        padding: 14px 12px;
        font-size: 12px;
    }
    
    .table td {
        padding: 14px 12px;
        font-size: 13px;
    }
}

/* Stacked table for extra small screens */
@media (max-width: 479px) {
    .table-wrapper {
        overflow-x: auto;
    }
    
    .table {
        min-width: 500px;
    }
    
    .table th {
        padding: 10px 8px;
        font-size: 10px;
    }
    
    .table td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* Table Actions */
.table-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.action-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-fast);
    background: transparent;
    padding: 0;
}

.action-btn:hover {
    background: var(--gray-100);
}

.action-btn.edit {
    color: var(--primary);
}

.action-btn.delete {
    color: var(--danger);
}

.action-btn.view {
    color: var(--info);
}

/* Mobile table actions - convert to dropdown */
@media (max-width: 767px) {
    .table-actions {
        gap: 4px;
    }
    
    .action-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

/* ========== Badges ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 12px;
    white-space: nowrap;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-light);
    color: var(--warning);
}

.badge-info {
    background: var(--info-light);
    color: var(--info);
}

.badge-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ========== Dashboard Widgets ========== */
.widgets-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 32px;
    align-items: stretch;
}

.widget {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 24px;
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    min-height: 140px;
    height: 100%;
}

.widget:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.widget-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.widget-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-sm);
    font-size: 24px;
}

.widget-icon.primary {
    background: var(--primary-light);
    color: var(--primary);
}

.widget-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.widget-icon.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.widget-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.widget-icon.info {
    background: var(--info-light);
    color: var(--info);
}

.widget-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 8px 0;
}

.widget-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--gray-500);
}

/* ========== Enhanced Widget Color Coding ========== */
/* Color schemes for different widget categories */

/* Customer widgets - Blue (#2563eb) */
.widget-customer {
    border-left: 4px solid #2563eb;
}

.widget-customer .widget-icon {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.widget-customer:hover {
    border-left-color: #1d4ed8;
}

/* Loan widgets - Orange (#f59e0b) */
.widget-loan {
    border-left: 4px solid #f59e0b;
}

.widget-loan .widget-icon {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.widget-loan:hover {
    border-left-color: #d97706;
}

/* Savings widgets - Green (#10b981) */
.widget-savings {
    border-left: 4px solid #10b981;
}

.widget-savings .widget-icon {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.widget-savings:hover {
    border-left-color: #059669;
}

/* Collection widgets - Purple (#8b5cf6) */
.widget-collection {
    border-left: 4px solid #8b5cf6;
}

.widget-collection .widget-icon {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.widget-collection:hover {
    border-left-color: #7c3aed;
}

/* Agent widgets - Teal (#14b8a6) */
.widget-agent {
    border-left: 4px solid #14b8a6;
}

.widget-agent .widget-icon {
    background: rgba(20, 184, 166, 0.1);
    color: #14b8a6;
}

.widget-agent:hover {
    border-left-color: #0d9488;
}

/* Defaulter widgets - Red (#ef4444) */
.widget-defaulter {
    border-left: 4px solid #ef4444;
}

.widget-defaulter .widget-icon {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.widget-defaulter:hover {
    border-left-color: #dc2626;
}

/* ========== Comprehensive Summary Widget ========== */
.widget-summary {
    grid-column: span 4;
    background: white;
    border: 2px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.widget-summary:hover {
    transform: none;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.widget-summary .widget-icon {
    color: white;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.summary-item {
    background: var(--gray-50);
    padding: 16px;
    border-radius: 12px;
    border: 2px solid var(--gray-200);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}

.summary-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--primary);
    background: white;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.summary-content {
    flex: 1;
    min-width: 0;
}

.summary-label {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 600;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.summary-value {
    font-size: 25px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
}

/* Responsive adjustments for summary widget */
@media (max-width: 1400px) {
    .widget-summary {
        grid-column: span 3 !important;
    }
    
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .widget-summary {
        grid-column: span 2 !important;
    }
    
    .summary-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .widget-summary {
        grid-column: span 1 !important;
    }
    
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .summary-item {
        padding: 12px;
        gap: 10px;
    }
    
    .summary-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .summary-label {
        font-size: 11px;
    }
    
    .summary-value {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }
    
    .summary-item {
        padding: 14px;
    }
    
    .summary-value {
        font-size: 26px;
    }
}

/* ========== Compact Widget Styles (Horizontal Layout) ========== */
.widget-compact {
    padding: 18px;
    min-height: 140px;
}

.widget-compact:hover {
    transform: translateY(-3px);
}

.widget-compact-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    height: 100%;
}

.widget-compact-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.widget-compact-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.widget-compact-label {
    font-size: 12px;
    color: var(--gray-600);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    line-height: 1.3;
}

.widget-compact-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1;
    margin-bottom: 8px;
}

.widget-compact-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
}

.widget-compact-period {
    color: var(--gray-500);
    font-size: 11px;
    font-weight: 500;
    line-height: 1.3;
}

/* Responsive adjustments for compact widgets */
@media (max-width: 1400px) {
    .widgets-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 18px;
    }
}

@media (max-width: 1024px) {
    .widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .widget-compact {
        padding: 16px;
        min-height: 120px;
    }
    
    .widget-compact-content {
        gap: 12px;
    }
    
    .widget-compact-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .widget-compact-label {
        font-size: 10px;
        margin-bottom: 6px;
    }
    
    .widget-compact-value {
        font-size: 24px;
        margin-bottom: 6px;
    }
}

@media (max-width: 480px) {
    .widget-compact {
        min-height: auto;
    }
    
    .widget-compact-content {
        flex-direction: row;
        align-items: center;
    }
    
    .widget-compact-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .widget-compact-value {
        font-size: 26px;
    }
}

/* ========== Widget Trend Indicators ========== */
.widget-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
}

.widget-trend i {
    font-size: 11px;
}

/* Upward trend - Green */
.widget-trend-up {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.widget-trend-up i {
    color: #10b981;
}

/* Downward trend - Red */
.widget-trend-down {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.widget-trend-down i {
    color: #ef4444;
}

/* Neutral trend - Gray */
.widget-trend-neutral {
    color: #6b7280;
    background: rgba(107, 114, 128, 0.1);
}

.widget-trend-neutral i {
    color: #6b7280;
}


/* ========== Alerts ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.alert i {
    font-size: 20px;
    margin-top: 2px;
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid var(--success);
}

.alert-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.alert-warning {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: var(--info);
    border: 1px solid var(--info);
}

/* ========== Pagination ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-700);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition-fast);
}

.page-link:hover {
    background: var(--gray-50);
    border-color: var(--primary);
    color: var(--primary);
}

.page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

.page-item.disabled .page-link {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========== Filters ========== */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--white);
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

/* Mobile filters - stack vertically */
@media (max-width: 767px) {
    .filters {
        flex-direction: column;
        padding: 16px;
        gap: 12px;
    }
    
    .filter-group {
        width: 100%;
        min-width: 100%;
    }
    
    .filter-group input,
    .filter-group select {
        width: 100%;
    }
}

/* Tablet filters - 2 columns */
@media (max-width: 1023px) and (min-width: 768px) {
    .filters {
        flex-direction: row;
    }
    
    .filter-group {
        flex: 1 1 calc(50% - 6px);
        min-width: auto;
    }
}

/* ========== Empty State ========== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    border-radius: 50%;
    color: var(--gray-400);
    font-size: 36px;
}

.empty-state-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.empty-state-description {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}

/* ========== Loading ========== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== Utilities ========== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.d-flex { display: flex; }
.d-none { display: none; }
.d-block { display: block; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* Responsive styles consolidated in Responsive Breakpoints section below */

/* ========== Toast Notifications ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary);
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-message {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-900);
    line-height: 1.5;
}

.toast-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    border-radius: 4px;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* Toast Types */
.toast-success {
    border-left-color: var(--success);
}

.toast-success .toast-icon {
    color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-error .toast-icon {
    color: var(--danger);
}

.toast-warning {
    border-left-color: var(--warning);
}

.toast-warning .toast-icon {
    color: var(--warning);
}

.toast-info {
    border-left-color: var(--info);
}

.toast-info .toast-icon {
    color: var(--info);
}

/* ========== Sidebar Overlay (Mobile) ========== */
/* 
 * Overlay Backdrop
 * - Appears behind sidebar on mobile/tablet
 * - Provides visual feedback and click-to-close functionality
 * - Uses opacity and visibility for smooth transitions
 * - Backdrop blur for modern browsers (graceful degradation)
 */

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

@media (max-width: 1023px) {
    .sidebar-overlay {
        display: block;
    }
}

/* ========== Offcanvas (Slide from Right) ========== */
.offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.offcanvas-overlay.show {
    opacity: 1;
    visibility: visible;
}

.offcanvas {
    position: fixed;
    top: 0;
    right: -600px;
    width: 600px;
    height: 100vh;
    background: var(--white);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.offcanvas.show {
    right: 0;
}

.offcanvas-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.offcanvas-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.offcanvas-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition-fast);
}

.offcanvas-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.offcanvas-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 160px);
}

.offcanvas-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--gray-50);
    flex-shrink: 0;
}

/* Responsive Offcanvas */
@media (max-width: 768px) {
    .offcanvas {
        width: 100%;
        right: -100%;
    }
    
    .toast-container {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}



/* ========== Login Pages ========== */
.login-page {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.login-container {
    max-width: 450px;
    width: 100%;
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 40px 30px;
    text-align: center;
}

.login-header h2 {
    margin: 0;
    font-size: var(--font-4xl);
    font-weight: 600;
}

.login-header p {
    margin: 10px 0 0 0;
    opacity: 0.9;
    font-size: var(--font-base);
}

.login-body {
    padding: 40px 30px;
}

.login-footer {
    text-align: center;
    padding: 20px 30px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    margin: 0 10px;
    transition: var(--transition-fast);
}

.login-footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.logo-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: 12px;
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--white);
    width: 100%;
    transition: var(--transition-fast);
    cursor: pointer;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(37, 99, 235, 0.4);
}

.login-page .input-group-text {
    background: var(--white);
    border: 2px solid var(--gray-300);
    border-right: none;
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.login-page .input-group .form-control {
    border-left: none;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.login-page .form-control {
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius-sm);
    padding: 12px 15px;
    font-size: var(--font-md);
    transition: var(--transition-fast);
}

.login-page .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem var(--primary-light);
}

.login-page .alert {
    border-radius: var(--border-radius-sm);
    border: none;
}

.login-page .text-white {
    color: var(--white);
}

/* Responsive Login */
@media (max-width: 576px) {
    .login-container {
        padding: 10px;
    }
    
    .login-header {
        padding: 30px 20px;
    }
    
    .login-body {
        padding: 30px 20px;
    }
    
    .login-footer {
        padding: 15px 20px;
    }
}

/* Sidebar Navigation Divider */
.nav-divider {
    height: 1px;
    margin: 15px 20px;
    background-color: rgba(255, 255, 255, 0.1);
    list-style: none;
}

/* ========== Agent Daily Collection Widget ========== */
#agentCollectionWidget .filter-controls {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

#agentCollectionWidget .filter-group {
    flex: 1;
    min-width: 200px;
}

#agentCollectionWidget .filter-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--gray-700);
    font-size: 14px;
}

#agentCollectionWidget .btn-quick-date {
    padding: 4px 12px;
    font-size: 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    cursor: pointer;
    color: var(--gray-700);
    transition: var(--transition-fast);
}

#agentCollectionWidget .btn-quick-date:hover {
    background: var(--gray-200);
    border-color: var(--gray-400);
}

#agentCollectionWidget .btn-quick-date:active,
#agentCollectionWidget .btn-quick-date.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

#agentCollectionWidget .btn-icon-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px 8px;
    transition: var(--transition-fast);
}

#agentCollectionWidget .btn-icon-clear:hover {
    color: var(--gray-600);
}

#agentCollectionTable th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: var(--transition-fast);
}

#agentCollectionTable th.sortable:hover {
    background: var(--gray-100);
}

#agentCollectionTable .sort-icon {
    margin-left: 6px;
    font-size: 12px;
    color: var(--gray-400);
    transition: var(--transition-fast);
}

#agentCollectionTable th.sortable:hover .sort-icon {
    color: var(--gray-600);
}

#agentCollectionTable tfoot tr {
    background: var(--gray-50);
    font-weight: 600;
}

#agentCollectionTable tfoot td {
    border-top: 2px solid var(--gray-300);
    padding: 16px 20px;
}

#collectionLoadingSpinner {
    text-align: center;
    padding: 40px;
}

#collectionLoadingSpinner i {
    font-size: 32px;
    color: var(--primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#collectionErrorMessage {
    padding: 16px;
    background: var(--danger-light);
    border: 1px solid var(--danger);
    border-radius: 8px;
    color: var(--danger);
    margin-top: 16px;
}

#collectionErrorMessage i {
    margin-right: 8px;
}

/* Responsive adjustments for Agent Collection Widget */
@media (max-width: 768px) {
    #agentCollectionWidget .filter-controls {
        flex-direction: column;
    }
    
    #agentCollectionWidget .filter-group {
        width: 100%;
        min-width: 100%;
    }
    
    #agentCollectionTable {
        font-size: 13px;
    }
    
    #agentCollectionTable th,
    #agentCollectionTable td {
        padding: 12px 10px;
    }
}

/* ========== Top Defaulters Widget Styles ========== */

/* Severity-based row styling */
.defaulter-row {
    transition: var(--transition-fast);
}

.defaulter-row.severity-critical {
    background-color: #fee2e2 !important; /* Red background for skip_days > 90 */
}

.defaulter-row.severity-high {
    background-color: #fed7aa !important; /* Orange background for skip_days 31-90 */
}

.defaulter-row.severity-medium {
    background-color: #fef3c7 !important; /* Yellow background for skip_days ≤ 30 */
}

/* Hover effect for clickable rows */
.defaulter-row:hover {
    filter: brightness(0.95);
    transform: translateX(2px);
    box-shadow: var(--shadow-sm);
}

/* Skip days and months highlighting */
.skip-days-value.text-danger,
.skip-months-value.text-danger {
    font-weight: 600;
    color: var(--danger) !important;
}

/* Visual indicator for critical defaulters */
.defaulter-row .fa-exclamation-circle {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Empty state styling for defaulters */
#topDefaultersWidget .empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

#topDefaultersWidget .empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 8px;
}

#topDefaultersWidget .empty-state-description {
    font-size: 14px;
    color: var(--gray-500);
}

/* Refresh button styling */
#refreshDefaultersBtn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

#refreshDefaultersBtn:hover .fa-sync-alt {
    animation: spin 0.5s linear;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Table styling for defaulters */
#topDefaultersTable thead th {
    background-color: var(--gray-50);
    font-weight: 600;
    font-size: 13px;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
    border-bottom: 2px solid var(--gray-200);
}

#topDefaultersTable tbody td {
    padding: 14px 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--gray-200);
}

/* Arrow icon styling */
.defaulter-row .fa-chevron-right {
    transition: var(--transition-fast);
}

.defaulter-row:hover .fa-chevron-right {
    transform: translateX(4px);
    color: var(--primary) !important;
}


/* ========== Modal Dialogs (Custom Delete Confirmation) ========== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-dialog {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-2xl);
    max-width: 500px;
    width: 90%;
    animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: var(--gray-100);
    color: var(--gray-600);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--gray-200);
    color: var(--gray-900);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background: var(--gray-50);
}

/* ========== Button Loading States ========== */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.6s linear infinite;
}

/* ========== Page Loading State ========== */
.page-loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.page-loading.active {
    opacity: 1;
    visibility: visible;
}

.page-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.page-loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
}

.page-loading-text {
    font-size: 14px;
    color: var(--gray-600);
    font-weight: 500;
}

/* ========== Data Table Enhancements ========== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Table row animations */
.table tbody tr {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Form Enhancements ========== */
.form-group.has-error .form-control {
    border-color: var(--danger);
    background-color: var(--danger-light);
}

.form-group.has-success .form-control {
    border-color: var(--success);
    background-color: var(--success-light);
}

.form-control.is-loading {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cstyle%3E.spinner%7Banimation:spin 1s linear infinite%7D@keyframes spin%7Bfrom%7Btransform:rotate(0deg)%7Dto%7Btransform:rotate(360deg)%7D%7D%3C/style%3E%3Ccircle class='spinner' cx='12' cy='12' r='10' fill='none' stroke='%232563eb' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 40px;
}

/* ========== Checkbox and Radio Styling ========== */
.form-check {
    padding-left: 0;
    margin-bottom: 12px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    margin-top: 3px;
    margin-right: 8px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem var(--primary-light);
}

.form-check-label {
    cursor: pointer;
    user-select: none;
    font-weight: 500;
    color: var(--gray-700);
}

/* ========== Dropdown Menu Enhancements ========== */
.dropdown-menu {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-sm);
    box-shadow: var(--shadow-lg);
    animation: dropdownSlideIn 0.2s ease;
}

@keyframes dropdownSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    padding: 10px 16px;
    font-size: 14px;
    color: var(--gray-700);
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background-color: var(--gray-50);
    color: var(--primary);
}

.dropdown-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
}

/* ========== Breadcrumb Enhancements ========== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 0;
}

.breadcrumb-item {
    font-size: 13px;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--gray-400);
    margin: 0 8px;
}

/* ========== Tab Navigation ========== */
.nav-tabs {
    border-bottom: 2px solid var(--gray-200);
    gap: 8px;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--gray-600);
    font-weight: 500;
    padding: 12px 16px;
    transition: var(--transition-fast);
    margin-bottom: -2px;
}

.nav-tabs .nav-link:hover {
    color: var(--primary);
    border-bottom-color: var(--primary-light);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: transparent;
}

/* ========== Accordion Styles ========== */
.accordion-button {
    padding: 16px 20px;
    font-weight: 500;
    color: var(--gray-900);
    background: var(--white);
    border: 1px solid var(--gray-200);
    transition: var(--transition-fast);
}

.accordion-button:not(.collapsed) {
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: none;
}

.accordion-button:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.25rem var(--primary-light);
}

.accordion-body {
    padding: 20px;
    background: var(--gray-50);
}

/* ========== Progress Bar Styles ========== */
.progress {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    transition: width 0.6s ease;
}

.progress-bar.bg-success {
    background: linear-gradient(90deg, var(--success), var(--success-hover)) !important;
}

.progress-bar.bg-danger {
    background: linear-gradient(90deg, var(--danger), var(--danger-hover)) !important;
}

.progress-bar.bg-warning {
    background: linear-gradient(90deg, var(--warning), var(--warning-hover)) !important;
}

/* ========== Tooltip Styles ========== */
.tooltip-inner {
    background: var(--gray-900);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 500;
}

.tooltip.show {
    opacity: 1;
}

/* ========== Popover Styles ========== */
.popover {
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

.popover-header {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    color: var(--gray-900);
}

.popover-body {
    color: var(--gray-700);
}

/* ========== Badge Enhancements ========== */
.badge {
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: var(--transition-fast);
}

.badge:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ========== Alert Enhancements ========== */
.alert {
    border-radius: var(--border-radius);
    border: 1px solid;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-dismissible .btn-close {
    padding: 0.375rem;
    transition: var(--transition-fast);
}

.alert-dismissible .btn-close:hover {
    opacity: 0.75;
}

/* ========== Card Enhancements ========== */
.card {
    transition: var(--transition);
    border: 1px solid var(--gray-200);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.card.card-hover-lift:hover {
    transform: translateY(-8px);
}

.card.card-flat {
    box-shadow: none;
    border: 1px solid var(--gray-200);
}

/* ========== List Group Styles ========== */
.list-group-item {
    border: 1px solid var(--gray-200);
    padding: 16px;
    transition: var(--transition-fast);
}

.list-group-item:hover {
    background: var(--gray-50);
}

.list-group-item.active {
    background: var(--primary);
    border-color: var(--primary);
}

/* ========== Spinner Animations ========== */
.spinner-border {
    border-width: 3px;
    animation: spin 0.75s linear infinite;
}

.spinner-grow {
    animation: grow 0.75s linear infinite;
}

@keyframes grow {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* ========== Skeleton Loading ========== */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 12px;
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* ========== Transition Utilities ========== */
.transition-all {
    transition: var(--transition);
}

.transition-fast {
    transition: var(--transition-fast);
}

.transition-none {
    transition: none;
}

/* ========== Transform Utilities ========== */
.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.hover-scale:hover {
    transform: scale(1.05);
}

.hover-shadow:hover {
    box-shadow: var(--shadow-xl);
}

/* ========== Visibility Utilities ========== */
.visible-xs {
    display: none;
}

.visible-sm {
    display: none;
}

.visible-md {
    display: none;
}

.visible-lg {
    display: block;
}

.hidden-xs {
    display: block;
}

.hidden-sm {
    display: block;
}

.hidden-md {
    display: block;
}

.hidden-lg {
    display: none;
}

/* ========== Responsive Breakpoints ========== */
/* 
 * Media Query Organization
 * Breakpoints organized in ascending order (mobile-first approach)
 * - Extra Small: < 480px (phones)
 * - Small: 480px - 767px (phones/small tablets)
 * - Medium: 768px - 1023px (tablets)
 * - Large: 1024px - 1399px (desktops)
 * - Extra Large: ≥ 1400px (large desktops)
 * 
 * Sidebar behavior:
 * - Hidden and slides in on mobile/tablet (<1024px)
 * - Always visible on desktop (≥1024px)
 * - Toggle button hidden on desktop, visible on mobile
 */

/* Extra Large (1400px and up) */
@media (min-width: 1400px) {
    .widgets-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large (1024px to 1399px) */
@media (max-width: 1399px) and (min-width: 1024px) {
    .widgets-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .visible-lg {
        display: none;
    }
    
    .visible-md {
        display: block;
    }
    
    .hidden-lg {
        display: block;
    }
    
    .hidden-md {
        display: none;
    }
}

/* Medium (768px to 1023px) */
@media (max-width: 1023px) and (min-width: 768px) {
    .widgets-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .content {
        padding: 20px;
    }
    
    .offcanvas {
        width: 80%;
        right: -80%;
    }
    
    .visible-md {
        display: block;
    }
    
    .visible-lg {
        display: none;
    }
    
    .hidden-md {
        display: none;
    }
    
    .hidden-lg {
        display: block;
    }
}

/* Small (480px to 767px) */
@media (max-width: 767px) and (min-width: 480px) {
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        padding: 0 16px;
        height: 60px;
    }
    
    .content {
        padding: 16px;
    }
    
    .page-title {
        font-size: 22px;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .widget {
        min-height: 120px;
        padding: 16px;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
    
    .table {
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 12px 10px;
    }
    
    .offcanvas {
        width: 100%;
        right: -100%;
    }
    
    .offcanvas-body {
        max-height: calc(100vh - 140px);
    }
    
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .page-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    .visible-sm {
        display: block;
    }
    
    .visible-md,
    .visible-lg {
        display: none;
    }
    
    .hidden-sm {
        display: none;
    }
    
    .hidden-md,
    .hidden-lg {
        display: block;
    }
}

/* Extra Small (below 480px) */
@media (max-width: 479px) {
    .main-content {
        margin-left: 0;
    }
    
    .content-header {
        padding: 0 12px;
        height: 56px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .content {
        padding: 12px;
    }
    
    .page-title {
        font-size: 20px;
    }
    
    .page-header {
        margin-bottom: 16px;
    }
    
    .page-header-top {
        flex-direction: column;
        gap: 12px;
    }
    
    .widgets-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .widget {
        min-height: 110px;
        padding: 12px;
    }
    
    .widget-value {
        font-size: 28px;
    }
    
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 12px;
        min-width: 600px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    .offcanvas {
        width: 100%;
        right: -100%;
    }
    
    .offcanvas-header {
        padding: 16px;
    }
    
    .offcanvas-body {
        padding: 16px;
        max-height: calc(100vh - 120px);
    }
    
    .offcanvas-footer {
        padding: 16px;
        gap: 8px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .btn-sm {
        padding: 4px 8px;
        font-size: 12px;
    }
    
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .filters {
        flex-direction: column;
        padding: 12px;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .page-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
    }
    
    .page-actions .btn {
        width: 100%;
    }
    
    .modal-dialog {
        width: 95%;
    }
    
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .visible-xs {
        display: block;
    }
    
    .visible-sm,
    .visible-md,
    .visible-lg {
        display: none;
    }
    
    .hidden-xs {
        display: none;
    }
    
    .hidden-sm,
    .hidden-md,
    .hidden-lg {
        display: block;
    }
}

/* ========== Print Styles ========== */
@media print {
    .sidebar,
    .content-header,
    .page-actions,
    .btn,
    .modal,
    .toast-container,
    .offcanvas {
        display: none !important;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .content {
        padding: 0;
    }
    
    body {
        background: var(--white);
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
        page-break-inside: avoid;
    }
    
    .table {
        border-collapse: collapse;
    }
    
    .table th,
    .table td {
        border: 1px solid var(--gray-300);
    }
}

/* ========== Accessibility ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode support in future */
}

/* ========== High Contrast Mode ========== */
@media (prefers-contrast: more) {
    :root {
        --gray-600: #333333;
        --gray-700: #1a1a1a;
        --gray-800: #000000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
}
