/*
 * Driver Dashboard – Apple-Inspired Design System
 * Clean, minimal, professional
 */

/* Self-hosted Arabic font (fallback to system stack if unavailable) */
@font-face {
    font-family: "Noto Kufi Arabic";
    src: local("Noto Kufi Arabic"), local("NotoKufiArabic-Regular"),
         url("../fonts/NotoKufiArabic-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Noto Kufi Arabic";
    src: local("Noto Kufi Arabic Bold"), local("NotoKufiArabic-Bold"),
         url("../fonts/NotoKufiArabic-Bold.ttf") format("truetype");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ========================
   Design Tokens
   ======================== */
:root {
    /* Typography - Noto Kufi Arabic with robust fallbacks */
    --font-display: "Noto Kufi Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-text: "Noto Kufi Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    
    /* Type Scale - optimized for clarity */
    --text-xs: 0.8125rem;    /* 13px - captions */
    --text-sm: 0.9375rem;    /* 15px - body small */
    --text-base: 1rem;       /* 16px - body */
    --text-lg: 1.0625rem;    /* 17px - body large */
    --text-xl: 1.25rem;      /* 20px - subheadings */
    --text-2xl: 1.5rem;      /* 24px - headings */
    --text-3xl: 1.75rem;     /* 28px - page titles */
    --text-title: 1.375rem;  /* 22px - numbers/titles */
    --text-4xl: 2rem;        /* 32px - hero */
    
    /* Line Heights */
    --leading-tight: 1.2;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    
    /* Font Weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    
    /* Colors - Neutral Palette */
    --gray-50: #fafafa;
    --gray-100: #f5f5f5;
    --gray-200: #e5e5e5;
    --gray-300: #d4d4d4;
    --gray-400: #a3a3a3;
    --gray-500: #737373;
    --gray-600: #525252;
    --gray-700: #404040;
    --gray-800: #262626;
    --gray-900: #171717;
    
    /* Colors - Accent (Primary) */
    --blue-50: #f5f1f9;   /* light tint for backgrounds */
    --blue-100: #ebe4f1;  /* focus ring */
    --blue-500: #6f5880;  /* mid shade */
    --blue-600: #644E76;  /* primary */
    --blue-700: #523E61;  /* hover */
    
    /* Colors - Semantic */
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-600: #16a34a;
    --green-700: #15803d;
    
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    
    --amber-50: #fffbeb;
    --amber-600: #d97706;
    
    /* Spacing - 8px base unit */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */
    
    /* Border Radius */
    --radius-sm: 0.375rem;   /* 6px */
    --radius-md: 0.5rem;     /* 8px */
    --radius-lg: 0.75rem;    /* 12px */
    --radius-xl: 1rem;       /* 16px */
    --radius-2xl: 1.5rem;    /* 24px */
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    /* Transitions */
    --duration-fast: 150ms;
    --duration-normal: 200ms;
    --duration-slow: 300ms;
    --ease-out: cubic-bezier(0, 0, 0.2, 1);
    --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================
   Base Styles
   ======================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-text);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--gray-900);
    background-color: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    line-height: var(--leading-tight);
    font-weight: var(--weight-semibold);
}

h1, .h1 { font-size: var(--text-4xl); }
h2, .h2 { font-size: var(--text-3xl); }
h3, .h3 { font-size: var(--text-2xl); }
h4, .h4 { font-size: var(--text-xl); }
h5, .h5 { font-size: var(--text-lg); }
h6, .h6 { font-size: var(--text-base); }

/* ========================
   Layout Components
   ======================== */

/* Background */
.bg-gradient {
    background: var(--gray-100);
}

/* Navbar */
.navbar {
    height: 64px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--gray-200);
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
}

.navbar .container-fluid {
    gap: var(--space-6);
}

.navbar .container {
    gap: var(--space-6);
}

.navbar-brand {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    color: var(--gray-900);
    margin: 0;
}

.navbar-brand:hover {
    color: var(--gray-900);
}

/* Logo Icons */
.logo-icon {
    width: 56px;
    height: 56px;
    background: var(--blue-600);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.logo-icon i {
    font-size: 1.75rem;
    color: white;
}

.logo-icon-sm {
    width: 36px;
    height: 36px;
    background: var(--blue-600);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-icon-sm i {
    font-size: 1.125rem;
    color: white;
}

/* Fit logo image in existing containers */
.logo-icon img,
.logo-icon-sm img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: inherit;
}

/* Avatar */
.avatar-circle {
    width: 36px;
    height: 36px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-700);
    font-weight: var(--weight-medium);
    font-size: var(--text-sm);
}

/* Navbar spacing utilities */
.navbar .gap-3 {
    gap: var(--space-4) !important;
}

/* ========================
   Cards
   ======================== */

.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: all var(--duration-normal) var(--ease-out);
}

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

/* Stat Cards */
.stat-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--gray-300);
}

.stat-card h3 {
    font-family: var(--font-display);
    font-size: var(--text-title);
    font-weight: var(--weight-semibold);
    line-height: 1;
}

.stat-card p {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin: 0;
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon i {
    font-size: 1.25rem; /* 20px */
}

/* Driver Cards */
.driver-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    transition: box-shadow var(--duration-normal) var(--ease-out),
                border-color var(--duration-normal) var(--ease-out);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.driver-card:hover {
    box-shadow: var(--shadow-sm);
    border-color: var(--gray-300);
}

.driver-card .card-body {
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    flex: 1;
}

.driver-avatar {
    width: 44px;
    height: 44px;
    background: var(--blue-600);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-family: var(--font-display);
    font-weight: var(--weight-semibold);
    font-size: var(--text-lg);
}

.driver-card h5 {
    font-size: var(--text-lg);
    font-weight: var(--weight-semibold);
    color: var(--gray-900);
}

.driver-card .text-muted {
    color: var(--gray-600);
}

.driver-card .small {
    font-size: var(--text-sm);
}

/* ========================
   Forms & Inputs
   ======================== */

.form-label {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.form-control {
    font-family: var(--font-text);
    font-size: var(--text-base);
    height: 44px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    background: white;
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.form-control:focus {
    border-color: var(--blue-500);
    box-shadow: 0 0 0 3px var(--blue-100);
    outline: none;
}

.form-control::placeholder {
    color: var(--gray-400);
}

.form-control-lg {
    height: 48px;
    font-size: var(--text-lg);
}

/* ========================
   Buttons
   ======================== */

.btn {
    font-family: var(--font-text);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
}

.btn:active {
    transform: scale(0.98);
}

/* Primary Button */
.btn-primary {
    background: var(--blue-600);
    color: white;
}

.btn-primary:hover {
    background: var(--blue-700);
    color: white;
}

.btn-primary:focus {
    box-shadow: 0 0 0 3px var(--blue-100);
    outline: none;
}

/* Secondary/Outline Buttons */
.btn-outline-primary {
    background: transparent;
    border: 1px solid var(--blue-600);
    color: var(--blue-600);
}

.btn-outline-primary:hover {
    background: var(--blue-50);
    border-color: var(--blue-700);
    color: var(--blue-700);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-outline-success {
    background: transparent;
    border: 1px solid var(--green-600);
    color: var(--green-600);
}

.btn-outline-success:hover {
    background: var(--green-50);
    color: var(--green-700);
}

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--red-600);
    color: var(--red-600);
}

.btn-outline-danger:hover {
    background: var(--red-50);
    color: var(--red-700);
}

/* Button Sizes */
.btn-sm {
    font-size: var(--text-sm);
    padding: var(--space-2) var(--space-3);
    height: 32px;
}

.btn-lg {
    font-size: var(--text-lg);
    padding: var(--space-4) var(--space-6);
    height: 48px;
}

/* Light Buttons */
.btn-light {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    color: var(--gray-700);
}

.btn-light:hover {
    background: var(--gray-200);
    color: var(--gray-800);
}

/* Secondary Solid Button */
.btn-secondary {
    background: var(--gray-200);
    color: var(--gray-800);
}

.btn-secondary:hover {
    background: var(--gray-300);
    color: var(--gray-900);
}

/* Rounded Circle Button */
/* Do not size global rounded-circle; keep it only for shape */
.rounded-circle { border-radius: var(--radius-full); padding: 0; }

/* Icon button size */
.icon-button { width: 36px; height: 36px; border-radius: var(--radius-full); padding: 0; }

/* ========================
   Badges
   ======================== */

.badge {
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
}

.badge.bg-success {
    background: var(--green-600);
    color: white;
}

.badge.bg-secondary {
    background: var(--gray-500);
    color: white;
}

.badge.bg-danger {
    background: var(--red-600);
    color: white;
}

/* ========================
   Modal
   ======================== */

.modal-content {
    border: none;
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}

.modal-header {
    border-bottom: 1px solid var(--gray-200);
    padding: var(--space-6);
}

.modal-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--gray-900);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    border-top: 1px solid var(--gray-200);
    padding: var(--space-6);
    gap: var(--space-3);
}

.btn-close {
    opacity: 0.5;
}

.btn-close:hover {
    opacity: 1;
}

/* ========================
   Alerts
   ======================== */

.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-sm);
}

.alert-danger {
    background: var(--red-50);
    border-color: var(--red-200);
    color: var(--red-700);
}

/* Tint utilities for icon containers */
.tint-blue { background: var(--blue-100); color: var(--blue-600); }
.tint-green { background: var(--green-100); color: var(--green-600); }
.tint-gray { background: var(--gray-200); color: var(--gray-600); }

/* Page title and modal title sizes */
.page-title { 
    font-size: var(--text-2xl); 
    line-height: var(--leading-tight);
    font-weight: var(--weight-semibold);
}

/* Search input styling */
#searchInput { 
    border-radius: var(--radius-lg);
    border-color: var(--gray-200);
    background-color: var(--gray-50);
    box-shadow: none;
}

#searchInput:focus {
    border-color: var(--blue-500);
    background-color: white;
    box-shadow: 0 0 0 3px var(--blue-100);
}

/* Empty state icon */
.empty-icon { font-size: 4rem; color: var(--gray-300); margin-bottom: 1.5rem; }

/* Driver card info block - fixed height for consistency */
.driver-info { 
    min-height: 5.5rem; 
    flex: 1;
}
.driver-info i { margin-left: var(--space-2); }

/* Content container max width */
.content-container { 
    max-width: 1200px; 
    margin: 0 auto;
}

/* Caption-sized text */
.text-caption { font-size: var(--text-xs); }

/* Hide empty status indicators */
.driver-card .status-indicator:empty,
.driver-card .badge:empty {
    display: none;
}

/* ========================
   Utilities
   ======================== */

.text-muted {
    color: var(--gray-600);
}

.text-success {
    color: var(--green-600);
}

.text-secondary {
    color: var(--gray-600);
}

.fw-bold {
    font-weight: var(--weight-bold);
}

.fw-semibold {
    font-weight: var(--weight-semibold);
}

.fw-medium {
    font-weight: var(--weight-medium);
}

.rounded-4 {
    border-radius: var(--radius-xl);
}

/* Spacing utilities */
.gap-2 {
    gap: var(--space-2);
}

.gap-3 {
    gap: var(--space-3);
}

/* ========================
   Loading & Empty States
   ======================== */

.spinner-border {
    color: var(--blue-600);
}

/* ========================
   Scrollbar
   ======================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* ========================
   Responsive
   ======================== */

@media (max-width: 768px) {
    :root {
        --text-4xl: 1.75rem;   /* 28px */
        --text-3xl: 1.5rem;    /* 24px */
        --text-2xl: 1.25rem;   /* 20px */
    }
    
    .navbar {
        height: 56px;
    }
    
    .stat-card h3 {
        font-size: var(--text-xl);
    }
    
    .driver-card {
        margin-bottom: var(--space-4);
    }
}

/* ========================
   Accessibility
   ======================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid var(--blue-500);
    outline-offset: 2px;
}

button:focus-visible,
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--blue-100);
}
