:root {
    --primary-color: #1e40af;
    --primary-dark: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}
body {
    background-color: #f8fafc;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.navbar {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: white !important;
}
.navbar-nav .nav-link {
    color: rgba(255,255,255,0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: all 0.3s;
}
.navbar-nav .nav-link:hover {
    color: white !important;
    background-color: rgba(255,255,255,0.1);
    border-radius: 5px;
}
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}
.card-header {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    border-radius: 15px 15px 0 0 !important;
    padding: 1.25rem;
    font-weight: 600;
}
.btn {
    border-radius: 8px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.3s;
}
.btn-primary {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    border: none;
}
.btn-primary:hover {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.4);
}
.table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
}
.table thead {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
}
.table tbody tr {
    transition: background-color 0.3s;
}
.table tbody tr:hover {
    background-color: #f1f5f9;
}
.badge {
    padding: 0.5em 0.75em;
    font-weight: 500;
}
.stats-card {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
}
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 0.5rem 0.75rem;
    font-size: 0.95rem;
}
.form-control:focus, .form-select:focus {
    border-color: #1e40af;
    box-shadow: 0 0 0 0.2rem rgba(30, 64, 175, 0.25);
    outline: none;
}

/* Better form styling */
.form-label {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #334155;
}

.form-control, .form-select {
    max-width: 100%;
}

@media (min-width: 992px) {
    .form-control, .form-select {
        max-width: 100%;
    }
}

/* RTL for select elements */
.form-select {
    direction: rtl;
    text-align: right;
    padding-left: 2.5rem;
    padding-right: 0.75rem;
    background-position: left 0.75rem center;
    background-size: 16px 12px;
}
.form-select option {
    direction: rtl;
    text-align: right;
}
select.form-select {
    padding-left: 2.5rem !important;
    padding-right: 0.75rem !important;
}
.alert {
    border-radius: 10px;
    border: none;
}
.avatar-sm {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    font-size: 18px;
    flex-shrink: 0;
}

/* Action buttons styling */
.d-flex.gap-2 {
    gap: 0.5rem;
}

.btn-sm.d-flex {
    line-height: 1;
    min-width: 36px;
}

/* Responsive improvements */
@media (max-width: 576px) {
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .h-md-2 {
        font-size: 1.5rem;
    }
    
    .h-md-3 {
        font-size: 1.75rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }
}

@media (min-width: 576px) {
    .h-md-2 {
        font-size: 2rem;
    }
    
    .h-md-3 {
        font-size: 3rem;
    }
}

/* Ensure tables are scrollable on small screens */
.table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Better spacing on mobile */
@media (max-width: 767.98px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
}

/* Enhanced validation error styling */
.is-invalid {
    border-color: #dc3545 !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='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.8 3.6 .4.4L6.4 6l.2 2.4'/%3e%3c/svg%3e") !important;
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
    padding-left: calc(1.5em + 0.75rem);
}

.form-select.is-invalid {
    padding-left: 2.5rem !important;
    background-position: left 0.75rem center, left 2.5rem center;
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.375rem;
    font-size: 0.875rem;
    color: #dc3545;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    background-color: #fff5f5;
    border: 1px solid #fecaca;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
}

.invalid-feedback i {
    margin-left: 0.25rem;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

/* Bootstrap Primary Color Override */
.btn-primary,
.bg-primary,
.badge-primary,
.border-primary,
.text-primary {
    --bs-primary-rgb: 30, 64, 175;
}

.btn-primary {
    --bs-btn-bg: #1e40af;
    --bs-btn-border-color: #1e40af;
    --bs-btn-hover-bg: #1e3a8a;
    --bs-btn-hover-border-color: #1e3a8a;
    --bs-btn-active-bg: #1e3a8a;
    --bs-btn-active-border-color: #1e3a8a;
}

.bg-primary {
    background-color: #1e40af !important;
}

.border-primary {
    border-color: #1e40af !important;
}

.text-primary {
    color: #1e40af !important;
}

.btn-outline-primary {
    --bs-btn-color: #1e40af;
    --bs-btn-border-color: #1e40af;
    --bs-btn-hover-bg: #1e40af;
    --bs-btn-hover-border-color: #1e40af;
    --bs-btn-active-bg: #1e40af;
    --bs-btn-active-border-color: #1e40af;
}

/* Flatpickr RTL styling */
.flatpickr-calendar {
    direction: rtl !important;
    font-family: inherit;
}

.flatpickr-input {
    direction: rtl;
    text-align: right;
}

.flatpickr-months {
    direction: rtl;
}

.flatpickr-weekdays {
    direction: rtl;
}

.flatpickr-days {
    direction: rtl;
}

.flatpickr-day {
    direction: rtl;
}

.flatpickr-prev-month,
.flatpickr-next-month {
    direction: rtl;
}

/* Make sure the alt input (readable date) is styled properly */
input.flatpickr-input[readonly] {
    background-color: #fff;
    cursor: pointer;
}

/* Flatpickr alt input styling */
.flatpickr-input.altInput {
    direction: rtl;
    text-align: right;
    padding: 0.5rem 0.75rem;
}

/* Ensure calendar opens in RTL */
.flatpickr-calendar.arrowTop:before {
    right: 15px;
    left: auto;
}

.flatpickr-calendar.arrowTop:after {
    right: 16px;
    left: auto;
}

.flatpickr-calendar.arrowBottom:before {
    right: 15px;
    left: auto;
}

.flatpickr-calendar.arrowBottom:after {
    right: 16px;
    left: auto;
}

