/* ============================================================================
   The Menu Partners — Driver Onboarding Portal
   Complete Design System (Navy/White/Amber Theme)
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
    --primary: #1e3a5f;
    --primary-light: #2a4f7f;
    --primary-dark: #15294a;
    --primary-50: #eff6ff;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;
    --success: #22c55e;
    --success-bg: #dcfce7;
    --success-border: #bbf7d0;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-border: #fde68a;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --bg-muted: #f1f5f9;
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    --text: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-white: #ffffff;
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,0.07), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,0.08), 0 8px 10px -6px rgba(0,0,0,0.05);
    --transition: all 0.2s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.6; -webkit-font-smoothing: antialiased; letter-spacing: -0.01em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* --- Layout --- */
.container { max-width: 960px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 24px; }
.container-lg { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* --- Grid --- */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 768px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* --- Typography --- */
h1 { font-size: 28px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.3; }
h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
h4 { font-size: 15px; font-weight: 600; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-secondary); }
.text-center { text-align: center; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* --- Card --- */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); }
.card-body { padding: 24px; }
.card-footer { padding: 16px 24px; border-top: 1px solid var(--border); }

/* --- Buttons --- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border: 1.5px solid transparent; border-radius: var(--radius); font-size: 14px; font-weight: 600; font-family: var(--font); cursor: pointer; transition: var(--transition); line-height: 1; white-space: nowrap; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-primary { background: var(--primary); color: var(--text-white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--bg-muted); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--border); }
.btn-outline:hover { background: var(--primary-50); border-color: var(--primary); }
.btn-danger { background: var(--danger); color: var(--text-white); }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: var(--success); color: var(--text-white); }
.btn-success:hover { background: #16a34a; }
.btn-warning { background: var(--accent); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-icon { padding: 8px; border-radius: var(--radius); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Forms --- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: var(--radius);
    font-size: 14px; font-family: var(--font); color: var(--text); background: var(--bg-card);
    transition: var(--transition);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,58,95,0.08); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-checkbox-group { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.form-checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }
.form-checkbox-group label { font-size: 13px; line-height: 1.5; color: var(--text); cursor: pointer; }
.form-help { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* --- Status Badges --- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; letter-spacing: 0.02em; }
.status-pending { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.status-approved { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.status-returned { background: #ffedd5; color: #9a3412; border: 1px solid #fed7aa; }
.status-rejected { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* --- Table --- */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
table th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 10px 16px; border-bottom: 2px solid var(--border); background: var(--bg-muted); }
table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
table tbody tr { transition: background 0.15s; }
table tbody tr:hover { background: var(--primary-50); }
table tbody tr.clickable { cursor: pointer; }

/* --- Alert / Toast --- */
.alert { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-size: 13px; line-height: 1.5; }
.alert-info { background: var(--info-bg); color: #1e40af; border: 1px solid #bfdbfe; }
.alert-success { background: var(--success-bg); color: #166534; border: 1px solid var(--success-border); }
.alert-warning { background: var(--warning-bg); color: #92400e; border: 1px solid var(--warning-border); }
.alert-danger { background: var(--danger-bg); color: #991b1b; border: 1px solid var(--danger-border); }

/* --- Toast notifications --- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 14px 20px; border-radius: var(--radius); background: var(--bg-card); box-shadow: var(--shadow-lg); font-size: 13px; max-width: 400px; animation: slideIn 0.3s ease; border-left: 4px solid var(--primary); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast-warning { border-left-color: var(--accent); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* --- Header / Hero --- */
.hero { background: #0f172a; color: white; padding: 48px 0; }
.hero h1 { font-size: 32px; margin-bottom: 8px; }
.hero .subtitle { color: rgba(255,255,255,0.7); font-size: 16px; margin-bottom: 28px; }

/* --- Landing Page --- */
.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 768px) { .choice-grid { grid-template-columns: 1fr; } }
.choice-card { border: 1px solid rgba(255,255,255,0.12); background: rgba(255,255,255,0.06); border-radius: var(--radius-lg); padding: 20px; text-align: left; color: white; cursor: pointer; transition: var(--transition); display: flex; flex-direction: column; }
.choice-card:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.3); transform: scale(1.03) translateY(-4px); box-shadow: 0 0 25px rgba(255,255,255,0.12); text-decoration: none; }
.choice-card .icon { font-size: 24px; margin-bottom: 12px; }
.choice-card .title { font-weight: 600; font-size: 15px; margin-bottom: 8px; min-height: 40px; }
.choice-card .desc { font-size: 13px; color: rgba(255,255,255,0.6); flex-grow: 1; }

/* --- Progress bar --- */
.progress-bar { display: flex; align-items: center; gap: 12px; padding: 16px 0; }
.progress-step { display: flex; align-items: center; gap: 8px; }
.progress-step .num { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: var(--text-muted); transition: var(--transition); flex-shrink: 0; }
.progress-step.active .num { background: var(--primary); border-color: var(--primary); color: white; }
.progress-step.done .num { background: var(--success); border-color: var(--success); color: white; }
.progress-step .label { font-size: 12px; color: var(--text-muted); }
.progress-step.active .label { color: var(--text); font-weight: 600; }
.progress-connector { width: 32px; height: 2px; background: var(--border); }

/* --- Features --- */
.feature-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
@media (max-width: 640px) { .feature-grid { grid-template-columns: 1fr; } }
.feature-card { display: flex; gap: 16px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--bg-card); }
.feature-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--primary-50); display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.feature-title { font-weight: 600; margin-bottom: 4px; }
.feature-desc { font-size: 13px; color: var(--text-secondary); }

/* --- Wizard Steps --- */
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.step-actions { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

/* --- Signature Canvas --- */
.signature-wrapper { border: 2px dashed var(--border); border-radius: var(--radius); padding: 4px; position: relative; background: #fafafa; }
.signature-wrapper:hover { border-color: var(--primary); }
.signature-canvas { cursor: crosshair; touch-action: none; display: block; width: 100%; background: transparent; }
.signature-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* --- Admin Layout --- */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 260px; background: #0f172a; color: white; display: flex; flex-direction: column; flex-shrink: 0; position: fixed; height: 100vh; overflow-y: auto; z-index: 50; }
.sidebar-header { padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-brand { font-size: 15px; font-weight: 700; color: white; }
.sidebar-subtitle { font-size: 11px; color: #64748b; margin-top: 2px; }
.sidebar-nav { padding: 12px 0; flex-grow: 1; }
.sidebar-link { display: flex; align-items: center; gap: 12px; padding: 10px 24px; color: #94a3b8; font-size: 13px; font-weight: 500; transition: var(--transition); text-decoration: none; }
.sidebar-link:hover { color: white; background: rgba(255,255,255,0.06); text-decoration: none; }
.sidebar-link.active { color: white; background: rgba(255,255,255,0.1); border-right: 3px solid var(--accent); }
.sidebar-link .icon { font-size: 18px; width: 20px; text-align: center; }
.sidebar-footer { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,0.08); }
.admin-main { flex: 1; margin-left: 260px; }
.admin-topbar { padding: 16px 32px; border-bottom: 1px solid var(--border); background: var(--bg-card); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 40; }
.admin-content { padding: 32px; }

/* --- Dashboard Stat Cards --- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text); }
.stat-card .stat-icon { float: right; width: 40px; height: 40px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-primary .stat-icon { background: var(--primary-50); color: var(--primary); }
.stat-success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-warning .stat-icon { background: var(--warning-bg); color: var(--accent-dark); }
.stat-danger .stat-icon { background: var(--danger-bg); color: var(--danger); }

/* --- Search / Filter bar --- */
.filter-bar { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.filter-bar .form-input { max-width: 300px; }
.filter-bar .form-select { max-width: 200px; }

/* --- Correction link box --- */
.correction-box { background: var(--warning-bg); border: 1px solid var(--warning-border); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 20px; }
.correction-box .correction-link { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 10px 14px; background: white; border: 1px solid var(--border); border-radius: var(--radius); word-break: break-all; font-size: 13px; font-family: monospace; }
.correction-box .correction-actions { display: flex; gap: 8px; margin-top: 12px; }

/* --- Modal / Dialog --- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; z-index: 9000; padding: 20px; }
.modal-backdrop.active { display: flex; }
.modal { background: var(--bg-card); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; animation: modalIn 0.25s ease; }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text-muted); cursor: pointer; padding: 4px; }
.modal-close:hover { color: var(--text); }
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- Detail sections --- */
.detail-section { margin-bottom: 28px; }
.detail-section h3 { margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (max-width: 640px) { .detail-grid { grid-template-columns: 1fr; } }
.detail-item .detail-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 2px; }
.detail-item .detail-value { font-size: 14px; color: var(--text); }

/* --- Audit log timeline --- */
.timeline { list-style: none; position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: var(--border); }
.timeline-item { position: relative; padding-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--bg-card); }
.timeline-item .timeline-date { font-size: 11px; color: var(--text-muted); }
.timeline-item .timeline-action { font-size: 13px; font-weight: 600; color: var(--text); }
.timeline-item .timeline-details { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.timeline-item .timeline-by { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* --- Loading spinner --- */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 60px; flex-direction: column; gap: 16px; }
.loading-overlay span { font-size: 13px; color: var(--text-muted); }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 20px; }
.pagination .page-btn { padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; background: var(--bg-card); cursor: pointer; transition: var(--transition); color: var(--text); }
.pagination .page-btn:hover { background: var(--bg-muted); }
.pagination .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* --- Responsive Mobile --- */
@media (max-width: 768px) {
    .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-content { padding: 20px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .hero h1 { font-size: 24px; }
    h1 { font-size: 22px; }
}

/* --- Misc --- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.w-full { width: 100%; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
