/* ─── Reset & Variables ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #F8F5F0;
  --bg2:         #F0EDE8;
  --bg3:         #E5E1DA;
  --white:       #FFFFFF;

  --blue:        #4A90E2;
  --blue-dark:   #3A7BC8;
  --blue-light:  #6BAEE8;
  --green:       #6FCF97;
  --gold:        #E2B93B;
  --gold-dark:   #C9A42F;

  --grad-main:   linear-gradient(135deg, #4A90E2, #6BAEE8);
  --grad-hero:   linear-gradient(160deg, #EBF4FF 0%, #F8F5F0 55%, #FFFBEF 100%);

  --text:        #2D3748;
  --text-mid:    #718096;
  --text-light:  #A0AEC0;

  --border:      rgba(0,0,0,.08);
  --border-mid:  rgba(0,0,0,.12);

  --shadow-xs:   0 1px 4px rgba(0,0,0,.05);
  --shadow-sm:   0 2px 10px rgba(0,0,0,.07);
  --shadow-md:   0 4px 20px rgba(0,0,0,.09);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.11);

  --radius:      16px;
  --radius-sm:   10px;
  --radius-xs:   8px;
  --transition:  .22s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue',
               'Cairo', 'Tajawal', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

[dir="rtl"] {
  font-family: 'Cairo', 'Tajawal', -apple-system, 'Segoe UI', system-ui, sans-serif;
}

.hidden { display: none !important; }

/* ─── Install Banner ─────────────────────────────────────────────────────── */
.install-banner {
  display: flex; align-items: center; gap: 10px;
  background: var(--blue); color: #fff;
  padding: 10px 16px; font-size: .82rem; font-weight: 600;
  position: relative; z-index: 10;
}
.install-banner span { flex: 1; }
.install-banner button {
  background: rgba(255,255,255,.22); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: 20px;
  padding: 4px 14px; font-size: .78rem; font-weight: 700; cursor: pointer;
}
.install-banner .dismiss {
  background: none; border: none; padding: 4px 8px;
  font-size: .95rem; opacity: .75; cursor: pointer;
}

/* ─── Header ─────────────────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248,245,240,.94);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  padding-top: env(safe-area-inset-top, 0);
}

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}

.logo { display: flex; align-items: center; gap: 8px; }

.logo-icon {
  font-size: 1.3rem;
  color: var(--blue);
  filter: drop-shadow(0 1px 4px rgba(74,144,226,.30));
}

.logo-text {
  font-size: 1.05rem; font-weight: 800; letter-spacing: -.2px;
  color: var(--text);
}

.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-btn {
  background: var(--white); border: 1px solid var(--border-mid);
  border-radius: 20px; padding: 5px 13px;
  font-size: .74rem; font-weight: 700; color: var(--blue);
  cursor: pointer; transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.lang-btn:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.lang-btn:active { transform: scale(.92); }

.search-toggle {
  background: var(--white); border: 1px solid var(--border-mid);
  border-radius: 50%; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-mid); transition: var(--transition);
  box-shadow: var(--shadow-xs);
}
.search-toggle:hover { background: var(--blue); color: #fff; border-color: var(--blue); }
.search-toggle:active { transform: scale(.9); }

/* ─── Search Bar ─────────────────────────────────────────────────────────── */
.search-bar { padding: 0 16px 12px; display: none; }
.search-bar.open { display: block; animation: slideDown .2s ease; }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--white); border: 1.5px solid var(--border-mid);
  border-radius: 50px; padding: 10px 16px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input-wrap:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,144,226,.12), var(--shadow-sm);
}
.search-icon-sm { color: var(--text-light); flex-shrink: 0; }

#searchInput {
  flex: 1; border: none; outline: none; background: none;
  font-size: .92rem; color: var(--text); font-family: inherit;
}
#searchInput::placeholder { color: var(--text-light); }

.clear-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-light); font-size: .9rem; padding: 2px 4px;
  transition: color var(--transition);
}
.clear-btn:hover { color: var(--text-mid); }

/* ─── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  position: relative; overflow: hidden;
  min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-hero);
  text-align: center;
}

.hero::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 70% 80% at 30% 60%, rgba(74,144,226,.10) 0%, transparent 65%),
    radial-gradient(ellipse 60% 60% at 80% 20%, rgba(111,207,151,.08) 0%, transparent 65%),
    radial-gradient(ellipse 50% 50% at 60% 80%, rgba(226,185,59,.06) 0%, transparent 60%);
}

.hero-content {
  position: relative; z-index: 1;
  padding: 40px 24px 44px; width: 100%;
}

.hero-title {
  font-size: 3.4rem; font-weight: 900; line-height: 1;
  color: var(--blue);
  letter-spacing: .02em;
  margin-bottom: 12px;
  filter: drop-shadow(0 2px 8px rgba(74,144,226,.20));
}

.hero-subtitle {
  font-size: .9rem; color: var(--text-mid);
  font-weight: 400; line-height: 1.65;
}

/* ─── Country Stories ────────────────────────────────────────────────────── */
.countries-section { padding: 20px 0 8px; }

.countries-scroll {
  overflow-x: auto; overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
}
.countries-scroll::-webkit-scrollbar { display: none; }

.countries-track {
  display: flex; gap: 16px;
  padding: 6px 16px 12px;
  width: max-content;
}

[dir="rtl"] .countries-track { direction: rtl; }

.country-item {
  display: flex; flex-direction: column; align-items: center;
  gap: 7px; cursor: pointer; min-width: 64px;
  user-select: none; -webkit-tap-highlight-color: transparent;
  animation: fadeInUp .4s ease both;
  animation-delay: calc(var(--i) * .06s);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.country-ring {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--border-mid);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.country-item.active .country-ring {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74,144,226,.18), var(--shadow-md);
  transform: scale(1.07);
}
.country-item:active .country-ring { transform: scale(.91); }

.country-flag {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; background: var(--bg2);
}
.country-flag-emoji {
  width: 100%; height: 100%; border-radius: 50%;
  background: var(--bg2);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
}
.country-name {
  font-size: .64rem; font-weight: 600; text-align: center;
  color: var(--text-mid); max-width: 64px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.country-item.active .country-name { color: var(--blue); font-weight: 700; }

/* Skeleton */
.sk-circle {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--bg3); animation: shimmer 1.6s infinite;
}
.sk-text {
  width: 44px; height: 7px; border-radius: 4px;
  background: var(--bg3); animation: shimmer 1.6s infinite;
}
@keyframes shimmer {
  0%,100% { opacity: 1; } 50% { opacity: .4; }
}

/* ─── Section Header ─────────────────────────────────────────────────────── */
.hotels-section { padding: 8px 0 48px; }
.search-results { padding: 8px 0 20px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px 14px;
}
.section-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
}
.hotel-count, .result-count {
  font-size: .72rem; font-weight: 700;
  background: rgba(74,144,226,.10); color: var(--blue);
  border: 1px solid rgba(74,144,226,.18);
  padding: 3px 10px; border-radius: 20px;
}

/* ─── Hotel Grid ─────────────────────────────────────────────────────────── */
.hotel-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px; padding: 0 12px;
}

@media (min-width: 500px) {
  .hotel-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ─── Hotel Card ─────────────────────────────────────────────────────────── */
.hotel-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
  animation: cardIn .4s ease both;
  animation-delay: calc(var(--card-i, 0) * .04s);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.hotel-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.hotel-card:active { transform: scale(.97); box-shadow: var(--shadow-xs); }

/* Image */
.hotel-img-wrap {
  width: 100%; aspect-ratio: 4/3;
  overflow: hidden; flex-shrink: 0;
  background: var(--bg2);
}
.hotel-img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .5s ease;
}
.hotel-card:hover .hotel-img { transform: scale(1.05); }

.hotel-img-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-light);
  background: linear-gradient(135deg, var(--bg2), var(--bg3));
}

/* Body */
.hotel-body {
  padding: 10px 10px 12px;
  display: flex; flex-direction: column; gap: 5px; flex: 1;
}

.hotel-number {
  display: inline-flex; align-items: center;
  min-width: 36px; height: 18px; padding: 0 7px;
  background: var(--blue);
  color: #fff; font-size: .58rem; font-weight: 800;
  letter-spacing: .4px; border-radius: 20px;
  box-shadow: 0 2px 6px rgba(74,144,226,.28);
  align-self: flex-start;
}

.hotel-name {
  font-size: .8rem; font-weight: 700; color: var(--text);
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}

.hotel-location {
  display: flex; align-items: center; gap: 3px;
  font-size: .67rem; color: var(--text-light);
}
.hotel-location svg { flex-shrink: 0; opacity: .55; }

.btn-book-card {
  display: flex; align-items: center; justify-content: center;
  background: var(--blue);
  color: #fff; border: none; border-radius: var(--radius-xs);
  font-size: .7rem; font-weight: 700; padding: 7px 8px;
  cursor: pointer; margin-top: auto;
  width: 100%; font-family: inherit;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 2px 8px rgba(74,144,226,.22);
}
.btn-book-card:hover {
  background: var(--blue-dark);
  box-shadow: 0 4px 14px rgba(74,144,226,.35);
}
.btn-book-card:active { transform: scale(.97); }

/* ─── Empty State ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 56px 24px; color: var(--text-light);
}
.empty-icon { font-size: 2.8rem; margin-bottom: 10px; }
.empty-state p { font-size: .88rem; }

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.hotel-grid.refreshing { opacity: 0; transform: translateY(8px); transition: none; }
.hotel-grid.loaded { opacity: 1; transform: none; transition: opacity .3s, transform .35s; }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (min-width: 960px) {
  body { max-width: 960px; margin: 0 auto; }
  .hotel-grid { gap: 14px; padding: 0 16px; }
}
