/* ============================================================= */
/* LOADING SPINNER                                              */
/* ============================================================= */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.spinner-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================= */
/* VALIDATION STATES                                            */
/* ============================================================= */
.form-control.is-valid {
    border-color: #10b981 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2310b981' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px !important;
}

.form-control.is-invalid {
    border-color: #ef4444 !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23ef4444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23ef4444' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px !important;
}

.invalid-feedback {
    display: none;
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 500;
}

.form-control.is-invalid ~ .invalid-feedback,
.was-validated .form-control:invalid ~ .invalid-feedback {
    display: block;
}

/* ============================================================= */
/* CONFIRM DIALOG                                               */
/* ============================================================= */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.confirm-overlay.active {
    opacity: 1;
    visibility: visible;
}

.confirm-dialog {
    background: white;
    border-radius: 16px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    transform: scale(0.9);
    transition: all 0.3s;
}

.confirm-overlay.active .confirm-dialog {
    transform: scale(1);
}

.confirm-dialog h4 {
    margin: 0 0 12px;
    color: #1e293b;
}

.confirm-dialog p {
    color: #64748b;
    margin-bottom: 20px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ============================================================= */
/* GLOBAL FORM & CARD STYLING - COMPACT & MODERN                */
/* ============================================================= */

.form-modern {
    margin: 1rem auto;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #e2e8f0;
}

.form-modern .input-group-text {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #64748b;
    font-size: 0.9rem;
    min-width: 40px;
    padding: 8px 12px;
}

.form-modern .form-control,
.form-modern .form-select {
    border-radius: 8px;
    border-color: #e2e8f0;
    font-size: 0.9rem;
    padding: 8px 12px;
    transition: all 0.2s;
}

.form-modern .input-group .form-control,
.form-modern .input-group .form-select {
    border-radius: 0 8px 8px 0;
    border-left: none;
}

.form-modern .form-control:focus,
.form-modern .form-select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-modern textarea.form-control {
    border-radius: 0 8px 8px 0;
}

.form-modern .form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.form-modern .text-danger { font-size: 0.85em; }

.form-modern .btn-success-modern {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    padding: 10px 20px;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.form-modern .btn-success-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Compact row spacing */
.form-modern .row { margin-bottom: 0; }
.form-modern .mb-3 { margin-bottom: 12px !important; }
.form-modern .mb-2 { margin-bottom: 8px !important; }

/* Section headers in forms */
.form-section {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e40af;
    margin: 15px 0 10px;
    padding-bottom: 5px;
    border-bottom: 2px solid #e2e8f0;
}

.form-section i { margin-right: 8px; }

/* Card-style form header */
.form-header {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
    padding: 15px 20px;
    margin: -20px -20px 20px -20px;
    border-radius: 12px 12px 0 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.form-header i { margin-right: 10px; }

/* Responsive */
@media (max-width: 768px) {
    .form-modern { padding: 15px; margin: 0.5rem; }
    .form-header { margin: -15px -15px 15px -15px; padding: 12px 15px; }
}

/* ============================================================= */
/* KEEP YOUR EXISTING STYLES BELOW (UNTOUCHED)                  */
/* ============================================================= */

/* Breadcrumbs */
.breadcrumb {
    background: #e9ecef;
    border-radius: 8px;
    padding: 12px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    font-size: 0.95rem;
}
.breadcrumb-item a {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}
.breadcrumb-item a:hover {
    color: #0056b3;
}
.breadcrumb-item.active {
    color: #343a40;
    font-weight: bold;
}
.breadcrumb-item i {
    margin-right: 6px;
    color: #6f42c1;
}
.breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d;
}
/* ============================================================= */
/* TABLES - MODERN, COMPACT, BEAUTIFUL                          */
/* ============================================================= */
.table-modern {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    margin-bottom: 1rem;
    font-size: 0.95rem;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.table-modern thead {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    color: white;
}

.table-modern th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border: none;
    white-space: nowrap;
}

.table-modern tbody tr {
    transition: all 0.15s ease;
    border-bottom: 1px solid #e2e8f0;
}

.table-modern tbody tr:last-child {
    border-bottom: none;
}

.table-modern tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.table-modern tbody tr:hover {
    background-color: #eff6ff;
}

.table-modern td {
    padding: 12px 16px;
    vertical-align: middle;
    color: #334155;
    border: none !important;
    border-bottom: 1px solid #e9ecef !important;
}

.table-modern tbody tr:last-child td {
    border-bottom: none !important;
}

.table-modern .badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.table-modern .badge.bg-success { background: linear-gradient(135deg, #10b981, #34d399) !important; }
.table-modern .badge.bg-secondary { background: linear-gradient(135deg, #64748b, #94a3b8) !important; }
.table-modern .badge.bg-warning { background: linear-gradient(135deg, #f59e0b, #fbbf24) !important; color: #1e293b !important; }
.table-modern .badge.bg-danger { background: linear-gradient(135deg, #ef4444, #f87171) !important; }
.table-modern .badge.bg-info { background: linear-gradient(135deg, #0ea5e9, #38bdf8) !important; }

/* Action Buttons in Table */
.table-modern .btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    margin: 0 2px;
    min-width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.table-modern .btn-sm i { margin: 0; }

/* DataTables Wrapper Styling */
.dataTables_wrapper {
    padding: 0;
    font-size: 0.95rem;
}

.dataTables_wrapper .dataTables_filter {
    margin-bottom: 15px;
}

.dataTables_wrapper .dataTables_filter input {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.95rem;
    margin-left: 8px;
    transition: all 0.2s;
    width: 250px;
}

.dataTables_wrapper .dataTables_filter input:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_length {
    padding-top: 12px;
}

.dataTables_wrapper .dataTables_length select {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.9rem;
    margin: 0 5px;
}

.dataTables_wrapper .dataTables_info {
    font-size: 0.9rem;
    color: #64748b;
    padding-top: 14px;
}

.dataTables_wrapper .dataTables_paginate {
    padding-top: 12px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
    padding: 8px 14px;
    margin: 0 3px;
    border-radius: 6px;
    border: 1px solid #e2e8f0 !important;
    background: white !important;
    color: #64748b !important;
    font-size: 0.9rem;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: #f1f5f9 !important;
    color: #1e293b !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #3b82f6, #1e40af) !important;
    color: white !important;
    border-color: #3b82f6 !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
    opacity: 0.5;
}

/* Export Buttons - Fixed Height */
.dt-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.dt-buttons .btn {
    padding: 8px 16px !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px !important;
    line-height: 1 !important;
}

.dt-buttons .btn i { font-size: 0.9rem; }

.dt-buttons .buttons-excel {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border: none !important;
    color: white !important;
}

.dt-buttons .buttons-pdf {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    border: none !important;
    color: white !important;
}

.dt-buttons .buttons-print {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed) !important;
    border: none !important;
    color: white !important;
}

.dt-buttons .buttons-csv {
    background: linear-gradient(135deg, #0ea5e9, #0284c7) !important;
    border: none !important;
    color: white !important;
}

.dt-buttons .buttons-copy {
    background: linear-gradient(135deg, #64748b, #475569) !important;
    border: none !important;
    color: white !important;
}

/* Table Card Wrapper */
.table-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    padding: 20px;
    margin-bottom: 30px;
}

.table-card .table-modern {
    box-shadow: none;
    margin-bottom: 0;
}

/* DataTables inside table-card - fix search alignment */
.table-card .dataTables_wrapper .row:first-child {
    margin-bottom: 15px;
}

.table-card .dataTables_filter {
    text-align: left !important;
    float: none !important;
}

.table-card .dataTables_filter label {
    display: flex;
    align-items: center;
    margin: 0;
}

/* Page bottom spacing */
.content-wrapper, .container-fluid {
    padding-bottom: 40px;
}

/* ============================================================= */
/* STATS CARDS - COMPACT & COLORFUL                              */
/* ============================================================= */
.stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
    min-width: 100px;
    flex: 1;
    border-left: 3px solid;
    transition: all 0.2s ease;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.stat-card .stat-icon {
    font-size: 1rem;
    margin-bottom: 4px;
    transition: transform 0.2s ease;
}

.stat-card:hover .stat-icon {
    transform: scale(1.2);
}

.stat-card .stat-num {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1px;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.65rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Colorful variations */
.stat-card.blue {
    border-left-color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}
.stat-card.blue:hover { background: linear-gradient(135deg, #bfdbfe 0%, #93c5fd 100%); }
.stat-card.blue .stat-icon, .stat-card.blue .stat-num { color: #1d4ed8; }

.stat-card.green {
    border-left-color: #059669;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
}
.stat-card.green:hover { background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%); }
.stat-card.green .stat-icon, .stat-card.green .stat-num { color: #047857; }

.stat-card.purple {
    border-left-color: #7c3aed;
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
}
.stat-card.purple:hover { background: linear-gradient(135deg, #ddd6fe 0%, #c4b5fd 100%); }
.stat-card.purple .stat-icon, .stat-card.purple .stat-num { color: #6d28d9; }

.stat-card.orange {
    border-left-color: #d97706;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
}
.stat-card.orange:hover { background: linear-gradient(135deg, #fde68a 0%, #fcd34d 100%); }
.stat-card.orange .stat-icon, .stat-card.orange .stat-num { color: #b45309; }

.stat-card.red {
    border-left-color: #dc2626;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}
.stat-card.red:hover { background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%); }
.stat-card.red .stat-icon, .stat-card.red .stat-num { color: #b91c1c; }

.stat-card.teal {
    border-left-color: #0d9488;
    background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%);
}
.stat-card.teal:hover { background: linear-gradient(135deg, #99f6e4 0%, #5eead4 100%); }
.stat-card.teal .stat-icon, .stat-card.teal .stat-num { color: #0f766e; }

.stat-card.pink {
    border-left-color: #db2777;
    background: linear-gradient(135deg, #fce7f3 0%, #fbcfe8 100%);
}
.stat-card.pink:hover { background: linear-gradient(135deg, #fbcfe8 0%, #f9a8d4 100%); }
.stat-card.pink .stat-icon, .stat-card.pink .stat-num { color: #be185d; }

.stat-card.gray {
    border-left-color: #475569;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
}
.stat-card.gray:hover { background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%); }
.stat-card.gray .stat-icon, .stat-card.gray .stat-num { color: #334155; }

@media (max-width: 768px) {
    .stats-row { gap: 6px; }
    .stat-card { min-width: 80px; padding: 8px 10px; }
    .stat-card .stat-num { font-size: 0.95rem; }
    .stat-card .stat-icon { font-size: 0.85rem; }
}

/* Responsive */
@media (max-width: 768px) {
    .table-modern { font-size: 0.9rem; }
    .table-modern th, .table-modern td { padding: 10px 12px; }
    .dt-buttons .btn { padding: 6px 12px !important; font-size: 0.85rem !important; height: 34px !important; }
    .dataTables_wrapper .dataTables_filter input { width: 180px; }
}

/* ============================================================= */
/* BUTTONS - MODERN COMPACT GRADIENT                            */
/* ============================================================= */
.btn {
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: white !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn i {
    font-size: 0.85rem;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.btn-primary-modern { background: linear-gradient(135deg, #3b82f6, #1e40af); }
.btn-success-modern { background: linear-gradient(135deg, #10b981, #059669); }
.btn-warning-modern { background: linear-gradient(135deg, #f59e0b, #d97706); }
.btn-danger-modern { background: linear-gradient(135deg, #ef4444, #dc2626); }
.btn-info-modern { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
.btn-print-modern { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.btn-pdf-modern { background: linear-gradient(135deg, #ec4899, #db2777); }
.btn-secondary { background: linear-gradient(135deg, #64748b, #475569); }

/* Small buttons */
.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-sm i {
    font-size: 0.75rem;
}

/* Cards (for dashboard) */
.dashboard-card {
    border: none;
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: white;
    margin-bottom: 20px;
}
.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}
.dashboard-card .card-body {
    padding: 20px;
    display: flex;
    align-items: center;
}
.dashboard-card .card-icon {
    font-size: 2.2rem;
    margin-right: 12px;
}
.dashboard-card h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.dashboard-card h3 {
    margin: 8px 0 0;
    font-size: 1.6rem;
    font-weight: bold;
}
.gradient-blue { background: linear-gradient(45deg, #007bff, #00d4ff); }
.gradient-green { background: linear-gradient(45deg, #28a745, #34c759); }
.gradient-purple { background: linear-gradient(45deg, #6f42c1, #9f7aea); }
.gradient-orange { background: linear-gradient(45deg, #fd7e14, #ff9f43); }
.gradient-red { background: linear-gradient(45deg, #dc3545, #ff6b6b); }
.gradient-teal { background: linear-gradient(45deg, #20c997, #2ee4b5); }

/* Chart Containers */
.chart-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

/* Alerts */
.alert {
    border-radius: 8px;
    padding: 15px;
    animation: fadeIn 0.5s ease-in;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Login and Signup Forms */
.auth-card {
    max-width: 400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 20px;
}
.auth-card h3 {
    color: #343a40;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}
.auth-form .input-group-text {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #6f42c1;
}
.auth-form .form-control {
    border-radius: 0 8px 8px 0;
    border-left: none;
}
.auth-form .form-control:focus {
    border-color: #28a745;
    box-shadow: 0 0 6px rgba(40,167,69,0.3);
}
.auth-form .form-group {
    margin-bottom: 1rem;
}
.auth-form .btn-success-modern {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
}
.auth-form .text-center a {
    color: #007bff;
    font-weight: 500;
}
.auth-form .text-center a:hover {
    color: #0056b3;
}

/* Input Groups for Forms */
.input-group-text {
    background: #f8f9fa;
    border: 1px solid #ced4da;
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: #6f42c1;
    min-width: 45px;
    text-align: center;
}
.input-group .form-control, .input-group select, .input-group textarea {
    border-left: none;
    border-radius: 0 8px 8px 0;
}
.input-group .form-control:focus, .input-group select:focus, .input-group textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 6px rgba(0,123,255,0.3);
}