/* ===== منظومة إدارة ملفات الإقامة — لونان فقط: كحلي داكن + أبيض ===== */
:root {
    --navy: #0a1f44;
    --navy-rgb: 10, 31, 68;
    --white: #ffffff;
    --font: 'Cairo', 'Segoe UI', Tahoma, Arial, sans-serif;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(var(--navy-rgb), .10);
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    color: var(--navy);
    background: var(--white);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

.container { width: min(1200px, 92%); margin-inline: auto; }

/* ===== أزرار ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 28px; border-radius: 10px; border: 1.5px solid transparent;
    font-size: 15px; font-weight: 700; transition: all .25s ease;
}
.btn-primary { background: var(--navy); color: var(--white); }
.btn-primary:hover { background: rgba(var(--navy-rgb), .88); transform: translateY(-1px); }
.btn-outline-light { border-color: rgba(255,255,255,.6); color: var(--white); background: transparent; }
.btn-outline-light:hover { background: rgba(255,255,255,.12); }
.btn-outline { border-color: rgba(var(--navy-rgb), .25); color: var(--navy); background: transparent; }
.btn-outline:hover { background: rgba(var(--navy-rgb), .06); }
.btn-sm { padding: 7px 16px; font-size: 13.5px; border-radius: 8px; }
.btn-danger { border-color: rgba(var(--navy-rgb), .3); color: var(--navy); background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ===== شريط التنقل ===== */
.navbar {
    position: fixed; inset-inline: 0; top: 0; z-index: 100;
    padding: 18px 0; transition: all .3s ease;
}
.navbar.scrolled {
    background: rgba(var(--navy-rgb), .82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 0;
    box-shadow: 0 4px 24px rgba(0,0,0,.18);
}
.navbar .container { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-weight: 800; font-size: 18px; }
.brand svg { width: 34px; height: 34px; }
.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; }
.nav-links a { color: rgba(255,255,255,.85); font-size: 15px; transition: color .2s; }
.nav-links a:hover { color: var(--white); }
.nav-cta { margin-inline-start: 8px; }
.nav-toggle { display: none; background: none; border: none; color: var(--white); }
.nav-toggle svg { width: 26px; height: 26px; }

/* ===== Hero ===== */
.hero {
    position: relative; min-height: 92vh;
    display: flex; align-items: center;
    background: var(--navy) url('../img/hero.jpg') center/cover no-repeat;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(180deg,
        rgba(5, 15, 35, .88) 0%,
        rgba(5, 20, 45, .60) 35%,
        rgba(5, 20, 45, .25) 68%,
        rgba(5, 20, 45, .05) 100%);
}
.hero::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(270deg, rgba(var(--navy-rgb), .45) 0%, transparent 45%);
}
.hero-content { position: relative; z-index: 2; color: var(--white); max-width: 640px; padding-top: 40px; }
.hero-badge {
    display: inline-block; padding: 6px 16px; border-radius: 999px;
    border: 1px solid rgba(255,255,255,.35); font-size: 13px;
    color: rgba(255,255,255,.85); margin-bottom: 22px;
    background: rgba(255,255,255,.08); backdrop-filter: blur(4px);
}
.hero h1 {
    font-size: clamp(30px, 4.6vw, 52px); font-weight: 800;
    line-height: 1.35; margin-bottom: 18px;
}
.hero p {
    font-size: clamp(15px, 1.4vw, 18px); color: rgba(255,255,255,.82);
    max-width: 540px; margin-bottom: 34px;
}
.hero-actions { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.hero-actions .link-more {
    color: rgba(255,255,255,.8); font-size: 14px;
    border-bottom: 1px solid rgba(255,255,255,.4); padding-bottom: 2px;
    transition: color .2s;
}
.hero-actions .link-more:hover { color: var(--white); }

/* ===== قسم تعريفي ===== */
.section { padding: 96px 0; }
.section-light { background: rgba(var(--navy-rgb), .035); }
.section-head { max-width: 820px; margin-inline: auto; text-align: center; }
.section-head h2 { font-size: clamp(24px, 3vw, 36px); font-weight: 800; margin-bottom: 18px; }
.section-head p { color: rgba(var(--navy-rgb), .65); font-size: 17px; }

.features-row {
    display: flex; justify-content: center; gap: 0;
    margin-top: 52px; flex-wrap: wrap;
}
.feature-item {
    padding: 10px 42px; text-align: center;
    font-weight: 700; font-size: 16px;
    border-inline-start: 1px solid rgba(var(--navy-rgb), .15);
}
.feature-item:first-child { border-inline-start: none; }
.feature-item span { display: block; font-size: 13px; font-weight: 400; color: rgba(var(--navy-rgb), .55); margin-top: 4px; }

/* ===== قسم الصورة الثانوية ===== */
.split { display: grid; grid-template-columns: 1.05fr 1fr; gap: 60px; align-items: center; }
.split .img-wrap img { border-radius: 16px; width: 100%; }
.split h2 { font-size: clamp(22px, 2.6vw, 32px); font-weight: 800; margin-bottom: 16px; }
.split p { color: rgba(var(--navy-rgb), .65); font-size: 16.5px; }



/* ===== الفوتر ===== */
.footer { background: var(--navy); color: rgba(255,255,255,.75); padding: 64px 0 0; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 48px; padding-bottom: 48px; }
.footer h4 { color: var(--white); font-size: 16px; margin-bottom: 18px; font-weight: 700; }
.footer .f-brand { display: flex; align-items: center; gap: 10px; color: var(--white); font-weight: 800; font-size: 17px; margin-bottom: 14px; }
.footer .f-brand svg { width: 30px; height: 30px; }
.footer p { font-size: 14.5px; max-width: 340px; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 10px; }
.footer ul a, .footer ul span { font-size: 14.5px; color: rgba(255,255,255,.65); transition: color .2s; }
.footer ul a:hover { color: var(--white); }
.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.14);
    padding: 20px 0; text-align: center; font-size: 13.5px; color: rgba(255,255,255,.55);
}

/* ===== حركات ===== */
.fade-up { opacity: 0; transform: translateY(26px); transition: opacity .7s ease, transform .7s ease; }
.fade-up.visible { opacity: 1; transform: none; }
@keyframes heroIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.hero-content > * { animation: heroIn .8s ease both; }
.hero-content > *:nth-child(2) { animation-delay: .12s; }
.hero-content > *:nth-child(3) { animation-delay: .24s; }
.hero-content > *:nth-child(4) { animation-delay: .36s; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .fade-up { opacity: 1; transform: none; }
    html { scroll-behavior: auto; }
}

/* ===== تسجيل الدخول ===== */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side {
    background: var(--navy) url('../img/hero.jpg') center/cover no-repeat;
    position: relative; display: flex; align-items: flex-end; padding: 56px; color: var(--white);
}
.auth-side::before { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,15,35,.55), rgba(5,15,35,.88)); }
.auth-side > div { position: relative; }
.auth-side h2 { font-size: 26px; font-weight: 800; margin-bottom: 10px; }
.auth-side p { color: rgba(255,255,255,.75); font-size: 15px; max-width: 380px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px; }
.auth-box { width: min(400px, 100%); }
.auth-box .brand-dark { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 19px; margin-bottom: 34px; color: var(--navy); }
.auth-box .brand-dark svg { width: 36px; height: 36px; }
.auth-box h1 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.auth-box > p { color: rgba(var(--navy-rgb), .6); font-size: 14.5px; margin-bottom: 30px; }

/* ===== نماذج ===== */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 7px; }
.field label .req { color: var(--navy); font-weight: 800; }
.field label .opt { color: rgba(var(--navy-rgb), .45); font-weight: 400; font-size: 12.5px; }
.input, .field input, .field select, .field textarea {
    width: 100%; padding: 12px 14px; border: 1.5px solid rgba(var(--navy-rgb), .18);
    border-radius: 10px; font-size: 15px; color: var(--navy); background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}
.input:focus, .field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(var(--navy-rgb), .1);
}
.field textarea { resize: vertical; min-height: 80px; }

.alert { padding: 13px 18px; border-radius: 10px; font-size: 14.5px; font-weight: 600; margin-bottom: 18px; display: none; }
.alert.show { display: block; }
.alert-error { background: rgba(var(--navy-rgb), .07); border: 1px solid rgba(var(--navy-rgb), .3); color: var(--navy); }
.alert-success { background: var(--navy); color: var(--white); }

/* ===== لوحة التحكم ===== */
.app-body { background: rgba(var(--navy-rgb), .035); min-height: 100vh; }
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar {
    background: var(--navy); color: rgba(255,255,255,.8);
    padding: 24px 0; position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column;
}
.sidebar .brand { padding: 0 24px 24px; border-bottom: 1px solid rgba(255,255,255,.12); font-size: 15.5px; }
.sidebar nav { padding: 18px 12px; flex: 1; }
.sidebar nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px; margin-bottom: 4px;
    font-size: 14.5px; color: rgba(255,255,255,.72); transition: all .2s;
}
.sidebar nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.sidebar nav a.active { background: rgba(255,255,255,.14); color: var(--white); font-weight: 700; }
.sidebar .side-foot { padding: 16px 24px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: rgba(255,255,255,.5); }

.app-main { padding: 28px 34px 50px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar .user-chip {
    display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700;
    background: var(--white); padding: 8px 16px; border-radius: 999px;
    border: 1px solid rgba(var(--navy-rgb), .12);
}
.topbar .user-chip .role { font-size: 12px; font-weight: 400; color: rgba(var(--navy-rgb), .55); }

.card-panel {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid rgba(var(--navy-rgb), .09); box-shadow: var(--shadow);
    padding: 26px;
}

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid rgba(var(--navy-rgb), .09); padding: 20px;
    transition: transform .2s, box-shadow .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-card .num { font-size: 30px; font-weight: 800; }
.stat-card .lbl { font-size: 13.5px; color: rgba(var(--navy-rgb), .6); font-weight: 600; }
.stat-card.accent { background: var(--navy); color: var(--white); }
.stat-card.accent .lbl { color: rgba(255,255,255,.7); }

/* ===== جداول ===== */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
    text-align: right; padding: 12px 14px; font-size: 13px; font-weight: 700;
    color: rgba(var(--navy-rgb), .55); border-bottom: 1.5px solid rgba(var(--navy-rgb), .12);
    white-space: nowrap;
}
table.data td { padding: 13px 14px; border-bottom: 1px solid rgba(var(--navy-rgb), .07); vertical-align: middle; }
table.data tr:hover td { background: rgba(var(--navy-rgb), .025); }
table.data a.row-link { font-weight: 700; }

.badge {
    display: inline-block; padding: 3px 12px; border-radius: 999px;
    font-size: 12.5px; font-weight: 700; border: 1px solid rgba(var(--navy-rgb), .2);
    color: var(--navy); background: rgba(var(--navy-rgb), .05); white-space: nowrap;
}
.badge.solid { background: var(--navy); color: var(--white); border-color: var(--navy); }
.badge.plain { background: transparent; }

.filters-bar { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; align-items: flex-end; }
.filters-bar .field { margin-bottom: 0; min-width: 150px; flex: 1; }
.filters-bar .field.grow { flex: 2; }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 22px; font-size: 14px; font-weight: 600; }

.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 22px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-section-title {
    grid-column: 1 / -1; font-size: 15px; font-weight: 800; margin: 22px 0 14px;
    padding-bottom: 8px; border-bottom: 1.5px solid rgba(var(--navy-rgb), .1);
}
.form-section-title:first-child { margin-top: 0; }
.form-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.details-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 30px; }
.detail-item .k { font-size: 12.5px; color: rgba(var(--navy-rgb), .5); font-weight: 600; margin-bottom: 2px; }
.detail-item .v { font-size: 15px; font-weight: 700; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.view-head .person { display: flex; align-items: center; gap: 16px; }
.avatar {
    width: 72px; height: 72px; border-radius: 14px; object-fit: cover;
    border: 1px solid rgba(var(--navy-rgb), .15); background: rgba(var(--navy-rgb), .06);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 800; color: rgba(var(--navy-rgb), .4);
}
.empty-state { text-align: center; padding: 60px 20px; color: rgba(var(--navy-rgb), .5); }

/* ===== مودال ===== */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(var(--navy-rgb), .55);
    display: none; align-items: center; justify-content: center; z-index: 200; padding: 20px;
}
.modal-backdrop.show { display: flex; }
.modal {
    background: var(--white); border-radius: 16px; padding: 30px;
    width: min(480px, 100%); max-height: 88vh; overflow-y: auto;
}
.modal h3 { font-size: 18px; font-weight: 800; margin-bottom: 20px; }

/* ===== تجاوب ===== */
@media (max-width: 960px) {
    .split { grid-template-columns: 1fr; gap: 30px; }
    .split .img-wrap { order: -1; }
    .footer-grid { grid-template-columns: 1fr; gap: 34px; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-side { display: none; }
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; inset-inline-start: 0; top: 0; bottom: 0; width: 250px; height: 100%;
        transform: translateX(100%); transition: transform .3s; z-index: 150;
    }
    [dir="rtl"] .sidebar { transform: translateX(100%); }
    .sidebar.open { transform: translateX(0); }
    .menu-btn { display: inline-flex !important; }
    .form-grid, .details-grid { grid-template-columns: 1fr 1fr; }
    .form-grid .span-3, .form-grid .span-2 { grid-column: span 2; }
    .app-main { padding: 20px 18px 40px; }
}
@media (max-width: 640px) {
    .nav-links {
        position: fixed; inset-inline: 0; top: 0; padding: 90px 8% 40px;
        background: rgba(var(--navy-rgb), .97); flex-direction: column; align-items: flex-start;
        gap: 22px; transform: translateY(-110%); transition: transform .3s; z-index: -1;
    }
    .nav-links.open { transform: none; z-index: 99; }
    .nav-toggle { display: block; }
    .form-grid, .details-grid { grid-template-columns: 1fr; }
    .form-grid .span-3, .form-grid .span-2 { grid-column: span 1; }
    .feature-item { border-inline-start: none; border-top: 1px solid rgba(var(--navy-rgb), .15); padding: 18px 10px; width: 100%; }
    .feature-item:first-child { border-top: none; }
    .hero { min-height: 88vh; }
}
.menu-btn { display: none; background: var(--white); border: 1px solid rgba(var(--navy-rgb), .15); border-radius: 8px; padding: 7px 10px; color: var(--navy); }
.menu-btn svg { width: 20px; height: 20px; display: block; }

/* ===== طباعة عامة ===== */
@media print {
    .sidebar, .topbar, .no-print, .filters-bar, .pager { display: none !important; }
    .app-shell { display: block; }
    .app-main { padding: 0; }
    body { background: var(--white); }
}
