/* ═══════════════════════════════════════════════════════
   Family Web App - Main Stylesheet
   Arabic/English Bilingual with RTL/LTR support
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700;800&family=Tajawal:wght@300;400;500;700&display=swap');

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --primary-dark: #0e3a55;
    --secondary: #c0932e;
    --secondary-light: #d4a843;
    --accent: #e8d5a3;
    --bg: #f8f6f1;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #ddd;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 5px 25px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: all 0.3s ease;
    --font-ar: 'Cairo', 'Tajawal', 'Segoe UI', sans-serif;
    --font-en: 'Cairo', '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-ar);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body.lang-en { font-family: var(--font-en); }
body.lang-ar { direction: rtl; }
body.lang-en { direction: ltr; }

a { color: var(--primary-light); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--secondary); }

img { max-width: 100%; height: auto; }

/* ─── SCROLLBAR ─────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--primary-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ─── NAVBAR ────────────────────────────────────────── */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    padding: 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff !important;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 16px 0;
    text-decoration: none;
}

.navbar-brand .brand-icon {
    font-size: 1.8rem;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 4px;
    align-items: center;
}

.nav-links a {
    color: rgba(255,255,255,0.85);
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lang-switch {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 6px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    transition: var(--transition);
    text-decoration: none;
}

.lang-switch:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
}

/* Mobile menu */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
}

@media (max-width: 900px) {
    .menu-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        background: var(--primary-dark);
        flex-direction: column;
        padding: 12px;
        gap: 2px;
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: 14px 20px; width: 100%; }
    .navbar-inner { flex-wrap: wrap; }
}

/* ─── HERO ──────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
    color: #fff;
    text-align: center;
    padding: 80px 24px;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 30px 30px;
    animation: heroPattern 20s linear infinite;
}

@keyframes heroPattern {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    margin-bottom: 16px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 32px;
}

.hero-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    max-width: 900px;
    margin: 0 auto;
}

.hero-card {
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 24px 16px;
    color: #fff;
    text-decoration: none;
    transition: var(--transition);
    border: 1px solid rgba(255,255,255,0.15);
}

.hero-card:hover {
    background: rgba(255,255,255,0.22);
    transform: translateY(-4px);
    color: #fff;
}

.hero-card .icon { font-size: 2.2rem; margin-bottom: 8px; }
.hero-card h3 { font-size: 1rem; font-weight: 600; }

/* ─── PAGE HEADER ───────────────────────────────────── */
.page-header {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 48px 24px;
    text-align: center;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.page-header p {
    opacity: 0.85;
    font-size: 1.05rem;
}

/* ─── CONTAINER ─────────────────────────────────────── */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    flex: 1;
}

.container-narrow {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ─── CARDS ─────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
}

/* ─── HISTORY ───────────────────────────────────────── */
.history-timeline {
    position: relative;
    padding: 20px 0;
}

body.lang-ar .history-timeline::before {
    content: '';
    position: absolute;
    right: 30px;
    top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary-light), var(--secondary));
    border-radius: 2px;
}

body.lang-en .history-timeline::before {
    content: '';
    position: absolute;
    left: 30px;
    top: 0; bottom: 0;
    width: 3px;
    background: linear-gradient(to bottom, var(--primary-light), var(--secondary));
    border-radius: 2px;
}

.history-item {
    position: relative;
    margin-bottom: 32px;
}

body.lang-ar .history-item {
    padding-right: 70px;
}

body.lang-en .history-item {
    padding-left: 70px;
}

.history-item::before {
    content: '';
    position: absolute;
    width: 16px; height: 16px;
    background: var(--secondary);
    border: 3px solid var(--bg);
    border-radius: 50%;
    top: 28px;
    box-shadow: 0 0 0 3px var(--secondary);
}

body.lang-ar .history-item::before { right: 23px; }
body.lang-en .history-item::before { left: 23px; }

.history-item .card { margin-bottom: 0; }
.history-item .card-title { color: var(--primary); }

/* ─── GALLERY ───────────────────────────────────────── */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.filter-btn {
    background: var(--bg-card);
    border: 2px solid var(--border);
    padding: 8px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
    color: var(--text);
}

.filter-btn:hover, .filter-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.gallery-item {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    aspect-ratio: 4/3;
    transition: var(--transition);
}

.gallery-item:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-hover);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item .caption {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: #fff;
    padding: 30px 14px 14px;
    font-size: 0.9rem;
    opacity: 0;
    transition: var(--transition);
}

.gallery-item:hover .caption { opacity: 1; }

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.92);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox.active { display: flex; }

.lightbox img {
    max-width: 90%;
    max-height: 85vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.lightbox-close {
    position: absolute;
    top: 20px; right: 30px;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    background: none;
    border: none;
    z-index: 10;
    width: 50px; height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.lightbox-close:hover { background: rgba(255,255,255,0.15); }

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 2.5rem;
    cursor: pointer;
    background: rgba(255,255,255,0.1);
    border: none;
    width: 60px; height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.lightbox-nav:hover { background: rgba(255,255,255,0.25); }
.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-caption {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    background: rgba(0,0,0,0.6);
    padding: 10px 24px;
    border-radius: 25px;
    font-size: 0.95rem;
    max-width: 80%;
    text-align: center;
}

/* ─── FAMILY TREE ───────────────────────────────────── */
.tree-container {
    overflow: auto;
    padding: 40px 20px;
    min-height: 400px;
    direction: ltr; /* Force LTR so tree connectors render correctly in both AR/EN */
}

.tree-wrapper {
    display: flex;
    justify-content: center;
}

.tree ul {
    padding-top: 20px;
    position: relative;
    transition: var(--transition);
    display: flex;
    justify-content: center;
}

.tree li {
    list-style: none;
    text-align: center;
    position: relative;
    padding: 20px 12px 0;
}

.tree li::before, .tree li::after {
    content: '';
    position: absolute;
    top: 0;
    border-top: 2px solid var(--primary-light);
    width: 50%;
    height: 20px;
}

.tree li::before { right: 50%; border-right: 2px solid var(--primary-light); }
.tree li::after { left: 50%; border-left: 2px solid var(--primary-light); }

.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }

.tree li:first-child::before, .tree li:last-child::after { border: 0 none; }
.tree li:last-child::before { border-radius: 0 5px 0 0; }
.tree li:first-child::after { border-radius: 5px 0 0 0; }

.tree ul ul::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    border-left: 2px solid var(--primary-light);
    width: 0;
    height: 20px;
}

.tree-node {
    display: inline-block;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 100px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
    position: relative;
    unicode-bidi: plaintext; /* Allow Arabic text to render RTL inside forced-LTR tree */
}

.tree-node.female {
    background: linear-gradient(135deg, #8e44ad, #a569bd);
}

.tree-node:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.tree-node .spouse {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
    margin-top: 2px;
}

.tree-node .years {
    display: block;
    font-size: 0.7rem;
    opacity: 0.7;
    margin-top: 2px;
}

.tree-node .toggle {
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--secondary);
    color: #fff;
    border: 2px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 1;
}

/* ─── MEMBERS ───────────────────────────────────────── */
.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    max-width: 500px;
}

body.lang-ar .search-bar { margin-right: auto; margin-left: auto; }
body.lang-en .search-bar { margin-left: auto; margin-right: auto; }

.search-bar input {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid var(--border);
    border-radius: 25px;
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus { border-color: var(--primary-light); }

.search-bar button {
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.search-bar button:hover { background: var(--primary-light); }

.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.member-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}

.member-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.member-avatar {
    width: 60px; height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    overflow: hidden;
}

.member-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.member-info { flex: 1; min-width: 0; }

.member-name {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--primary);
    margin-bottom: 4px;
}

.member-detail {
    font-size: 0.85rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.member-detail a { color: var(--primary-light); }

/* ─── EVENTS ────────────────────────────────────────── */
.event-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.event-tab {
    padding: 10px 28px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 25px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
    text-decoration: none;
    color: var(--text);
}

.event-tab:hover, .event-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.event-tab.wedding.active, .event-tab.wedding:hover {
    background: var(--success);
    border-color: var(--success);
}

.event-tab.grief.active, .event-tab.grief:hover {
    background: #555;
    border-color: #555;
}

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.event-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
    border-top: 4px solid var(--primary);
}

.event-card.wedding { border-top-color: var(--success); }
.event-card.grief { border-top-color: #555; }

.event-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-3px); }

.event-card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.event-card-body { padding: 20px; }

.event-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 8px;
}

.event-card .event-type-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
}

.event-type-badge.wedding { background: var(--success); }
.event-type-badge.grief { background: #555; }

.event-card-meta {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ─── PAGINATION ────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 32px;
    flex-wrap: wrap;
}

.pagination a, .pagination span {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    box-shadow: var(--shadow);
    transition: var(--transition);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
}

.pagination a:hover, .pagination .active {
    background: var(--primary);
    color: #fff;
}

.pagination .disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* ─── BUTTONS ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-secondary:hover { background: var(--secondary-light); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #2ecc71; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }

/* ─── FORMS ─────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    background: #fff;
}

.form-control:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(41,128,185,0.1); }

textarea.form-control { min-height: 120px; resize: vertical; }

select.form-control { cursor: pointer; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}

/* ─── ALERTS ────────────────────────────────────────── */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-danger { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-warning { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }

/* ─── FOOTER ────────────────────────────────────────── */
.footer {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: rgba(255,255,255,0.8);
    text-align: center;
    padding: 24px;
    margin-top: auto;
    font-size: 0.9rem;
}

.footer a { color: var(--accent); }
.footer a:hover { color: #fff; }

.footer-powered {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 0.85rem;
    color: rgba(255,255,255,0.6);
}

.footer-powered a {
    color: var(--secondary-light);
    font-weight: 600;
}

/* ─── ADMIN STYLES ──────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--primary-dark), var(--primary));
    color: #fff;
    padding: 0;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

body.lang-ar .admin-sidebar { right: 0; }
body.lang-en .admin-sidebar { left: 0; }

.admin-sidebar-header {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.admin-sidebar-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.admin-sidebar-header p {
    font-size: 0.8rem;
    opacity: 0.7;
}

.admin-nav { padding: 16px 0; }

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
    transition: var(--transition);
    text-decoration: none;
    font-size: 0.95rem;
}

.admin-nav a:hover, .admin-nav a.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.admin-nav a .nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }

.admin-content {
    flex: 1;
    padding: 32px;
    min-height: 100vh;
}

body.lang-ar .admin-content { margin-right: 260px; }
body.lang-en .admin-content { margin-left: 260px; }

@media (max-width: 768px) {
    .admin-sidebar { width: 100%; position: relative; }
    .admin-layout { flex-direction: column; }
    body.lang-ar .admin-content { margin-right: 0; }
    body.lang-en .admin-content { margin-left: 0; }
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.admin-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border-bottom: 3px solid var(--primary);
}

.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.stat-card .stat-icon { font-size: 2.2rem; margin-bottom: 8px; color: var(--primary-light); }
.stat-card .stat-number { font-size: 2rem; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 0.9rem; color: var(--text-light); margin-top: 4px; }

/* Empty state icon styling */
.empty-state .icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.3; color: var(--primary-light); }
.table-wrapper { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th {
    background: var(--primary);
    color: #fff;
    padding: 14px 16px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: start;
}

.admin-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.admin-table tr:hover td { background: rgba(41,128,185,0.04); }

.admin-table .actions {
    display: flex;
    gap: 6px;
}

/* ─── LOGIN ─────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--primary-light));
    padding: 24px;
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.login-card h1 {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 32px;
}

.login-card .form-control { text-align: center; }

.login-card .btn { width: 100%; justify-content: center; padding: 14px; font-size: 1.05rem; }

/* ─── EMPTY STATE ───────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-light);
}

.empty-state .icon { font-size: 4rem; margin-bottom: 16px; opacity: 0.3; color: var(--primary-light); }
.empty-state h3 { font-size: 1.3rem; margin-bottom: 8px; color: var(--text); }
.empty-state p { margin-bottom: 20px; }

/* ─── UTILITY ───────────────────────────────────────── */
.text-center { text-align: center; }
.text-start { text-align: start; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.inline-flex { display: inline-flex; }

/* Admin Gallery Grid */
.admin-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.admin-gallery-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow);
    aspect-ratio: 1;
}

.admin-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-gallery-item .overlay {
    position: absolute;
    bottom: 0;
    left: 0; right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    padding: 12px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
}

.admin-gallery-item .caption-text {
    color: #fff;
    font-size: 0.8rem;
    flex: 1;
}

/* ─── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 600px) {
    .hero h1 { font-size: 1.8rem; }
    .hero { padding: 50px 16px; }
    .hero-cards { grid-template-columns: 1fr 1fr; }
    .page-header h1 { font-size: 1.6rem; }
    .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
    .members-grid { grid-template-columns: 1fr; }
    .events-list { grid-template-columns: 1fr; }
    .container { padding: 20px 16px; }
}
