/* Modern Dark Theme Variables */
:root {
    --bg-primary: #0f172a;
    /* Slate 900 */
    --bg-secondary: #1e293b;
    /* Slate 800 */
    --accent-primary: #3b82f6;
    /* Blue 500 */
    --accent-secondary: #6366f1;
    /* Indigo 500 */
    --text-primary: #f8fafc;
    /* Slate 50 */
    --text-secondary: #94a3b8;
    /* Slate 400 */
    --success: #10b981;
    /* Emerald 500 */
    --warning: #f59e0b;
    /* Amber 500 */
    --danger: #ef4444;
    /* Red 500 */
    --card-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

/* Body Background */
body {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Inter', 'Cairo', sans-serif;
}

/* Glassmorphism Styles */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.glass-panel:hover {
    background: rgba(30, 41, 59, 0.85);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.glass-header {
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
}

/* Modern Loader */
.loader {
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-secondary);
    animation: spin 1s ease-in-out infinite;
}

.border-3 {
    border-width: 3px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Text Gradient */
.text-gradient {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Fade-in Animation */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scale-in Animation for Modals */
.animate-scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Form Inputs - Improved */
.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-input::placeholder {
    color: rgba(148, 163, 184, 0.5);
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    outline: none;
    background-color: rgba(15, 23, 42, 0.8);
}

.form-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Buttons - Improved */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.875rem 1.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(51, 65, 85, 0.6);
    color: white;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(51, 65, 85, 0.8);
    border-color: rgba(148, 163, 184, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

/* Utility background classes */
.bg-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.bg-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.bg-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

/* Select2 Dark Theme */
.select2-container--default .select2-selection--single {
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.5rem;
    height: 46px;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--text-primary);
    line-height: 44px;
    padding-left: 1rem;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 44px;
}

.select2-dropdown {
    background-color: var(--bg-secondary);
    border: 1px solid var(--glass-border);
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: var(--accent-primary);
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    background-color: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 0.25rem;
}

/* SweetAlert2 Dark Theme */
.swal2-popup {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--glass-border) !important;
    border-radius: 1rem !important;
}

.swal2-title {
    color: var(--text-primary) !important;
}

.swal2-html-container {
    color: var(--text-secondary) !important;
}

.swal2-confirm {
    background-color: var(--accent-primary) !important;
}

/* Alerts Container */
#alerts {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 9999;
    max-width: 400px;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-secondary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Utility Classes */
.cursor-pointer {
    cursor: pointer;
}

.underline {
    text-decoration: underline;
}

/* Card Hover Effects */
.card-action-add {
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--glass-border);
    color: var(--text-secondary);
    transition: all 0.2s;
}

.card-action-add:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.hidden {
    display: none;
}

/* Admin Dashboard Specific Styles */
#stats-cards > div {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both;
}

#stats-cards > div:nth-child(1) { animation-delay: 0.1s; }
#stats-cards > div:nth-child(2) { animation-delay: 0.2s; }
#stats-cards > div:nth-child(3) { animation-delay: 0.3s; }
#stats-cards > div:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card utilities */
.card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 1rem;
}

/* Form label */
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(203, 213, 225);
    margin-bottom: 0.5rem;
}

/* Table row animations */
#users-table-body tr {
    animation: fadeIn 0.3s ease-out;
}

/* Refresh button animation */
#refresh-btn.rotating {
    animation: spin 1s linear infinite;
}

/* Hover effects for stats cards */
#stats-cards > div {
    transform-style: preserve-3d;
    perspective: 1000px;
}

#stats-cards > div:hover {
    transform: translateY(-4px) scale(1.02);
}

/* Smooth transitions for all interactive elements */
button, input, textarea, select {
    transition: all 0.2s ease-in-out;
}

/* Focus visible for accessibility */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Glass card effect for dashboard */
.glass-card {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Table improvements */
#users-table-body tr {
    transition: all 0.2s ease;
}

#users-table-body tr:hover {
    transform: translateX(2px);
}

/* Stats cards compact */
#stats-cards > div {
    min-height: auto;
}

/* Table header improvements */
table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Smooth scroll for table */
.overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.3) transparent;
}

.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.3);
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 3px;
}

.overflow-x-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.7);
}