/* =====================================================
   Responsive Design System - أبومازن للتسويق العقاري
   Mobile-First Approach with Advanced Breakpoints
   ===================================================== */

/* ─── Large Desktop - 1536px+ ─── */
@media (min-width: 1536px) {
  .container {
    max-width: 1440px;
  }
  
  .hero-content {
    grid-template-columns: 1.2fr 1fr;
    gap: 5rem;
  }
  
  .hero-title {
    font-size: 3.5rem;
  }
  
  .apartments-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  }
}

/* ─── Desktop - 1280px to 1535px ─── */
@media (min-width: 1280px) and (max-width: 1535px) {
  .container {
    max-width: 1200px;
  }
}

/* ─── Laptop - 1024px to 1279px ─── */
@media (max-width: 1279px) and (min-width: 1024px) {
  .container {
    max-width: 960px;
  }
  
  .hero-content {
    gap: 3rem;
  }
}

/* ─── Large Tablet - 1024px ─── */
@media (max-width: 1024px) {
  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  
  .hero-img-wrap img {
    height: 420px;
  }
  
  .apartments-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
  }
  
  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 2.5rem;
  }
  
  .stats-bar,
  .stats-modern {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .stat-item:nth-child(3),
  .stat-modern-item:nth-child(3) {
    border-left: none;
  }
  
  .stat-item:nth-child(n+4),
  .stat-modern-item:nth-child(n+4) {
    border-top: 1px solid var(--border);
  }
  
  .gallery-main {
    height: 400px;
  }
  
  .search-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
}

/* ─── Tablet - 768px to 1023px ─── */
@media (max-width: 1023px) and (min-width: 768px) {
  .hero-content {
    grid-template-columns: 1.1fr 1fr;
    gap: 2rem;
  }
  
  .navbar {
    height: 68px;
  }
  
  .navbar.scrolled {
    height: 64px;
  }
}

/* ─── Tablet Small & Mobile Large - 768px ─── */
@media (max-width: 768px) {
  /* ─── Container ─── */
  .container {
    padding: 0 var(--space-md);
  }
  
  /* ─── Navbar Mobile ─── */
  .navbar {
    height: 64px;
  }
  
  .navbar.scrolled {
    height: 60px;
  }
  
  .hamburger {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 64px;
    right: 0;
    width: 320px;
    max-width: 85vw;
    height: calc(100vh - 64px);
    background: var(--white);
    z-index: calc(var(--z-fixed) - 1);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-lg) var(--space-md);
    gap: 4px;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-2xl);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .nav-links.open {
    transform: translateX(0);
  }
  
  .nav-link {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 1rem;
  }
  
  .nav-whatsapp {
    justify-content: center;
    margin-top: var(--space-md);
    padding: 12px 20px;
  }
  
  /* Navbar dropdown on mobile */
  .nav-submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    margin: 8px 0 8px 20px;
    border: none;
    border-right: 3px solid var(--primary-100);
    padding: 8px 0;
    min-width: unset;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  }
  
  .nav-dropdown.open .nav-submenu {
    max-height: 400px;
  }
  
  .nav-submenu li a {
    padding: 10px 14px;
    font-size: 0.9375rem;
  }
  
  .nav-submenu li a:hover {
    background: var(--primary-50);
    padding-right: 18px;
  }
  
  /* ─── Hero Section ─── */
  .hero {
    padding-top: 64px;
    min-height: auto;
    padding-bottom: 4rem;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  
  .hero-text {
    order: 1;
  }
  
  .hero-img-wrap {
    order: 2;
    transform: none;
  }
  
  .hero-img-wrap:hover {
    transform: scale(1.02);
  }
  
  .hero-subtitle {
    margin: 0 auto var(--space-2xl);
    max-width: 100%;
  }
  
  .hero-btns {
    justify-content: center;
  }
  
  .hero-stats {
    justify-content: center;
  }
  
  .hero-img-wrap img {
    height: 340px;
  }
  
  /* ─── Search Box ─── */
  .search-section,
  .hero-search {
    margin: -24px var(--space-md) 0;
    padding: var(--space-lg);
    border-radius: var(--radius-lg);
  }
  
  .search-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
  }
  
  .search-btn-wrap {
    grid-column: 1 / -1;
  }
  
  /* ─── Grid Systems ─── */
  .apartments-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
  }
  
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* ─── Stats Bar ─── */
  .stats-bar,
  .stats-modern {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .stats-bar > div:nth-child(3),
  .stat-modern-item:nth-child(3) {
    border-left: none;
  }
  
  .stats-bar > div:nth-child(n+4),
  .stat-modern-item:nth-child(n+4) {
    border-top: 1px solid var(--border);
  }
  
  .stat-modern-item {
    padding: var(--space-lg) var(--space-md);
  }
  
  /* ─── Detail Pages ─── */
  .apt-detail {
    padding-top: 84px;
  }
  
  .apt-detail-layout {
    grid-template-columns: 1fr !important;
    gap: var(--space-xl);
  }
  
  .apt-info-box {
    position: static;
    top: auto;
  }
  
  .gallery-main {
    height: 320px;
  }
  
  .gallery-thumbs {
    gap: 8px;
  }
  
  .gallery-thumb {
    width: 70px;
    height: 52px;
  }
  
  .apt-specs-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }
  
  .video-wrap iframe,
  .video-wrap video {
    height: 280px;
  }
  
  .map-frame {
    height: 280px;
  }
  
  /* ─── Contact Page ─── */
  .contact-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
  
  .form-row {
    grid-template-columns: 1fr;
  }
  
  .contact-info-card {
    padding: var(--space-xl);
  }
  
  .contact-form-card {
    padding: var(--space-xl);
  }
  
  /* ─── Footer ─── */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-2xl);
  }
  
  .footer-brand {
    text-align: center;
  }
  
  .footer-social {
    justify-content: center;
  }
  
  /* ─── Sections ─── */
  .section-pad {
    padding: 4rem 0;
  }
  
  .section-pad-sm {
    padding: 3rem 0;
  }
  
  .section-header {
    margin-bottom: 2.5rem;
  }
  
  .section-header-inline {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-md);
  }
  
  .section-header-inline .section-title {
    text-align: center;
  }
  
  /* ─── Feature Grid ─── */
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
  }
  
  /* ─── Page Header ─── */
  .page-header-section {
    padding: 6rem 0 3.5rem;
  }
  
  /* ─── Tabs ─── */
  .section-tabs,
  .listing-tabs {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  
  .listing-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
  }
}

/* ─── Mobile Large - 640px to 767px ─── */
@media (max-width: 767px) and (min-width: 640px) {
  .hero-img-wrap img {
    height: 320px;
  }
  
  .apartments-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─── Mobile - 480px to 639px ─── */
@media (max-width: 639px) {
  /* ─── Base ─── */
  .container {
    padding: 0 var(--space-sm);
  }
  
  html {
    font-size: 15px;
  }
  
  /* ─── Typography ─── */
  h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); }
  h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
  h3 { font-size: clamp(1.25rem, 3vw, 1.75rem); }
  
  /* ─── Navbar ─── */
  .navbar {
    height: 60px;
  }
  
  .navbar.scrolled {
    height: 56px;
  }
  
  .navbar-logo {
    height: 40px;
  }
  
  .navbar.scrolled .navbar-logo {
    height: 36px;
  }
  
  .brand-main {
    font-size: 1.125rem;
  }
  
  .brand-sub {
    font-size: 0.625rem;
  }
  
  .nav-links {
    top: 60px;
    height: calc(100vh - 60px);
    width: 100%;
    max-width: 100%;
    padding: var(--space-md);
  }
  
  /* ─── Hero ─── */
  .hero {
    min-height: auto;
    padding: 80px 0 3rem;
  }
  
  .hero-content {
    gap: 2rem;
  }
  
  .hero-badge {
    padding: 8px 16px;
    font-size: 0.8125rem;
    margin-bottom: var(--space-md);
  }
  
  .hero-title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
    margin-bottom: var(--space-md);
  }
  
  .hero-subtitle {
    font-size: 0.9375rem;
    margin-bottom: var(--space-lg);
  }
  
  .hero-img-wrap img {
    height: 280px;
  }
  
  .hero-img-badge {
    padding: 12px 16px;
    bottom: var(--space-md);
    right: var(--space-md);
  }
  
  .hero-img-badge .num {
    font-size: 1.75rem;
  }
  
  .hero-img-badge .lbl {
    font-size: 0.75rem;
  }
  
  .hero-stat {
    padding: 10px 14px;
    gap: 8px;
  }
  
  .hero-stat i {
    font-size: 1rem;
  }
  
  .hero-stat-num {
    font-size: 1.125rem;
  }
  
  .hero-stat-lbl {
    font-size: 0.625rem;
  }
  
  /* ─── Buttons ─── */
  .btn {
    padding: 12px 22px;
    font-size: 0.9375rem;
  }
  
  .btn-sm {
    padding: 8px 16px;
    font-size: 0.8125rem;
  }
  
  .btn-lg {
    padding: 14px 28px;
    font-size: 1rem;
  }
  
  .hero-btns {
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
  }
  
  .hero-btns .btn {
    width: 100%;
    justify-content: center;
  }
  
  /* ─── Search ─── */
  .search-section,
  .hero-search {
    padding: var(--space-md);
    margin: -20px var(--space-sm) 0;
    border-radius: var(--radius-md);
  }
  
  .search-title {
    font-size: 0.9375rem;
    margin-bottom: var(--space-sm);
  }
  
  .search-grid {
    grid-template-columns: 1fr;
    gap: var(--space-sm);
  }
  
  .search-btn-wrap {
    grid-column: 1;
  }
  
  /* ─── Stats ─── */
  .stats-bar,
  .stats-modern {
    grid-template-columns: repeat(2, 1fr);
    gap: 0;
  }
  
  .stats-bar > div,
  .stat-modern-item {
    padding: var(--space-md) var(--space-sm);
    border-left: 1px solid var(--border);
  }
  
  .stats-bar > div:nth-child(2n),
  .stat-modern-item:nth-child(2n) {
    border-left: none;
  }
  
  .stats-bar > div:nth-child(n+3),
  .stat-modern-item:nth-child(n+3) {
    border-top: 1px solid var(--border);
  }
  
  .stat-num,
  .stat-modern-num {
    font-size: 1.75rem;
  }
  
  .stat-lbl,
  .stat-modern-lbl {
    font-size: 0.75rem;
  }
  
  .stat-modern-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
    margin-bottom: 8px;
  }
  
  /* ─── Cards ─── */
  .apartments-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .apt-card-img {
    height: 220px;
  }
  
  .apt-card-body {
    padding: var(--space-md);
  }
  
  .apt-card-specs {
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: var(--space-sm);
  }
  
  .spec-item {
    gap: 2px;
  }
  
  .spec-icon {
    font-size: 0.9375rem;
  }
  
  .spec-val {
    font-size: 0.8125rem;
  }
  
  .spec-lbl {
    font-size: 0.625rem;
  }
  
  /* ─── Gallery ─── */
  .gallery-main {
    height: 260px;
  }
  
  .gallery-thumbs {
    gap: 6px;
    margin-top: 8px;
  }
  
  .gallery-thumb {
    width: 60px;
    height: 45px;
  }
  
  /* ─── Detail Page ─── */
  .apt-detail {
    padding-top: 76px;
  }
  
  .apt-detail-header {
    margin-bottom: var(--space-lg);
  }
  
  .apt-detail-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 8px;
  }
  
  .apt-detail-meta {
    font-size: 0.8125rem;
    gap: var(--space-sm);
  }
  
  .apt-price-big {
    font-size: 1.875rem;
  }
  
  .apt-specs-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .spec-row {
    padding: 10px;
  }
  
  .spec-row i {
    font-size: 1rem;
  }
  
  .spec-row-val {
    font-size: 0.875rem;
  }
  
  .spec-row-label {
    font-size: 0.6875rem;
  }
  
  .contact-btns {
    gap: 8px;
  }
  
  .btn-call,
  .btn-wa,
  .btn-share {
    padding: 12px;
    font-size: 0.9375rem;
  }
  
  /* ─── Sections ─── */
  .section-pad {
    padding: 3rem 0;
  }
  
  .section-pad-sm {
    padding: 2rem 0;
  }
  
  .section-header {
    margin-bottom: 2rem;
  }
  
  .section-label {
    font-size: 0.75rem;
    padding: 4px 14px;
    margin-bottom: 8px;
  }
  
  .section-title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin-bottom: 8px;
  }
  
  .section-subtitle {
    font-size: 0.875rem;
  }
  
  /* ─── Page Header ─── */
  .page-header-section {
    padding: 5rem 0 2.5rem;
  }
  
  .page-header-section h1 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }
  
  .page-header-section p {
    font-size: 0.875rem;
  }
  
  .breadcrumb {
    font-size: 0.8125rem;
    gap: 6px;
  }
  
  /* ─── Contact ─── */
  .contact-page {
    padding-top: 76px;
    padding-bottom: 3rem;
  }
  
  .contact-info-card,
  .contact-form-card {
    padding: var(--space-lg);
    border-radius: var(--radius-md);
  }
  
  .contact-info-title {
    font-size: 1.25rem;
  }
  
  .contact-info-item {
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
  }
  
  .contact-info-icon {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  
  /* ─── Footer ─── */
  .site-footer {
    margin-top: 3rem;
  }
  
  .footer-main {
    padding: 3rem 0 2rem;
  }
  
  .footer-brand h3 {
    font-size: 1.25rem;
  }
  
  .footer-sponsor {
    font-size: 0.8125rem;
  }
  
  .footer-about {
    font-size: 0.875rem;
  }
  
  .footer-title {
    font-size: 0.9375rem;
    margin-bottom: var(--space-md);
  }
  
  .footer-links a,
  .footer-contact li {
    font-size: 0.875rem;
  }
  
  .footer-bottom {
    padding: var(--space-md) 0;
    font-size: 0.8125rem;
  }
  
  /* ─── Feature Grid ─── */
  .feature-grid {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }
  
  .feature-item {
    padding: var(--space-lg) var(--space-md);
  }
  
  .feature-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    margin-bottom: var(--space-md);
  }
  
  /* ─── Forms ─── */
  .form-group label {
    font-size: 0.8125rem;
  }
  
  .form-control {
    padding: 11px 14px;
    font-size: 0.9375rem;
  }
  
  textarea.form-control {
    min-height: 100px;
  }
  
  /* ─── Tabs ─── */
  .section-tabs {
    padding: 4px;
    border-radius: var(--radius-lg);
  }
  
  .section-tab {
    padding: 10px 20px;
    font-size: 0.875rem;
    gap: 6px;
  }
  
  .listing-tabs {
    gap: 6px;
  }
  
  .listing-tab {
    padding: 8px 16px;
    font-size: 0.8125rem;
  }
  
  /* ─── Pagination ─── */
  .pagination {
    gap: 4px;
  }
  
  .page-link {
    padding: 6px 10px;
    font-size: 0.8125rem;
  }
  
  /* ─── Alerts ─── */
  .alert {
    padding: 12px 16px;
    font-size: 0.875rem;
    border-radius: var(--radius-sm);
  }
  
  /* ─── Video & Map ─── */
  .video-wrap iframe,
  .video-wrap video {
    height: 240px;
  }
  
  .map-frame {
    height: 240px;
  }
}

/* ─── Mobile Extra Small - 360px to 479px ─── */
@media (max-width: 479px) {
  html {
    font-size: 14px;
  }
  
  .hero-title {
    font-size: 1.625rem;
  }
  
  .hero-img-wrap img {
    height: 240px;
  }
  
  .apt-card-img {
    height: 200px;
  }
}

/* ─── Mobile Tiny - Below 360px ─── */
@media (max-width: 360px) {
  .container {
    padding: 0 12px;
  }
  
  .hero-title {
    font-size: 1.5rem;
  }
  
  .brand-main {
    font-size: 1rem;
  }
  
  .brand-sub {
    font-size: 0.5625rem;
  }
  
  .apt-card-specs {
    gap: 4px;
    padding: 8px;
  }
  
  .spec-val {
    font-size: 0.75rem;
  }
  
  .spec-lbl {
    font-size: 0.5625rem;
  }
  
  .btn {
    padding: 10px 18px;
    font-size: 0.875rem;
  }
  
  .hero-stat {
    padding: 8px 10px;
  }
}

/* ─── Touch Device Enhancements ─── */
@media (hover: none) and (pointer: coarse) {
  /* Increase tap targets for better accessibility */
  .btn,
  .nav-link,
  .listing-tab,
  .gallery-thumb,
  .page-link,
  .hamburger {
    min-height: 44px;
    min-width: 44px;
  }
  
  .nav-link {
    padding: 14px 18px;
  }
  
  .btn {
    padding: 14px 24px;
  }
  
  .btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
  }
  
  .form-control,
  .form-select {
    padding: 14px 16px;
    font-size: 16px !important; /* Prevent zoom on iOS */
  }
  
  /* Remove hover effects on touch devices */
  .apt-card:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  .gallery-main:hover img {
    transform: none;
  }
  
  .feature-item:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }
  
  .btn:hover {
    transform: none;
  }
  
  .nav-link:hover {
    background: var(--primary-50);
  }
  
  /* Better scrolling */
  .gallery-thumbs,
  .nav-links,
  .listing-tabs {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  
  /* Active states for better feedback */
  .btn:active {
    transform: scale(0.97);
  }
  
  .apt-card:active {
    transform: scale(0.98);
  }
}

/* ─── Safe Area for Notch Devices (iPhone X+) ─── */
@supports (padding: max(0px)) {
  body {
    padding-top: max(0px, env(safe-area-inset-top));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(0px, env(safe-area-inset-bottom));
    padding-left: max(0px, env(safe-area-inset-left));
  }
  
  .navbar {
    padding-right: max(var(--space-lg), env(safe-area-inset-right));
    padding-left: max(var(--space-lg), env(safe-area-inset-left));
  }
  
  .nav-links {
    padding-bottom: max(var(--space-lg), env(safe-area-inset-bottom));
  }
}

/* ─── Landscape Orientation Adjustments ─── */
@media (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 70px 0 3rem;
  }
  
  .hero-content {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
  
  .hero-text {
    order: initial;
  }
  
  .hero-img-wrap {
    order: initial;
  }
  
  .hero-img-wrap img {
    height: 280px;
  }
  
  .nav-links {
    height: calc(100vh - 60px);
    padding: var(--space-md);
  }
  
  .search-section,
  .hero-search {
    margin-top: -16px;
  }
}

/* ─── Dark Mode Support (Future Enhancement) ─── */
@media (prefers-color-scheme: dark) {
  /* Uncomment when implementing dark mode */
  /*
  :root {
    --white: #0f172a;
    --off-white: #1e293b;
    --text: #f8fafc;
    --text-muted: #cbd5e1;
    --border: #334155;
    --light: #1e293b;
  }
  */
}

/* ─── Reduced Motion for Accessibility ─── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .reveal,
  .reveal-left,
  .reveal-right,
  .reveal-scale,
  .reveal-rotate {
    opacity: 1 !important;
    transform: none !important;
  }
  
  .floating-shapes,
  .hero-lines,
  #particles-canvas {
    display: none !important;
  }
}

/* ─── High Contrast Mode ─── */
@media (prefers-contrast: high) {
  .btn {
    border-width: 2px;
  }
  
  .apt-card {
    border-width: 2px;
  }
  
  .form-control {
    border-width: 2px;
  }
}

/* ─── Print Styles ─── */
@media print {
  /* Hide non-essential elements */
  .navbar,
  .site-footer,
  .contact-btns,
  .gallery-thumbs,
  .lightbox,
  .nav-overlay,
  .hamburger,
  .btn-share,
  .floating-shapes,
  .hero-lines,
  #particles-canvas,
  .hero-search,
  .search-section {
    display: none !important;
  }
  
  /* Reset positioning */
  .apt-detail {
    padding-top: 20px;
  }
  
  .apt-info-box {
    position: static;
    box-shadow: none;
    border: 2px solid var(--border);
  }
  
  /* Ensure content fits */
  .hero {
    min-height: auto;
    padding: 20px 0;
  }
  
  .section-pad {
    padding: 20px 0;
  }
  
  /* Optimize colors for print */
  body {
    background: white;
    color: black;
  }
  
  .hero,
  .page-header-section {
    background: white;
    color: black;
  }
  
  /* Show URLs for links */
  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  /* Page breaks */
  .apt-card,
  .feature-item,
  .detail-section {
    page-break-inside: avoid;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* ─── Prevent Horizontal Overflow ─── */
html,
body {
  overflow-x: hidden;
  max-width: 100%;
  position: relative;
}

/* ─── Scrollbar Styling (Webkit) ─── */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}

/* Thin scrollbar for small elements */
.gallery-thumbs::-webkit-scrollbar,
.nav-links::-webkit-scrollbar {
  height: 4px;
  width: 4px;
}

/* ─── Loading States Responsive ─── */
@media (max-width: 768px) {
  .skeleton-title {
    height: 20px;
    width: 70%;
  }
  
  .skeleton-text {
    height: 14px;
  }
  
  .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
  }
}

/* ─── RTL Layout Adjustments ─── */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .reveal-left {
  transform: translateX(-60px);
}

[dir="rtl"] .reveal-right {
  transform: translateX(60px);
}

/* قواعد درج الموبايل للـ RTL — مقيّدة بالموبايل فقط حتى لا تزيح القائمة
   خارج الشاشة على الكمبيوتر (كانت تنطبق على كل المقاسات وتكسر الشريط العلوي) */
@media (max-width: 768px) {
  [dir="rtl"] .nav-links {
    right: auto;
    left: 0;
    transform: translateX(-100%);
  }

  [dir="rtl"] .nav-links.open {
    transform: translateX(0);
  }
}

/* ─── Focus Visible for Keyboard Navigation ─── */
@media (prefers-reduced-motion: no-preference) {
  *:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
    transition: outline-offset 0.2s ease;
  }
}

/* ─── Utility: Hidden on Mobile/Desktop ─── */
.hidden-mobile {
  display: none;
}

@media (min-width: 769px) {
  .hidden-mobile {
    display: initial;
  }
  
  .hidden-desktop {
    display: none;
  }
}

@media (max-width: 768px) {
  .hidden-desktop {
    display: initial;
  }
}


/* ========================================
   LISTING PAGES RESPONSIVE DESIGN
   ======================================== */

/* Large Desktops (1536px and up) */
@media (min-width: 1536px) {
    .listing-page-header .header-title {
        font-size: 2.75rem;
    }
    
    .apartments-grid-modern {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        gap: 32px;
    }
    
    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    }
}

/* Desktop (1280px - 1535px) */
@media (min-width: 1280px) and (max-width: 1535px) {
    .apartments-grid-modern {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Laptop (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .listing-page-header {
        padding: 60px 0 80px;
    }
    
    .listing-page-header .header-icon {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
    
    .listing-page-header .header-title {
        font-size: 2rem;
    }
    
    .apartments-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .filters-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 16px;
    }
    
    .cta-section-listing .cta-content {
        gap: 24px;
    }
    
    .cta-section-listing .cta-text h3 {
        font-size: 1.5rem;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .listing-page-header {
        padding: 50px 0 70px;
    }
    
    .listing-page-header .header-icon {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }
    
    .listing-page-header .header-title {
        font-size: 1.75rem;
    }
    
    .listing-page-header .header-subtitle {
        font-size: 1rem;
    }
    
    .listing-type-tabs {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .type-tab {
        padding: 16px 20px;
    }
    
    .type-tab .tab-icon {
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    .filters-card {
        padding: 24px 20px;
    }
    
    .filters-header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }
    
    .filters-title h3 {
        font-size: 1.15rem;
    }
    
    .filters-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
    
    .filter-submit {
        grid-column: 1 / -1;
    }
    
    .results-header {
        flex-direction: column;
        gap: 16px;
        align-items: stretch;
        padding: 16px 20px;
    }
    
    .view-mode-toggle {
        width: 100%;
        justify-content: center;
    }
    
    .apartments-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .rental-features-banner {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        padding: 24px 20px;
    }
    
    .cta-section-listing {
        padding: 50px 0;
    }
    
    .cta-section-listing .cta-content {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .cta-section-listing .cta-icon {
        width: 70px;
        height: 70px;
        font-size: 1.75rem;
    }
    
    .cta-section-listing .cta-text h3 {
        font-size: 1.4rem;
    }
    
    .cta-section-listing .cta-text p {
        font-size: 1rem;
    }
    
    .cta-btn-listing {
        width: 100%;
        justify-content: center;
    }
}

/* Mobile Large (640px - 767px) */
@media (min-width: 640px) and (max-width: 767px) {
    .listing-page-header {
        padding: 48px 0 60px;
    }
    
    .listing-page-header .header-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .listing-page-header .header-title {
        font-size: 1.6rem;
    }
    
    .listing-page-header .header-subtitle {
        font-size: 0.95rem;
        margin-bottom: 24px;
    }
    
    .breadcrumb-modern {
        font-size: 0.85rem;
    }
    
    .listing-type-tabs {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .type-tab {
        padding: 14px 18px;
    }
    
    .type-tab .tab-icon {
        width: 42px;
        height: 42px;
        font-size: 1.2rem;
    }
    
    .type-tab .tab-label {
        font-size: 1rem;
    }
    
    .filters-card {
        padding: 20px 16px;
    }
    
    .filters-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        margin-bottom: 20px;
        padding-bottom: 16px;
    }
    
    .filters-title {
        gap: 10px;
    }
    
    .filters-title i {
        font-size: 1.1rem;
    }
    
    .filters-title h3 {
        font-size: 1.1rem;
    }
    
    .reset-filters-btn {
        padding: 8px 16px;
        font-size: 0.85rem;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    
    .filter-label {
        font-size: 0.85rem;
    }
    
    .filter-input,
    .filter-select {
        padding: 11px 14px;
        font-size: 0.9rem;
    }
    
    .filter-submit-btn {
        padding: 13px 20px;
        font-size: 0.95rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 12px;
        padding: 16px 18px;
    }
    
    .results-text {
        font-size: 0.9rem;
    }
    
    .apartments-grid-modern {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .rental-features-banner {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 20px 16px;
    }
    
    .rental-features-banner .feature-item {
        padding: 14px;
    }
    
    .rental-features-banner .feature-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .rental-features-banner .feature-text h4 {
        font-size: 0.95rem;
    }
    
    .empty-state-modern {
        padding: 60px 20px;
    }
    
    .empty-state-icon {
        width: 100px;
        height: 100px;
        font-size: 2.5rem;
        margin-bottom: 20px;
    }
    
    .empty-state-title {
        font-size: 1.3rem;
    }
    
    .empty-state-text {
        font-size: 0.95rem;
    }
    
    .empty-state-btn {
        padding: 12px 28px;
        font-size: 0.95rem;
    }
    
    .cta-section-listing {
        padding: 40px 0;
    }
    
    .cta-section-listing .cta-icon {
        width: 65px;
        height: 65px;
        font-size: 1.6rem;
    }
    
    .cta-section-listing .cta-text h3 {
        font-size: 1.3rem;
    }
    
    .cta-section-listing .cta-text p {
        font-size: 0.95rem;
    }
    
    .cta-btn-listing {
        padding: 14px 30px;
        font-size: 1rem;
    }
}

/* Mobile Medium (480px - 639px) */
@media (min-width: 480px) and (max-width: 639px) {
    .listing-page-header {
        padding: 42px 0 55px;
    }
    
    .listing-page-header .header-icon {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
        margin-bottom: 18px;
    }
    
    .listing-page-header .header-title {
        font-size: 1.45rem;
    }
    
    .listing-page-header .header-subtitle {
        font-size: 0.9rem;
    }
    
    .breadcrumb-modern {
        font-size: 0.8rem;
        gap: 8px;
    }
    
    .listing-type-tabs {
        gap: 10px;
    }
    
    .type-tab {
        padding: 12px 16px;
        gap: 12px;
    }
    
    .type-tab .tab-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }
    
    .type-tab .tab-label {
        font-size: 0.95rem;
    }
    
    .type-tab .tab-count {
        font-size: 0.8rem;
    }
    
    .filters-card {
        padding: 18px 14px;
        margin-bottom: 24px;
    }
    
    .filters-title h3 {
        font-size: 1.05rem;
    }
    
    .filters-title i {
        font-size: 1rem;
    }
    
    .reset-filters-btn {
        padding: 7px 14px;
        font-size: 0.8rem;
    }
    
    .filter-label {
        font-size: 0.8rem;
        gap: 6px;
    }
    
    .filter-input,
    .filter-select {
        padding: 10px 12px;
        font-size: 0.85rem;
    }
    
    .filter-submit-btn {
        padding: 12px 18px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .results-header {
        padding: 14px 16px;
    }
    
    .results-text {
        font-size: 0.85rem;
    }
    
    .view-mode-btn {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    
    .rental-features-banner {
        padding: 18px 14px;
    }
    
    .rental-features-banner .feature-item {
        padding: 12px;
        gap: 12px;
    }
    
    .rental-features-banner .feature-icon {
        width: 42px;
        height: 42px;
        font-size: 1.1rem;
    }
    
    .rental-features-banner .feature-text h4 {
        font-size: 0.9rem;
    }
    
    .rental-features-banner .feature-text p {
        font-size: 0.8rem;
    }
    
    .empty-state-modern {
        padding: 50px 16px;
    }
    
    .empty-state-icon {
        width: 90px;
        height: 90px;
        font-size: 2.2rem;
    }
    
    .empty-state-title {
        font-size: 1.2rem;
    }
    
    .empty-state-text {
        font-size: 0.9rem;
        margin-bottom: 24px;
    }
    
    .empty-state-btn {
        padding: 11px 24px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .cta-section-listing {
        padding: 36px 0;
    }
    
    .cta-section-listing .cta-icon {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }
    
    .cta-section-listing .cta-text h3 {
        font-size: 1.2rem;
    }
    
    .cta-section-listing .cta-text p {
        font-size: 0.9rem;
    }
    
    .cta-btn-listing {
        padding: 13px 26px;
        font-size: 0.95rem;
    }
}

/* Mobile Small (360px - 479px) */
@media (max-width: 479px) {
    .listing-page-header {
        padding: 36px 0 48px;
    }
    
    .listing-page-header .header-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        margin-bottom: 16px;
    }
    
    .listing-page-header .header-title {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .listing-page-header .header-subtitle {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .breadcrumb-modern {
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .breadcrumb-modern .breadcrumb-item {
        padding: 4px 8px;
    }
    
    .listing-type-tabs {
        gap: 8px;
    }
    
    .type-tab {
        padding: 10px 14px;
        gap: 10px;
    }
    
    .type-tab .tab-icon {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    
    .type-tab .tab-label {
        font-size: 0.9rem;
    }
    
    .type-tab .tab-count {
        font-size: 0.75rem;
    }
    
    .filters-card {
        padding: 16px 12px;
        margin-bottom: 20px;
    }
    
    .filters-header {
        margin-bottom: 16px;
        padding-bottom: 12px;
    }
    
    .filters-title {
        gap: 8px;
    }
    
    .filters-title h3 {
        font-size: 1rem;
    }
    
    .filters-title i {
        font-size: 0.95rem;
    }
    
    .reset-filters-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        gap: 6px;
    }
    
    .filters-grid {
        gap: 12px;
    }
    
    .filter-label {
        font-size: 0.75rem;
        gap: 5px;
    }
    
    .filter-label i {
        font-size: 0.8rem;
    }
    
    .filter-input,
    .filter-select {
        padding: 9px 11px;
        font-size: 0.8rem;
    }
    
    .filter-submit-btn {
        padding: 11px 16px;
        font-size: 0.85rem;
        gap: 7px;
    }
    
    .results-header {
        padding: 12px 14px;
        gap: 10px;
    }
    
    .results-text {
        font-size: 0.8rem;
    }
    
    .view-mode-toggle {
        gap: 6px;
    }
    
    .view-mode-btn {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    .apartments-grid-modern {
        gap: 16px;
    }
    
    .rental-features-banner {
        padding: 16px 12px;
        gap: 10px;
    }
    
    .rental-features-banner .feature-item {
        padding: 10px;
        gap: 10px;
        flex-direction: column;
        text-align: center;
    }
    
    .rental-features-banner .feature-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .rental-features-banner .feature-text h4 {
        font-size: 0.85rem;
    }
    
    .rental-features-banner .feature-text p {
        font-size: 0.75rem;
    }
    
    .empty-state-modern {
        padding: 40px 12px;
    }
    
    .empty-state-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
        margin-bottom: 16px;
    }
    
    .empty-state-title {
        font-size: 1.1rem;
        margin-bottom: 10px;
    }
    
    .empty-state-text {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }
    
    .empty-state-btn {
        padding: 10px 20px;
        font-size: 0.85rem;
        gap: 7px;
    }
    
    .cta-section-listing {
        padding: 32px 0;
    }
    
    .cta-section-listing .cta-content {
        gap: 16px;
    }
    
    .cta-section-listing .cta-icon {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    
    .cta-section-listing .cta-text h3 {
        font-size: 1.1rem;
    }
    
    .cta-section-listing .cta-text p {
        font-size: 0.85rem;
    }
    
    .cta-btn-listing {
        padding: 12px 22px;
        font-size: 0.9rem;
        gap: 8px;
    }
    
    .pagination-wrapper {
        margin-top: 32px;
    }
}

/* Extra Small Mobile (below 360px) */
@media (max-width: 359px) {
    .listing-page-header {
        padding: 32px 0 42px;
    }
    
    .listing-page-header .header-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .listing-page-header .header-title {
        font-size: 1.15rem;
    }
    
    .listing-page-header .header-subtitle {
        font-size: 0.8rem;
    }
    
    .filters-card {
        padding: 14px 10px;
    }
    
    .filters-title h3 {
        font-size: 0.95rem;
    }
    
    .filter-input,
    .filter-select {
        padding: 8px 10px;
        font-size: 0.75rem;
    }
    
    .filter-submit-btn {
        padding: 10px 14px;
        font-size: 0.8rem;
    }
    
    .rental-features-banner .feature-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
    }
    
    .empty-state-icon {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    .cta-section-listing .cta-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
    }
}

/* Print Styles */
@media print {
    .listing-page-header,
    .filters-card,
    .view-mode-toggle,
    .cta-section-listing,
    .pagination-wrapper {
        display: none !important;
    }
    
    .apartments-grid-modern {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}
