:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --accent: #fbbf24;
    --bg: #f8fafc;
    --surface: #ffffff;
    --surface-2: #ffffff;
    --nav-bg: #ffffff;
    --input-bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #10b981;
    --danger: #dc2626;
    --warning: #f59e0b;
    --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --alert-error-bg: #fee2e2;
    --alert-error-fg: #991b1b;
    --alert-error-border: #fca5a5;
    --alert-success-bg: #d1fae5;
    --alert-success-fg: #065f46;
    --alert-success-border: #6ee7b7;
    --badge-pending-bg: #fef3c7;
    --badge-pending-fg: #92400e;
    --badge-approved-bg: #d1fae5;
    --badge-approved-fg: #065f46;
    --badge-rejected-bg: #fee2e2;
    --badge-rejected-fg: #991b1b;
    --radius: 10px;
}

[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-dark: #3b82f6;
    --accent: #fbbf24;
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-2: #162238;
    --nav-bg: #0f172a;
    --input-bg: #162238;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: #1f2a44;
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
    --alert-error-bg: #3b1212;
    --alert-error-fg: #fecaca;
    --alert-error-border: #7f1d1d;
    --alert-success-bg: #052e2a;
    --alert-success-fg: #a7f3d0;
    --alert-success-border: #065f46;
    --badge-pending-bg: #3a2a0a;
    --badge-pending-fg: #fde68a;
    --badge-approved-bg: #052e2a;
    --badge-approved-fg: #a7f3d0;
    --badge-rejected-bg: #3b1212;
    --badge-rejected-fg: #fecaca;
}

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

html, body {
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

body[dir="rtl"] {
    font-family: 'Segoe UI', 'Tajawal', Tahoma, Arial, sans-serif;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar */
.nav {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 0;
    z-index: 50;
}
.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.logo {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.logo::before { content: "🪪 "; }
.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a { color: var(--text); font-size: 14px; font-weight: 500; }

/* Buttons */
.btn {
    display: inline-block;
    background: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
    font-family: inherit;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-secondary { background: var(--muted); }
.btn-secondary:hover { background: var(--text); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }
.btn-block { display: block; width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    color: var(--text);
}

/* Forms */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
input, textarea, select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: inherit;
    background: var(--input-bg);
    color: var(--text);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,0.1);
}

/* Layout helpers */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 560px; margin: 0 auto; padding: 0 20px; }
.section { padding: 60px 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.flex { display: flex; gap: 12px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.text-muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 16px; } .mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 16px; } .mb-4 { margin-bottom: 24px; }

/* Alert */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--alert-error-bg); color: var(--alert-error-fg); border: 1px solid var(--alert-error-border); }
.alert-success { background: var(--alert-success-bg); color: var(--alert-success-fg); border: 1px solid var(--alert-success-border); }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* Status badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-pending { background: var(--badge-pending-bg); color: var(--badge-pending-fg); }
.badge-approved { background: var(--badge-approved-bg); color: var(--badge-approved-fg); }
.badge-rejected { background: var(--badge-rejected-bg); color: var(--badge-rejected-fg); }
.badge-expired { background: #fef3c7; color: #92400e; }

/* Dark mode toggle button */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 100;
    transition: transform 0.15s, background 0.15s;
}
.theme-toggle:hover { transform: scale(1.08); }
body[dir="ltr"] .theme-toggle { left: auto; right: 20px; }
@media print { .theme-toggle { display: none !important; } }

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 80px 20px;
    text-align: center;
}
.hero h1 { font-size: 44px; line-height: 1.2; margin-bottom: 16px; font-weight: 800; letter-spacing: -1px; }
.hero p { font-size: 18px; opacity: 0.9; max-width: 640px; margin: 0 auto 32px; }
.hero .btn { background: white; color: var(--primary); }
.hero .btn:hover { background: var(--accent); }

@media (max-width: 640px) {
    .hero h1 { font-size: 28px; }
    .hero p { font-size: 15px; }
    .nav-links a:not(.btn) { display: none; }
}
