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

:root {
    --primary: #0f766e;
    --primary-dark: #0b5751;
    --accent: #f59e0b;
    --bg: #f7f8fa;
    --text: #1f2937;
    --muted: #6b7280;
    --card-radius: 16px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: 'Cairo', Tahoma, sans-serif;
    background: var(--bg);
    color: var(--text);
    direction: rtl;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
}
img { max-width: 100%; display: block; }
a { color: inherit; }

/* ------- Top bar ------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--primary);
    color: #fff;
    padding: calc(14px + var(--safe-top)) 16px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.topbar .logo-emoji { font-size: 22px; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }

/* ------- App shell / pages ------- */
.app { max-width: 620px; margin: 0 auto; min-height: 100vh; background: var(--bg); padding-bottom: 90px; }
.page { display: none; padding: 16px; animation: fadeIn .25s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity:0; transform: translateY(6px);} to {opacity:1; transform:none;} }

.card { background: #fff; border-radius: var(--card-radius); padding: 18px; box-shadow: 0 2px 10px rgba(0,0,0,.05); margin-bottom: 16px; }
.section-title { font-size: 18px; font-weight: 700; margin: 4px 0 14px; display:flex; align-items:center; gap:8px; }

/* ------- Home ------- */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-radius: var(--card-radius);
    padding: 26px 20px;
    margin-bottom: 18px;
    text-align: center;
}
.hero h2 { margin: 0 0 8px; font-size: 22px; }
.hero p { margin: 0; opacity: .9; font-size: 14px; line-height: 1.7; }

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.quick-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 10px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
    cursor: pointer;
    border: none;
    font-family: inherit;
}
.quick-card .emoji { font-size: 28px; display:block; margin-bottom: 8px; }
.quick-card span.label { font-size: 14px; font-weight: 600; }

/* ------- Gallery ------- */
.gallery-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gallery-grid img { width: 100%; height: 130px; object-fit: cover; border-radius: 10px; }

/* ------- Events / Personalities ------- */
.list-card { display:flex; gap: 12px; margin-bottom: 12px; cursor: pointer; }
.list-card img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; flex-shrink:0; }
.list-card .info h3 { margin: 0 0 4px; font-size: 15px; color: var(--text); }
.list-card .info .meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.list-card .info p { margin: 0; font-size: 13px; color: var(--text); line-height: 1.6; opacity: .85; }
.list-card .read-more { color: var(--primary); font-weight: 700; font-size: 12px; }

/* ------- Statistics page (eye-catching) ------- */
.stats-banner {
    background: radial-gradient(circle at 30% 20%, #14b8a6, #0f766e 60%);
    color: #fff;
    border-radius: 20px;
    padding: 28px 18px;
    text-align: center;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
}
.stats-banner .badge {
    display: inline-block;
    background: rgba(255,255,255,.18);
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 12px;
    margin-bottom: 10px;
    font-weight: 600;
}
.stats-big-number { font-size: 52px; font-weight: 800; line-height: 1; margin: 6px 0; }
.stats-caption { font-size: 14px; opacity: .95; }
.stats-mini-grid { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 16px; }
.stats-mini { background: rgba(255,255,255,.14); border-radius: 12px; padding: 12px; }
.stats-mini .n { font-size: 24px; font-weight: 700; display:block; }
.stats-mini .l { font-size: 12px; opacity:.9; }

.cities-chip-list { display:flex; flex-wrap:wrap; gap:8px; margin-top: 10px; }
.chip { background:#eef2f1; color:var(--primary-dark); padding: 6px 12px; border-radius: 999px; font-size: 13px; }

/* ------- Register form ------- */
.form-row { display:grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { margin-bottom: 14px; }
.form-group label { display:block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group textarea, .form-group select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e2e5e9;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    background: #fbfbfc;
    color: var(--text);
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { outline: 2px solid var(--primary); background:#fff; }
.field-hint { display:block; font-size: 12px; color: var(--primary); margin-top: 4px; }

.consent-box { display:flex; align-items:flex-start; gap: 8px; background:#fffbeb; border: 1px solid #fde68a; padding: 12px; border-radius: 10px; margin: 14px 0; }
.consent-box input { margin-top: 3px; }
.consent-box label { font-size: 13px; line-height: 1.7; }
.consent-box a { color: var(--primary); font-weight: 700; text-decoration: underline; }

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}
.btn-primary:disabled { opacity: .6; }
.btn-secondary {
    width: 100%;
    background: #fff;
    color: var(--primary);
    border: 1.5px solid var(--primary);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    margin-top: 10px;
}

.form-msg { padding: 12px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 14px; }
.form-msg.success { background: #dcfce7; color: #166534; }
.form-msg.error { background: #fee2e2; color: #991b1b; }

/* ------- Privacy page ------- */
.privacy-text { font-size: 14px; line-height: 1.9; color: var(--text); white-space: pre-line; }

/* ------- Lightbox (نافذة عرض التفاصيل الكاملة) ------- */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.75);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.lightbox-overlay.open { display: flex; }
.lightbox-box {
    background: var(--bg);
    color: var(--text);
    border-radius: 16px;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
    position: relative;
}
.lightbox-box img { width:100%; max-height: 320px; object-fit: contain; border-radius: 12px; margin-bottom: 14px; background:#e5e7eb; }
.lightbox-box h3 { margin: 0 0 6px; font-size: 18px; }
.lightbox-meta { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.lightbox-box p:not(.lightbox-meta) { font-size: 14px; line-height: 1.9; white-space: pre-line; }
.lightbox-close {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,.08);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    color: var(--text);
}

/* ------- Bottom nav ------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 620px;
    margin: 0 auto;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 4px calc(8px + var(--safe-bottom));
    box-shadow: 0 -2px 12px rgba(0,0,0,.07);
    z-index: 20;
}
.bottom-nav button {
    background: none;
    border: none;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: var(--muted);
    padding: 4px 6px;
    cursor: pointer;
}
.bottom-nav button .emoji { font-size: 19px; }
.bottom-nav button.active { color: var(--primary); font-weight: 700; }

.empty-state { text-align:center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #101418;
        --text: #e5e7eb;
        --muted: #9ca3af;
    }
    :root:not([data-theme="light"]) .quick-card span.label { color:#e5e7eb; }
    :root:not([data-theme="light"]) .card,
    :root:not([data-theme="light"]) .app,
    :root:not([data-theme="light"]) .quick-card,
    :root:not([data-theme="light"]) .bottom-nav { background:#181e24; }
    :root:not([data-theme="light"]) .form-group input,
    :root:not([data-theme="light"]) .form-group textarea,
    :root:not([data-theme="light"]) .form-group select { background:#1f262d; border-color:#2b333b; color:#e5e7eb; }
    :root:not([data-theme="light"]) .form-group input:focus,
    :root:not([data-theme="light"]) .form-group textarea:focus,
    :root:not([data-theme="light"]) .form-group select:focus { background:#1f262d; }
    :root:not([data-theme="light"]) .chip { background:#1f2d2b; color:#5eead4; }
    :root:not([data-theme="light"]) .consent-box { background:#2a2410; border-color:#4a3f14; }
    :root:not([data-theme="light"]) .lightbox-box img { background:#0b0f13; }
}
