/* ==========================================
   A.A Hasaoot CRM - Main Stylesheet
   RTL Hebrew | Heebo Font
   ========================================== */

:root {
    --primary: #1a5276;
    --primary-dark: #0e3d5a;
    --primary-light: #2980b9;
    --accent: #f39c12;
    --accent-dark: #d68910;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --bg: #f0f3f7;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --text-muted: #95a5a6;
    --border: #e1e8ed;
    --border-light: #f0f3f7;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Heebo', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    direction: rtl;
}

.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c0c5ce; border-radius: 3px; }

/* ==========================================
   TOP HEADER
   ========================================== */
.top-header {
    position: fixed;
    top: 0;
    right: var(--sidebar-width);
    left: 0;
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 100;
}

.hamburger {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text);
    cursor: pointer;
    padding: 4px;
}

.header-search {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.header-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.header-search input {
    width: 100%;
    padding: 8px 38px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    background: var(--bg);
    transition: var(--transition);
}
.header-search input:focus {
    outline: none;
    border-color: var(--primary-light);
    background: #fff;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: auto;
}

.btn-new-ride {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.btn-new-ride:hover { background: var(--accent-dark); }

.header-user {
    position: relative;
    cursor: pointer;
}
.header-user .user-name {
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.header-user:hover .user-name { background: var(--bg); }
.header-user .user-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 200;
    overflow: hidden;
}
.header-user:hover .user-dropdown { display: block; }
.header-user .user-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
    font-size: 13px;
}
.header-user .user-dropdown a:hover { background: var(--bg); }

/* ==========================================
   SIDEBAR
   ========================================== */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: var(--transition);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
}
.sidebar-logo i { font-size: 24px; color: var(--accent); }
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.nav-section { margin-bottom: 8px; }
.nav-section-title {
    padding: 8px 20px 4px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.4);
    font-weight: 600;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    font-weight: 400;
    transition: var(--transition);
    border-right: 3px solid transparent;
}
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-right-color: var(--accent);
    font-weight: 600;
}
.nav-item i { font-size: 18px; width: 22px; text-align: center; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}
.user-name-small { font-size: 13px; font-weight: 500; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.5); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 150;
}

/* ==========================================
   MAIN CONTENT
   ========================================== */
.main-content {
    margin-right: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    flex: 1;
    min-height: calc(100vh - var(--header-height));
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
}
.page-subtitle {
    font-size: 14px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ==========================================
   STAT CARDS
   ========================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}
.stat-icon.blue { background: rgba(52,152,219,0.12); color: var(--info); }
.stat-icon.green { background: rgba(39,174,96,0.12); color: var(--success); }
.stat-icon.orange { background: rgba(243,156,18,0.12); color: var(--accent); }
.stat-icon.red { background: rgba(231,76,60,0.12); color: var(--danger); }
.stat-info h3 { font-size: 26px; font-weight: 700; line-height: 1.2; }
.stat-info p { font-size: 13px; color: var(--text-light); }

/* ==========================================
   CARDS & PANELS
   ========================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 600;
    font-size: 16px;
}
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ==========================================
   TABLES
   ========================================== */
.table-responsive { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th {
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    vertical-align: middle;
}
.data-table tr:hover td { background: rgba(52,152,219,0.03); }
.data-table tr.clickable { cursor: pointer; }

/* ==========================================
   BADGES
   ========================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}
.bg-primary { background: var(--primary); color: #fff; }
.bg-success { background: rgba(39,174,96,0.12); color: var(--success); }
.bg-warning { background: rgba(243,156,18,0.12); color: var(--accent-dark); }
.bg-danger { background: rgba(231,76,60,0.12); color: var(--danger); }
.bg-info { background: rgba(52,152,219,0.12); color: var(--info); }
.bg-secondary { background: rgba(149,165,166,0.15); color: var(--text-light); }

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); border-color: var(--primary-light); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ==========================================
   FORMS
   ========================================== */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text);
}
.form-control {
    width: 100%;
    padding: 9px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    background: #fff;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }
textarea.form-control { min-height: 80px; resize: vertical; }
/* Normalize date/time/number inputs on iOS */
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="number"].form-control {
    -webkit-appearance: none;
    appearance: none;
    background-color: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 42px;
    font-family: 'Heebo', sans-serif;
    font-size: 14px;
    color: var(--text);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}
.form-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ==========================================
   FILTERS BAR
   ========================================== */
.filters-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.filter-tab {
    padding: 6px 14px;
    border: none;
    background: none;
    border-radius: 6px;
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    font-weight: 500;
}
.filter-tab.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.filter-tab:hover:not(.active) { color: var(--text); }

.filter-search {
    position: relative;
    flex: 1;
    max-width: 250px;
}
.filter-search input {
    width: 100%;
    padding: 7px 36px 7px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
}
.filter-search input:focus { outline: none; border-color: var(--primary-light); }
.filter-search i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

/* ==========================================
   MODALS
   ========================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 60px 16px 16px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}
.modal-backdrop.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    transform: translateY(-20px);
    transition: var(--transition);
    flex-shrink: 0;
}
.modal-backdrop.active .modal { transform: translateY(0); }
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-light);
    padding: 4px;
}
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* ==========================================
   STATUS DOTS
   ========================================== */
.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}
.dot-green { background: var(--success); }
.dot-yellow { background: var(--warning); }
.dot-red { background: var(--danger); }
.dot-gray { background: var(--text-muted); }

/* ==========================================
   CALENDAR
   ========================================== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.calendar-header-cell {
    background: var(--primary);
    color: #fff;
    padding: 10px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
}
.calendar-cell {
    background: var(--bg-card);
    min-height: 90px;
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.calendar-cell:hover { background: rgba(52,152,219,0.04); }
.calendar-cell.today { background: rgba(243,156,18,0.06); }
.calendar-cell.selected { background: rgba(26,82,118,0.08); box-shadow: inset 0 0 0 2px var(--primary); }
.calendar-cell.other-month { opacity: 0.4; }
.calendar-date {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}
.calendar-dots {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}
.calendar-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}
.calendar-dot.one-time { background: var(--accent); }
.calendar-dot.recurring { background: var(--success); }
.ride-count {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================
   DRIVER / VEHICLE CARDS
   ========================================== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.entity-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    transition: var(--transition);
    border-top: 3px solid var(--primary);
}
.entity-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.entity-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}
.entity-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    color: #fff;
}
.entity-card-name { font-weight: 600; font-size: 16px; }
.entity-card-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}
.entity-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
}
.entity-meta-row i { width: 18px; color: var(--primary-light); }
.entity-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

/* ==========================================
   DAY DETAIL PANEL
   ========================================== */
.day-detail {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}
.day-detail-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--primary);
}
.day-ride-item {
    padding: 12px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}
.day-ride-item:hover { background: var(--bg); }
.availability-section {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}
.availability-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.availability-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.availability-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

/* ==========================================
   FINANCE
   ========================================== */
.progress-bar-wrap {
    background: var(--border-light);
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
    margin-top: 6px;
}
.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    transition: width 0.5s ease;
}

/* ==========================================
   DAYS PICKER (Recurring)
   ========================================== */
.days-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.day-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: #fff;
    font-family: 'Heebo', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}
.day-btn.selected {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.day-btn:hover:not(.selected) {
    border-color: var(--primary-light);
    background: rgba(26,82,118,0.05);
}

/* ==========================================
   FLASH MESSAGES
   ========================================== */
.flash-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    color: #fff;
    font-weight: 500;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-lg);
}
.flash-message button {
    background: none;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
}
.flash-success { background: var(--success); }
.flash-error { background: var(--danger); }
.flash-warning { background: var(--warning); }

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ==========================================
   LOGIN PAGE
   ========================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 20px;
}
.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.login-logo {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 8px;
}
.login-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.login-subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 14px;
}
.login-error {
    background: rgba(231,76,60,0.1);
    color: var(--danger);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13px;
}
.login-card .form-group { text-align: right; }

/* ==========================================
   EMPTY STATE
   ========================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; color: var(--text-light); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1024px) {
    .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-close { display: block; }
    .hamburger { display: block; }
    .sidebar-overlay.active { display: block; }

    .top-header {
        right: 0;
    }
    .main-content {
        margin-right: 0;
        padding: 16px;
    }

    .stats-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .card-grid { grid-template-columns: 1fr; }
    .calendar-cell { min-height: 60px; padding: 4px; }
    .calendar-date { font-size: 12px; }

    .page-header { flex-direction: column; align-items: flex-start; }
    .filters-bar { flex-direction: column; align-items: stretch; }
    .filter-search { max-width: 100%; }

    .btn-new-ride span { display: none; }

    /* Full-screen modals on mobile */
    .modal-backdrop {
        padding: 0;
        align-items: stretch;
    }
    .modal {
        max-width: 100%;
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        transform: none;
    }
    .modal-backdrop.active .modal {
        transform: none;
    }
    .modal-body {
        padding: 16px;
    }
    .modal-header {
        padding: 14px 16px;
        position: sticky;
        top: 0;
        background: var(--bg-card);
        z-index: 10;
    }
    .modal-footer {
        padding: 12px 16px;
        position: sticky;
        bottom: 0;
        background: var(--bg);
        z-index: 10;
    }
    .form-row-3 { grid-template-columns: 1fr; }

    /* Consistent inputs on mobile iOS */
    .form-control,
    input[type="date"].form-control,
    input[type="time"].form-control,
    input[type="number"].form-control,
    select.form-control {
        font-size: 16px; /* prevents iOS zoom on focus */
        min-height: 46px;
        padding: 10px 14px;
        background-color: #fff;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        -webkit-appearance: none;
        appearance: none;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .header-search { display: none; }
}

/* ==========================================
   PRINT STYLES
   ========================================== */
@media print {
    .sidebar, .top-header, .sidebar-overlay,
    .page-header, .report-actions,
    .modal-backdrop, #reportForm, .card:first-of-type,
    .flash-message, .hamburger { display: none !important; }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
    }
    .app-wrapper { display: block; }
    body { font-size: 11px; background: #fff; }
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .stat-card {
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 8px;
    }
    .card { box-shadow: none; border: 1px solid #ddd; }
    .data-table th {
        background: #1a5276 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .data-table tfoot tr:last-child td {
        background: #1a5276 !important;
        color: #fff !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}
