:root {
  --navy: #0e2a47;
  --navy-light: #1b3f66;
  --gold: #c8a24a;
  --gold-dark: #a9842f;
  --bg: #f5f6f8;
  --text: #1f2933;
  --muted: #667085;
  --white: #ffffff;
  --green: #25d366;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(14, 42, 71, 0.12);
}

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

body {
  font-family: 'Tajawal', 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
}

/* في الوضع من اليمين لليسار ضع الشارة في الزاوية اليمنى */
[dir="rtl"] .badge { left: auto; right: 14px; }
[dir="rtl"] .thumbs .thumb-item button { right: auto; left: 3px; }

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

.container { width: min(1180px, 92%); margin: 0 auto; }

/* ---------- Header ---------- */
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14, 42, 71, 0.97);
  backdrop-filter: blur(6px);
  color: var(--white);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 0;
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.25rem; }
.brand .logo {
  width: 68px; height: 68px; border-radius: 12px;
  object-fit: cover; background: #fff; display: block;
}
.nav-links { display: flex; gap: 26px; align-items: center; }
.nav-links a { color: #d7e0ea; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--gold); }
.nav-links .admin-link {
  border: 1px solid rgba(255,255,255,.25); padding: 7px 16px; border-radius: 20px;
}

/* ---------- Hero ---------- */
.hero {
  background:
    linear-gradient(rgba(14,42,71,.82), rgba(14,42,71,.9)),
    url('https://images.unsplash.com/photo-1545324418-cc1a3fa10c00?auto=format&fit=crop&w=1600&q=80') center/cover;
  color: var(--white);
  padding: 110px 0 120px;
  text-align: center;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.15; margin-bottom: 16px; }
.hero p { font-size: 1.15rem; color: #d7e0ea; max-width: 640px; margin: 0 auto 30px; }
.hero .btn { font-size: 1rem; }

.btn {
  display: inline-block; cursor: pointer; border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--navy); font-weight: 700;
  padding: 13px 30px; border-radius: 30px; transition: transform .15s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(200,162,74,.4); }
.btn.ghost { background: transparent; border: 1px solid var(--gold); color: var(--gold); }

/* ---------- Stats ---------- */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px;
  margin: -60px auto 0; position: relative; z-index: 5;
}
.stat {
  background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px 18px; text-align: center;
}
.stat .num { font-size: 2.2rem; font-weight: 800; color: var(--navy); }
.stat .label { color: var(--muted); font-size: .92rem; margin-top: 4px; }

/* ---------- Sections ---------- */
section { padding: 70px 0; }
.section-head { text-align: center; margin-bottom: 42px; }
.section-head h2 { font-size: 2rem; color: var(--navy); }
.section-head p { color: var(--muted); margin-top: 8px; }
.section-head .line { width: 70px; height: 4px; background: var(--gold); margin: 14px auto 0; border-radius: 2px; }

/* ---------- Filters ---------- */
.filters { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 34px; }
.filter-btn {
  border: 1px solid #d0d7e2; background: var(--white); color: var(--navy);
  padding: 9px 22px; border-radius: 22px; cursor: pointer; font-weight: 600; transition: all .2s;
}
.filter-btn.active, .filter-btn:hover { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* ---------- Project cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 26px; }
.card {
  background: var(--white); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .2s;
}
.card:hover { transform: translateY(-5px); }
.card .thumb { height: 210px; background: #dfe4ec center/cover; position: relative; }
.card .thumb .placeholder {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: #9aa6b6; font-size: 2.4rem;
  background: linear-gradient(135deg, #e9edf3, #d7dde7);
}
.badge {
  position: absolute; top: 14px; left: 14px; padding: 6px 14px; border-radius: 20px;
  font-size: .78rem; font-weight: 700; color: var(--white); text-transform: capitalize;
}
.badge.available { background: #2e9e5b; }
.badge.ongoing { background: #d98824; }
.badge.sold { background: #b23b3b; }

.card-body { padding: 20px; display: flex; flex-direction: column; flex: 1; }
.card-body h3 { color: var(--navy); font-size: 1.25rem; }
.card-body .loc { color: var(--muted); font-size: .9rem; margin: 4px 0 12px; display: flex; align-items: center; gap: 6px; }
.card-body p.desc { color: #4b5563; font-size: .93rem; flex: 1; }

.units { display: flex; gap: 10px; margin-top: 16px; }
.unit-pill {
  flex: 1; text-align: center; background: var(--bg); border-radius: 10px; padding: 10px 6px;
}
.unit-pill .n { font-weight: 800; color: var(--navy); font-size: 1.15rem; }
.unit-pill .t { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.progress { height: 8px; background: #e4e9f0; border-radius: 6px; margin-top: 14px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-dark)); }

/* ---------- Contact ---------- */
.contact-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.contact-info { background: var(--navy); color: var(--white); border-radius: var(--radius); padding: 36px; }
.contact-info h3 { font-size: 1.5rem; margin-bottom: 18px; }
.contact-info .row { display: flex; gap: 12px; margin-bottom: 18px; align-items: center; color: #cdd7e3; }
.contact-info .row .ic { width: 38px; height: 38px; border-radius: 10px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
form.card-form { background: var(--white); border-radius: var(--radius); padding: 32px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--navy); }
.field input, .field textarea, .field select {
  width: 100%; padding: 12px 14px; border: 1px solid #d7dde7; border-radius: 10px; font: inherit; background: #fbfbfc;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--gold); }
.form-msg { margin-top: 10px; font-weight: 600; }
.form-msg.ok { color: #2e9e5b; }
.form-msg.err { color: #b23b3b; }

/* ---------- Footer ---------- */
footer { background: #0a1f36; color: #9fb0c4; padding: 40px 0; text-align: center; }
footer a { color: var(--gold); }

/* ---------- WhatsApp float ---------- */
.whatsapp-float {
  position: fixed; bottom: 26px; right: 26px; z-index: 100;
  width: 60px; height: 60px; border-radius: 50%; background: var(--green);
  display: grid; place-items: center; box-shadow: 0 8px 24px rgba(37,211,102,.5);
  animation: pulse 2.2s infinite;
}
.whatsapp-float svg { width: 32px; height: 32px; fill: #fff; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(37,211,102,.5); }
  70% { box-shadow: 0 0 0 16px rgba(37,211,102,0); }
  100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

/* ---------- Empty ---------- */
.empty { text-align: center; color: var(--muted); padding: 50px; grid-column: 1/-1; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .contact-wrap { grid-template-columns: 1fr; }
  .nav-links { gap: 14px; font-size: .9rem; }
  .nav-links a:not(.admin-link) { display: none; }
}

/* ---------- Admin ---------- */
.admin-body { background: var(--bg); }
.admin-header { background: var(--navy); color: #fff; padding: 16px 0; }
.admin-header .nav { padding: 0; }
.login-box { max-width: 400px; margin: 90px auto; background: #fff; padding: 36px; border-radius: var(--radius); box-shadow: var(--shadow); }
.login-box h2 { color: var(--navy); margin-bottom: 8px; }
.login-box p { color: var(--muted); margin-bottom: 20px; font-size: .9rem; }
.admin-grid { display: grid; grid-template-columns: 420px 1fr; gap: 30px; align-items: start; margin: 30px 0; }
.panel { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px; }
.panel h3 { color: var(--navy); margin-bottom: 18px; }
.admin-project {
  background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px;
}
.admin-project .top { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.admin-project h4 { color: var(--navy); font-size: 1.15rem; }
.admin-project .meta { color: var(--muted); font-size: .85rem; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.thumbs .thumb-item { position: relative; width: 90px; height: 70px; border-radius: 8px; overflow: hidden; }
.thumbs .thumb-item img { width: 100%; height: 100%; object-fit: cover; }
.thumbs .thumb-item button {
  position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%;
  border: none; background: rgba(178,59,59,.92); color: #fff; cursor: pointer; font-weight: 700; line-height: 1;
}
.btn-sm { padding: 8px 16px; font-size: .85rem; border-radius: 8px; }
.btn-danger { background: #b23b3b; color: #fff; }
.btn-upload { background: var(--navy); color: #fff; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.inline-note { color: var(--muted); font-size: .8rem; }
.badge-status { display: inline-block; padding: 3px 12px; border-radius: 14px; font-size: .74rem; font-weight: 700; color: #fff; text-transform: capitalize; }
.msg-item { border-bottom: 1px solid #eef1f5; padding: 12px 0; }
.msg-item:last-child { border: none; }
.msg-item .who { font-weight: 700; color: var(--navy); }
.msg-item .contact { color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 10px; margin-bottom: 20px; }
@media (max-width: 860px) { .admin-grid { grid-template-columns: 1fr; } }

/* ---------- Map location picker (admin) ---------- */
.pick-map { height: 260px; width: 100%; border-radius: 10px; border: 1px solid #d9dee5; margin-top: 8px; z-index: 0; }
.map-search { display: flex; gap: 8px; }
.map-search input { flex: 1; }
.card .loc a { color: inherit; text-decoration: none; }
.card .loc a:hover { color: var(--gold-dark); text-decoration: underline; }
.card .loc .map-link { margin-inline-start: 6px; font-size: .85rem; color: var(--gold-dark); white-space: nowrap; }

/* ---------- Logo uploader (admin) ---------- */
.logo-row { display: flex; align-items: center; gap: 16px; }
.logo-row img { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #fff; border: 1px solid #d9dee5; }
.logo-row input[type="file"] { display: block; margin-bottom: 8px; }
