/* =====================================================
   نظام إدارة الأسطول — Custom Styles (RTL Arabic)
   ===================================================== */

/* ===== المتغيرات ===== */
:root {
    --primary:       #1a56db;
    --primary-dark:  #1048c0;
    --secondary:     #6366f1;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;
    --dark:          #0f172a;
    --surface:       #1e293b;
    --surface-2:     #273549;
    --border:        rgba(255,255,255,0.07);
    --text-muted:    #94a3b8;
    --font-arabic:   'Noto Kufi Arabic', 'Cairo', 'Segoe UI', sans-serif;
    --navbar-h:      64px;
    --sidebar-w:     260px;
    --radius:        12px;
    --radius-sm:     8px;
    --shadow:        0 4px 24px rgba(0,0,0,0.25);
    --shadow-sm:     0 2px 8px rgba(0,0,0,0.15);
    --transition:    all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-arabic);
    background: #0d1627;
    color: #e2e8f0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 0.93rem;
}

/* ===== Navbar ===== */
#mainNavbar {
    background: linear-gradient(135deg, var(--dark) 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
    height: var(--navbar-h);
    box-shadow: 0 2px 20px rgba(0,0,0,0.4);
    z-index: 1030;
}

#mainNavbar .navbar-brand { gap: 10px; }

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: white;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

.fs-xsmall { font-size: 0.7rem; }

.nav-link {
    color: rgba(255,255,255,0.75) !important;
    padding: 6px 12px !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.1) !important;
}

.nav-link.active {
    background: rgba(99,102,241,0.25) !important;
    border: 1px solid rgba(99,102,241,0.3);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    padding-top: 1.5rem;
}

/* ===== Cards ===== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow); }

.card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0 !important;
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ===== Stat Cards ===== */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--accent, var(--primary));
    border-radius: 0 var(--radius) var(--radius) 0;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--accent, var(--primary));
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    background: var(--accent-bg, rgba(26,86,219,0.15));
    color: var(--accent, var(--primary));
}

.stat-card .stat-value {
    font-size: 2.2rem;
    font-weight: 800;
    line-height: 1;
    color: #f1f5f9;
}

.stat-card .stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ===== Tables ===== */
.table {
    color: #e2e8f0;
    border-color: var(--border);
}

.table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-color: var(--border);
    padding: 0.9rem 1rem;
    white-space: nowrap;
}

.table tbody tr {
    border-color: var(--border);
    transition: var(--transition);
}

.table tbody tr:hover {
    background: rgba(255,255,255,0.03) !important;
}

.table tbody td {
    border-color: var(--border);
    padding: 0.9rem 1rem;
    vertical-align: middle;
}

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.38em 0.7em;
    border-radius: 6px;
}

.badge-status-active  { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge-status-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge-status-expired { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }

/* ===== Buttons ===== */
.btn {
    font-family: var(--font-arabic);
    font-weight: 600;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    font-size: 0.88rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    box-shadow: 0 4px 15px rgba(26,86,219,0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(26,86,219,0.5);
}

.btn-outline-light { border-color: var(--border); color: #e2e8f0; }
.btn-outline-light:hover { background: rgba(255,255,255,0.08); color: #fff; border-color: rgba(255,255,255,0.2); }

/* ===== Forms ===== */
.form-control,
.form-select,
input.form-control,
select.form-select,
textarea.form-control,
.input-group .form-control,
.input-group .form-select {
    background-color: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    color: #e2e8f0 !important;
    border-radius: var(--radius-sm);
    font-family: var(--font-arabic);
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus,
input.form-control:focus,
select.form-select:focus,
textarea.form-control:focus {
    background-color: var(--surface-2) !important;
    border-color: var(--primary) !important;
    color: #f1f5f9 !important;
    box-shadow: 0 0 0 3px rgba(26,86,219,0.2) !important;
}

/* autocomplete background fix */
input.form-control:-webkit-autofill,
input.form-control:-webkit-autofill:hover,
input.form-control:-webkit-autofill:focus {
    -webkit-text-fill-color: #e2e8f0 !important;
    -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
    transition: background-color 5000s ease-in-out 0s;
}

.form-control::placeholder,
textarea.form-control::placeholder,
input.form-control::placeholder {
    color: #64748b !important;
    opacity: 1;
}

.form-label {
    color: #cbd5e1 !important;
    font-weight: 600;
    font-size: 0.87rem;
    margin-bottom: 0.4rem;
}

/* make number inputs show light text */
input[type="number"].form-control,
input[type="date"].form-control,
input[type="email"].form-control,
input[type="tel"].form-control,
input[type="text"].form-control,
input[type="password"].form-control {
    color: #e2e8f0 !important;
    background-color: var(--surface-2) !important;
}

/* date picker icon color */
input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8);
    cursor: pointer;
}

.form-select option { background: var(--dark); color: #e2e8f0; }

.input-group-text {
    background-color: var(--surface-2) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-muted) !important;
}

/* Form Switch */
.form-check-input {
    background-color: var(--surface-2);
    border-color: var(--border);
}
.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}


/* ===== File Upload ===== */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--surface-2);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(26,86,219,0.05);
}

.upload-zone .upload-icon { font-size: 2.5rem; color: var(--text-muted); }

/* ===== Alert Banners ===== */
.alert {
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 500;
}

.alert-success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.alert-danger  { background: rgba(239,68,68,0.15);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.alert-warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.alert-info    { background: rgba(99,102,241,0.15); color: #a5b4fc; border: 1px solid rgba(99,102,241,0.3); }

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.page-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f1f5f9;
    margin: 0;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* ===== Breadcrumb ===== */
.breadcrumb { background: transparent; padding: 0; margin: 0; }
.breadcrumb-item a { color: var(--primary); text-decoration: none; }
.breadcrumb-item.active { color: var(--text-muted); }
.breadcrumb-item + .breadcrumb-item::before { color: var(--text-muted); }

/* ===== Pagination ===== */
.pagination .page-link {
    background: var(--surface);
    border-color: var(--border);
    color: #e2e8f0;
    border-radius: var(--radius-sm) !important;
    margin: 0 2px;
    transition: var(--transition);
}

.pagination .page-link:hover { background: var(--surface-2); border-color: var(--primary); color: #fff; }
.pagination .page-item.active .page-link { background: var(--primary); border-color: var(--primary); }
.pagination .page-item.disabled .page-link { background: var(--surface); color: #475569; }

/* ===== Dropdown ===== */
.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    min-width: 180px;
}

.dropdown-item { color: #e2e8f0; font-weight: 500; border-radius: var(--radius-sm); margin: 2px 4px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: #fff; }
.dropdown-divider { border-color: var(--border); }
.dropdown-header { color: var(--text-muted); font-size: 0.78rem; }

/* ===== License Status Row Colors ===== */
.row-expired  { background: rgba(239,68,68,0.06)  !important; }
.row-warning  { background: rgba(245,158,11,0.06) !important; }
.row-active   { background: transparent !important; }

.row-expired:hover  { background: rgba(239,68,68,0.1)  !important; }
.row-warning:hover  { background: rgba(245,158,11,0.1) !important; }

/* ===== License Image Preview ===== */
.license-preview {
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    cursor: zoom-in;
}

/* ===== Dashboard Chart Container ===== */
.chart-container {
    position: relative;
    height: 260px;
}

/* ===== Notification Item ===== */
.notif-item {
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
    transition: var(--transition);
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { border-right: 3px solid var(--primary); }

/* ===== Driver/Vehicle Image ===== */
.entity-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--surface-2), var(--surface));
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ===== Footer ===== */
.app-footer {
    background: var(--dark);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ===== Offcanvas ===== */
.offcanvas {
    background: var(--surface);
    border-left: 1px solid var(--border) !important;
    border-right: none !important;
}

.offcanvas .list-group-item {
    background: transparent;
    border-color: var(--border);
    color: #e2e8f0;
    padding: 0.85rem 1.25rem;
}

.offcanvas .list-group-item.active { background: rgba(99,102,241,0.2); border-color: var(--border); }
.offcanvas .list-group-item a { color: inherit; }

/* ===== Search Bar ===== */
.search-box .form-control {
    border-radius: 50px !important;
    padding-right: 2.5rem;
}

.search-box .bi-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* ===== Modal ===== */
.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.modal-header {
    border-bottom: 1px solid var(--border);
    background: var(--surface-2);
    border-radius: var(--radius) var(--radius) 0 0;
}

.modal-footer { border-top: 1px solid var(--border); }

.btn-close-white { filter: invert(1); }

/* ===== Skeleton Loading ===== */
.skeleton {
    background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.4s infinite;
    border-radius: 6px;
}

@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Utilities ===== */
.text-muted { color: var(--text-muted) !important; }
.bg-surface  { background: var(--surface)  !important; }
.bg-surface-2 { background: var(--surface-2) !important; }
.border-custom { border-color: var(--border) !important; }

.fw-800 { font-weight: 800 !important; }

.gap-xs { gap: 0.35rem !important; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--dark); }
::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #334155; }

/* ===== Animations ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up { animation: fadeInUp 0.4s ease forwards; }

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(26,86,219,0.4); }
    70%  { box-shadow: 0 0 0 8px rgba(26,86,219,0); }
    100% { box-shadow: 0 0 0 0 rgba(26,86,219,0); }
}

.pulse { animation: pulse-ring 2s infinite; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .stat-card .stat-value { font-size: 1.7rem; }
    .page-title { font-size: 1.25rem; }
    .table-responsive { border-radius: var(--radius-sm); }
}
