﻿@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800&display=swap');

:root {
    --bg-primary: #f6f7fb;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f2f4f8;
    --accent: #22c55e;
    --accent-light: #86efac;
    --accent-glow: rgba(34, 197, 94, 0.28);
    --info: #60a5fa;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: rgba(15, 23, 42, 0.08);
    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
    --font: 'Cairo', sans-serif;
    --topbar-h: 64px;
    --transition: 0.25s ease;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 420px at 85% -10%, rgba(34, 197, 94, 0.08), transparent 60%),
        radial-gradient(700px 380px at -10% 85%, rgba(96, 165, 250, 0.06), transparent 55%);
    opacity: 1;
    z-index: 0;
}

.topbar,
.main-content,
.modal,
.order-card,
.stat-card {
    position: relative;
    z-index: 1;
}

* {
    scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
    scrollbar-width: thin;
}

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

*::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 20px;
}

.hidden {
    display: none !important;
}

/* ===== Login ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    position: relative;
}

.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(34, 197, 94, 0.12) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 70%, rgba(96, 165, 250, 0.08) 0%, transparent 55%);
}

.bg-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    animation: blobFloat 8s ease-in-out infinite alternate;
}

.blob1 {
    width: 420px;
    height: 420px;
    background: rgba(34, 197, 94, 0.14);
    top: -80px;
    right: -80px;
}

.blob2 {
    width: 320px;
    height: 320px;
    background: rgba(96, 165, 250, 0.12);
    bottom: -60px;
    left: -60px;
    animation-delay: -4s;
}

@keyframes blobFloat {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(28px, 18px) scale(1.08); }
}

.login-card {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 48px 40px;
    width: min(420px, 92vw);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
    animation: slideUp 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(40px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo-icon {
    font-size: 52px;
    display: block;
    margin-bottom: 10px;
    filter: drop-shadow(0 0 18px var(--accent-glow));
}

.login-logo h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.input-group,
.form-group {
    margin-bottom: 18px;
}

.input-group label,
.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 700;
}

.input-group input,
.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: #f9fafb;
    border: 1.5px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-group input:focus,
.form-group input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.input-wrapper input {
    padding-left: 40px;
}

.eye-btn {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.error-msg {
    color: var(--danger);
    font-size: 0.85rem;
    text-align: center;
    min-height: 20px;
    margin-bottom: 8px;
}

.btn-primary {
    width: 100%;
    padding: 12px 18px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #0b0f14;
    border: none;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.98rem;
    font-weight: 800;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px var(--accent-glow);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.loader {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(15, 23, 42, 0.18);
    border-top-color: #111827;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Dashboard Layout ===== */
.dashboard-page {
    padding-top: var(--topbar-h);
    position: relative;
    min-height: 100vh;
    background: #f7f8fc;
}

.dashboard-page::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url('assets/driver-bg.png') center/cover no-repeat;
    filter: blur(10px) saturate(1.05);
    transform: scale(1.05);
    z-index: -2;
}

.dashboard-page::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(247, 248, 252, 0.8);
    z-index: -1;
}

/* ===== Splash Screen ===== */
.splash-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, rgba(11, 16, 26, 0.96), rgba(17, 24, 39, 0.96));
    backdrop-filter: blur(16px);
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.splash-screen.hide {
    opacity: 0;
    visibility: hidden;
}
.splash-card {
    display: grid;
    gap: 12px;
    align-items: center;
    justify-items: center;
    padding: 28px 32px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    text-align: center;
}
.splash-logo {
    width: 96px;
    height: 96px;
    border-radius: 22px;
    object-fit: cover;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
}
.splash-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: #e5f2ff;
}
.splash-subtitle {
    font-size: 0.95rem;
    color: #cbd5f5;
}

.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-h);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
    gap: 16px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 900;
    color: #15803d;
}

.topbar-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.driver-status-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.28);
    color: var(--accent-light);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-glow);
    animation: pulse 1.6s ease infinite;
}

.pulse-dot.green {
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.3);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #16a34a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1rem;
    border: 2px solid var(--accent-glow);
    color: #0b0f14;
}

.user-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger);
    border-radius: var(--r-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: background var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.22);
}

.btn-logout:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-accept:focus-visible,
.btn-deliver:focus-visible,
.btn-pickup:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.35);
}

.main-content {
    padding: 28px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

/* ===== Stats ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stats-row[hidden] {
    display: none !important;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

.stat-icon {
    font-size: 2rem;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--accent-light);
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== Alert ===== */
.alert-banner {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.25);
    color: #fde68a;
    border-radius: var(--r-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

/* ===== Sections ===== */
.section-block {
    margin-bottom: 26px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 900;
}

.realtime-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.25);
    color: #bfdbfe;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ===== Orders Grid ===== */
.orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.order-card {
    background: var(--bg-card);
    border: 1.5px solid rgba(15, 23, 42, 0.12);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
    transition: transform var(--transition), border-color var(--transition);
    cursor: pointer;
}

.order-card:hover {
    transform: translateY(-2px);
    border-color: rgba(34, 197, 94, 0.25);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.14);
}

.order-card.removing {
    opacity: 0.3;
    transform: scale(0.98);
}

.order-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.order-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.order-meta__sep {
    opacity: 0.6;
}

.order-id {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--accent-light);
}

.badge {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
}

.badge-new {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    border: 1px solid rgba(37, 99, 235, 0.25);
}

.badge-reserved {
    background: rgba(217, 119, 6, 0.16);
    color: #b45309;
    border: 1px solid rgba(217, 119, 6, 0.28);
}

.badge-pickedup {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-delivered {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-cancelled {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.order-info {
    display: grid;
    gap: 8px;
}

.order-info-row {
    display: grid;
    grid-template-columns: 24px 90px 1fr;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
}

.order-info-row .lbl {
    color: var(--text-secondary);
}

.order-info-row .val.price {
    color: var(--accent-light);
    font-weight: 700;
}

.order-time {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.order-summary {
    display: grid;
    gap: 8px;
}

.order-details {
    display: none;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
}

.order-card.expanded .order-details {
    display: block;
}

.order-card .details-hint {
    margin-top: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.order-actions .btn-accept,
.order-actions .btn-pickup,
.order-actions .btn-deliver,
.order-actions .btn-secondary {
    padding: 8px 12px;
    border-radius: var(--r-md);
    font-family: var(--font);
    font-size: 0.86rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: transform var(--transition), background var(--transition);
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.order-actions .btn-accept {
    background: linear-gradient(135deg, #16a34a, #22c55e);
    color: #0b0f14;
    border: none;
}

.order-actions .btn-accept:hover,
.order-actions .btn-pickup:hover,
.order-actions .btn-deliver:hover,
.order-actions .btn-secondary:hover {
    transform: translateY(-1px);
}

.order-actions .btn-deliver:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--text-secondary);
    background: rgba(15, 23, 42, 0.03);
    border: 1px dashed var(--border);
    border-radius: var(--r-lg);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: 28px;
    width: min(440px, 92vw);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
    animation: modalIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.modal h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.modal p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #16a34a, #22c55e);
    border: none;
    border-radius: var(--r-md);
    color: #0b0f14;
    font-weight: 800;
    cursor: pointer;
}

.btn-secondary {
    padding: 10px 20px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .topbar {
        padding: 0 12px;
    }

    .topbar-brand span:last-child {
        display: none;
    }

    .user-name,
    .user-role {
        display: none;
    }

    .main-content {
        padding: 16px 12px;
    }

    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .orders-grid {
        grid-template-columns: 1fr;
    }
}
