/**
 * SakanOujda — Shared UI Enhancements
 * Premium mobile-first overlays; desktop layouts preserved.
 */

/* ─── Design tokens (shared) ─────────────────────────────── */
:root {
  --sakan-nav-height: 76px;
  --sakan-bottom-nav-height: 72px;
  --sakan-glass: rgba(255, 255, 255, 0.88);
  --sakan-glass-border: rgba(255, 255, 255, 0.6);
  --sakan-footer-bg: #1a1410;
  --sakan-ripple: rgba(167, 100, 58, 0.25);
}

/* ─── Page load animation ────────────────────────────────── */
@keyframes sakanFadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes sakanHeartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@keyframes sakanRipple {
  to { transform: scale(2.5); opacity: 0; }
}

@keyframes sakanSlideUp {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.sakan-animate-in {
  animation: sakanFadeUp 0.45s cubic-bezier(0.4, 0, 0.2, 1) both;
}

/* ─── Enhanced sticky header (glassmorphism) ───────────── */
.site-header {
  background: var(--sakan-glass) !important;
  backdrop-filter: blur(18px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.4) !important;
  box-shadow: 0 1px 0 var(--sakan-glass-border), 0 4px 24px rgba(34, 26, 20, 0.06) !important;
}

/* Animated hamburger */
.nav-toggle {
  position: relative;
  transition: background 0.22s ease, transform 0.22s ease !important;
}

.nav-toggle svg line {
  transition: transform 0.28s ease, opacity 0.22s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] svg line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] svg line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle[aria-expanded="true"] svg line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 768px) {
  .nav.open {
    animation: sakanSlideUp 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* ─── Filter pills — premium style ───────────────────────── */
.filter-pills {
  gap: 0.55rem !important;
}

.fpill {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.45rem !important;
  padding: 0.52rem 1rem !important;
  border-radius: 100px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
  box-shadow: var(--shadow-sm);
}

.fpill i,
.fpill .bi {
  font-size: 0.85rem;
  line-height: 1;
}

.fpill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.fpill.active {
  box-shadow: 0 4px 14px rgba(167, 100, 58, 0.35) !important;
  transform: translateY(-1px);
}

/* ─── Search bar premium ─────────────────────────────────── */
.search-box {
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(167, 100, 58, 0.06) !important;
  transition: box-shadow 0.3s ease, transform 0.3s ease !important;
}

.search-box:focus-within {
  box-shadow: 0 8px 32px rgba(167, 100, 58, 0.15), 0 0 0 2px rgba(167, 100, 58, 0.2) !important;
}

.search-btn {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md) !important;
}

.search-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.35) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.search-btn:active::after {
  opacity: 1;
}

/* Properties page search bar */
.search-bar {
  border-radius: var(--radius-xl) !important;
  box-shadow: var(--shadow-lg) !important;
  transition: box-shadow 0.3s ease !important;
}

.search-bar:focus-within {
  box-shadow: 0 8px 32px rgba(167, 100, 58, 0.12), 0 0 0 2px rgba(167, 100, 58, 0.15) !important;
}

/* ─── Property cards — fully clickable ───────────────────── */
.property-card {
  position: relative;
  cursor: pointer;
}

.property-card.is-clickable::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.property-card.is-clickable .prop-fav,
.property-card.is-clickable .prop-btn-view,
.property-card.is-clickable a {
  position: relative;
  z-index: 2;
}

.property-card.is-clickable:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Heart animation */
.prop-fav.animating svg,
.gallery-fav.animating svg,
.mp-strip-btn.animating svg {
  animation: sakanHeartPop 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.prop-fav.active,
.gallery-fav.active,
.mp-strip-btn.active {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.prop-fav.active svg,
.gallery-fav.active svg {
  fill: currentColor !important;
}

.fav-pending {
  opacity: 0.55;
  pointer-events: none;
}

/* ─── Map controls ───────────────────────────────────────── */
.map-custom-controls {
  gap: 6px !important;
}

.map-ctrl {
  width: 44px !important;
  height: 44px !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-md) !important;
}

.map-ctrl:active {
  transform: scale(0.94) !important;
}

/* Mobile map toggle */
.map-toggle-fab {
  display: none;
  position: fixed;
  bottom: calc(var(--sakan-bottom-nav-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 1900;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 100px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: transform 0.28s ease, box-shadow 0.28s ease, background 0.22s ease;
}

.map-toggle-fab i {
  font-size: 1rem;
}

.map-toggle-fab:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.map-section.is-map-hidden .map-container {
  max-height: 0;
  opacity: 0;
  margin: 0;
  pointer-events: none;
  overflow: hidden;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

.map-section .map-container {
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.35s ease;
}

@media (max-width: 768px) {
  .map-toggle-fab {
    display: inline-flex;
  }

  body.has-bottom-nav {
    padding-bottom: calc(var(--sakan-bottom-nav-height) + env(safe-area-inset-bottom, 0px));
  }

  .map-container {
    height: 50vh !important;
    min-height: 280px !important;
  }
}

/* ─── Premium footer ─────────────────────────────────────── */
.site-footer-premium {
  background: var(--sakan-footer-bg);
  color: rgba(255, 255, 255, 0.65);
  padding: 3.5rem 1.5rem 1.5rem;
  margin-top: 2rem;
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-brand .footer-logo {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  color: #fff;
  text-decoration: none;
}

.footer-logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(167, 100, 58, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-logo-icon i {
  color: var(--primary-light);
  font-size: 1.2rem;
}

.footer-logo-text {
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

.footer-logo-text span {
  color: var(--primary-light);
}

.footer-about {
  font-size: 0.88rem;
  line-height: 1.7;
  max-width: 32ch;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.55rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.88rem;
  transition: color 0.22s ease, padding-left 0.22s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.footer-links a:hover {
  color: #fff;
  padding-left: 4px;
}

.footer-contact-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
}

.footer-contact-item i {
  color: var(--primary-light);
  margin-top: 2px;
}

.footer-social {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

.footer-social a {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
  transition: background 0.22s ease, color 0.22s ease, transform 0.22s ease;
}

.footer-social a:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
}

.footer-bottom-links {
  display: flex;
  gap: 1.25rem;
}

.footer-bottom-links a {
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.22s ease;
}

.footer-bottom-links a:hover {
  color: #fff;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }

  .footer-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 540px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Hide old minimal footer when premium is present */
.site-footer-premium ~ .site-footer,
body:has(.site-footer-premium) .site-footer:not(.site-footer-premium) {
  display: none;
}

/* ─── Bottom navigation (mobile only) ──────────────────── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 2100;
  height: var(--sakan-bottom-nav-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid rgba(234, 225, 214, 0.8);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 32px rgba(34, 26, 20, 0.08);
}

.bottom-nav-inner {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0 0.5rem;
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.65rem;
  font-weight: 600;
  transition: color 0.22s ease, transform 0.22s ease;
  position: relative;
  min-height: 44px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-sans);
}

.bottom-nav-item i {
  font-size: 1.25rem;
  transition: transform 0.22s ease;
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.active i {
  transform: scale(1.1);
}

.bottom-nav-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.bottom-nav-item:active {
  transform: scale(0.94);
}

@media (max-width: 768px) {
  .bottom-nav {
    display: block;
  }
}

/* ─── Fullscreen gallery lightbox ────────────────────────── */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.gallery-lightbox.open {
  opacity: 1;
  visibility: visible;
}

.gallery-lightbox-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-lightbox-slide {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
}

.gallery-lightbox-slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  transform: scale(0.95);
  transition: transform 0.4s ease;
}

.gallery-lightbox.open .gallery-lightbox-slide img {
  transform: scale(1);
}

.gallery-lb-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  transition: background 0.22s ease;
  z-index: 10;
}

.gallery-lb-close:hover {
  background: rgba(255, 255, 255, 0.22);
}

.gallery-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: background 0.22s ease, transform 0.22s ease;
  z-index: 10;
}

.gallery-lb-nav:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-50%) scale(1.05);
}

.gallery-lb-prev { left: 1rem; }
.gallery-lb-next { right: 1rem; }

.gallery-lb-counter {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.4rem 1rem;
  border-radius: 100px;
}

/* ─── RTL (Arabic) overrides ─────────────────────────────────
   Flexbox rows already mirror automatically with dir="rtl"; these
   cover the physically-positioned (left/right) elements that don't. */
[dir="rtl"] .gallery-lb-close {
  right: auto;
  left: 1rem;
}

[dir="rtl"] .footer-links a {
  transition: color 0.22s ease, padding-right 0.22s ease;
}

[dir="rtl"] .footer-links a:hover {
  padding-left: 0;
  padding-right: 4px;
}



.gallery-main .gallery-slide {
  cursor: zoom-in;
}

/* ─── Feature chips with icons ───────────────────────────── */
.feat-chip {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.feat-chip i {
  color: var(--primary);
  font-size: 0.9rem;
}

/* ─── Toast notifications ────────────────────────────────── */
.sakan-toast {
  position: fixed;
  bottom: calc(var(--sakan-bottom-nav-height) + 20px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  white-space: nowrap;
}

.sakan-toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.sakan-toast.success {
  background: #166534;
}

.sakan-toast.error {
  background: #991b1b;
}

/* ─── Button ripple ──────────────────────────────────────── */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple .ripple-circle {
  position: absolute;
  border-radius: 50%;
  background: var(--sakan-ripple);
  transform: scale(0);
  animation: sakanRipple 0.6s ease-out;
  pointer-events: none;
}

/* ─── Map popup feature icons ────────────────────────────── */
.map-popup-feat {
  display: inline-flex !important;
  align-items: center !important;
  gap: 0.3rem !important;
}

.map-popup-feat i {
  font-size: 0.75rem;
  opacity: 0.8;
}

/* ─── Reduced motion ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .sakan-animate-in,
  .property-card,
  .sim-card,
  .gallery-lightbox,
  .gallery-lightbox-slide img,
  .nav.open,
  .prop-fav.animating svg,
  .gallery-fav.animating svg,
  .mp-strip-btn.animating svg,
  .btn-ripple .ripple-circle {
    animation: none !important;
    transition: none !important;
  }
}
