/* ============================================================
   mobile-app.css — Mobile App Experience Layer
   تفاصيل الخزائن — تجربة تطبيق موبايل كاملة
   ============================================================ */

/* ── 0. LOGO & HEADER ────────────────────────────────────────── */

/* Full logo image — clean, no overrides */
.header .primary-header-inner .header-logo img.logo-img,
.header-logo img.logo-img {
  height: 58px !important;
  width: auto !important;
  max-width: none !important;
  display: block;
  object-fit: contain;
  transition: height 0.3s ease;
}

/* Scroll shrink: 58px → 46px */
.header .primary-header.fixed .header-logo img.logo-img {
  height: 46px !important;
}

/* Header padding — tighter = more premium */
.header .primary-header-inner {
  padding-top: 10px;
  padding-bottom: 10px;
}
.header .primary-header.fixed .primary-header-inner {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* Tablet */
@media (max-width: 1199px) {
  .header-logo img.logo-img {
    height: 52px !important;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .header-logo img.logo-img {
    height: 48px !important;
  }
}

/* ── 0b. Counter Section Fix ─────────────────────────────── */
/* Prevent ceiling image from overlapping counter text */
.counter-1 {
  padding-bottom: 520px !important;
}
@media only screen and (max-width: 992px) {
  .counter-1 { padding-bottom: 150px !important; }
}
@media only screen and (max-width: 767px) {
  .counter-1 { padding-bottom: 80px !important; }
}
/* Push decorative image lower so it doesn't overlap text */
.counter-1 .counter-element {
  bottom: -45% !important;
  z-index: 0 !important;
}
@media (max-width: 1199px) {
  .counter-1 .counter-element { bottom: -30% !important; }
}
@media only screen and (max-width: 992px) {
  .counter-1 .counter-element { display: none; }
}
/* Counter items above the decorative image */
.counter-1 .container {
  position: relative;
  z-index: 2;
}

/* ── 1. Global Reset & Overflow Prevention ─────────────────── */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

*, *::before, *::after {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
}

/* ── 2. CSS Custom Properties for App UI ───────────────────── */
:root {
  --app-bottom-nav-h: 64px;
  --app-safe-bottom: env(safe-area-inset-bottom, 0px);
  --app-card-radius: 20px;
  --app-card-shadow: 0 4px 24px rgba(0,0,0,0.28);
  --app-surface: rgba(20, 20, 20, 0.92);
  --app-border: rgba(255,255,255,0.08);
  --app-gold: var(--tl-color-theme-primary, #b8935a);
  --app-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── 3. Bottom Navigation Bar ──────────────────────────────── */
#app-bottom-nav {
  display: none;
}

@media (max-width: 767px) {
  #app-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    height: calc(var(--app-bottom-nav-h) + var(--app-safe-bottom));
    padding-bottom: var(--app-safe-bottom);
    background: var(--app-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--app-border);
    align-items: stretch;
    justify-content: space-around;
    box-shadow: 0 -4px 30px rgba(0,0,0,0.5);
  }

  #app-bottom-nav .app-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-decoration: none;
    color: rgba(255,255,255,0.45);
    font-size: 10px;
    font-family: 'Almarai', sans-serif;
    gap: 4px;
    padding: 8px 4px;
    transition: color var(--app-transition);
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    position: relative;
    cursor: pointer;
  }

  #app-bottom-nav .app-nav-item i {
    font-size: 20px;
    line-height: 1;
    transition: transform var(--app-transition), color var(--app-transition);
  }

  #app-bottom-nav .app-nav-item span {
    font-size: 10px;
    line-height: 1;
    direction: rtl;
  }

  #app-bottom-nav .app-nav-item.active,
  #app-bottom-nav .app-nav-item:active {
    color: var(--app-gold);
  }

  #app-bottom-nav .app-nav-item.active i {
    transform: translateY(-2px) scale(1.15);
    color: var(--app-gold);
  }

  #app-bottom-nav .app-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--app-gold);
    border-radius: 0 0 4px 4px;
  }

  /* Body padding to avoid content hiding behind bottom nav */
  body {
    padding-bottom: calc(var(--app-bottom-nav-h) + var(--app-safe-bottom));
  }
}

/* ── 4. Header Adjustments on Mobile ───────────────────────── */
@media (max-width: 767px) {
  /* Keep header minimal on mobile */
  header.header {
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }

  /* Hide the heavy desktop right-wrap call button on small screens */
  .header-contact {
    display: none !important;
  }

  /* Hide desktop CTA button in header */
  .header-btn-wrap {
    display: none !important;
  }

  /* Compact the header */
  .primary-header .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .primary-header-inner {
    min-height: 60px;
  }

  /* Logo: mobile-friendly luxury wordmark */
  .brand-icon-img {
    height: 32px !important;
    width: auto !important;
    max-width: none !important;
    filter: none !important;
  }
  .brand-line1 { font-size: 12px !important; letter-spacing: 0 !important; }
  .brand-line2 { font-size: 11px !important; letter-spacing: 0.02em !important; }
  .brand-wordmark { gap: 1px; padding-right: 8px; }
  .site-brand { gap: 8px; }
}

/* ── 5. Mobile-First Typography Scaling ─────────────────────── */
@media (max-width: 479px) {
  .section-heading .section-title {
    font-size: 28px !important;
    line-height: 1.2 !important;
  }

  .section-heading .section-title.title-2 {
    font-size: 26px !important;
  }

  .section-heading .sub-heading {
    font-size: 11px !important;
  }

  h1 { font-size: 30px !important; line-height: 1.2 !important; }
  h2 { font-size: 26px !important; line-height: 1.25 !important; }
  h3 { font-size: 22px !important; }
  h4 { font-size: 18px !important; }

  p {
    font-size: 14px !important;
    line-height: 1.7 !important;
  }
}

@media (max-width: 767px) and (min-width: 480px) {
  .section-heading .section-title {
    font-size: 32px !important;
    line-height: 1.2 !important;
  }
}

/* ── 6. Section Card-like Treatment on Mobile ───────────────── */
@media (max-width: 767px) {
  /* Sections get card feel */
  section,
  .fade-wrapper > section {
    overflow: hidden;
  }

  /* Reduce heavy pt/pb padding for mobile */
  .pt-150 { padding-top: 70px !important; }
  .pt-130 { padding-top: 60px !important; }
  .pt-120 { padding-top: 55px !important; }
  .pt-100 { padding-top: 50px !important; }
  .pb-130 { padding-bottom: 60px !important; }
  .pb-120 { padding-bottom: 55px !important; }
  .pb-100 { padding-bottom: 50px !important; }

  /* Card-styled inner containers */
  .testi-item,
  .team-item,
  .blog-item,
  .service-item,
  .project-item {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
    box-shadow: var(--app-card-shadow);
  }

  /* Rounded image corners for cards */
  .project-item .project-img img,
  .team-item .team-img img,
  .blog-item .post-img img,
  .service-item .service-img img {
    border-radius: var(--app-card-radius) !important;
  }
}

/* ── 7. Touch-Friendly Buttons ──────────────────────────────── */
@media (max-width: 767px) {
  .tl-primary-btn,
  .tl-secondary-btn,
  button,
  [type="submit"],
  [type="button"],
  .header-btn,
  .newsletter-form button {
    min-height: 48px !important;
    min-width: 48px;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 12px 24px !important;
    font-size: 14px !important;
    border-radius: 50px !important;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  /* Links that look like buttons */
  a.tl-primary-btn,
  a.tl-secondary-btn {
    min-height: 48px !important;
    padding: 12px 24px !important;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
  }
}

/* ── 8. Hero Section Mobile Optimization ───────────────────── */
@media (max-width: 767px) {
  .slider-section,
  .hero-section {
    min-height: 85vh !important;
    min-height: 85svh !important;
  }

  .slider-item,
  .hero-item {
    min-height: 85vh !important;
    min-height: 85svh !important;
    padding-top: 80px;
  }

  .slider-content h1,
  .hero-content h1 {
    font-size: 32px !important;
    line-height: 1.2 !important;
  }

  .slider-content p,
  .hero-content p {
    font-size: 14px !important;
  }

  /* Hero image - app-like rounded bottom */
  .hero-img-wrap {
    border-radius: 0 0 var(--app-card-radius) var(--app-card-radius);
    overflow: hidden;
  }
}

/* ── 9. Services Section Mobile ─────────────────────────────── */
@media (max-width: 767px) {
  .service-item {
    margin-bottom: 20px;
    padding: 24px 20px !important;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--app-border);
    border-radius: var(--app-card-radius) !important;
    transition: background var(--app-transition);
  }

  .service-item:active {
    background: rgba(255,255,255,0.08);
  }

  .service-icon,
  .service-item .icon {
    width: 52px !important;
    height: 52px !important;
    min-height: 52px;
    border-radius: 14px !important;
  }
}

/* ── 10. Project/Portfolio Cards Mobile ─────────────────────── */
@media (max-width: 767px) {
  .project-item {
    margin-bottom: 16px;
  }

  .project-item .project-img {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
  }

  .project-item .project-content {
    padding: 14px 4px 4px !important;
  }

  .project-item .project-content .title {
    font-size: 16px !important;
  }
}

/* ── 11. Team Cards Mobile ──────────────────────────────────── */
@media (max-width: 767px) {
  .team-item {
    text-align: center;
    margin-bottom: 20px;
  }

  .team-item .team-img {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
    margin-bottom: 14px;
  }
}

/* ── 12. Testimonials Mobile ────────────────────────────────── */
@media (max-width: 767px) {
  .testi-item {
    padding: 24px 20px !important;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--app-border);
    border-radius: var(--app-card-radius) !important;
    margin: 0 4px;
  }

  .testi-item p {
    font-size: 14px !important;
    line-height: 1.7 !important;
  }
}

/* ── 13. Blog Section Mobile ────────────────────────────────── */
@media (max-width: 767px) {
  .blog-item {
    margin-bottom: 20px;
  }

  .blog-item .post-img {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
    margin-bottom: 16px;
  }

  .blog-item .post-content .title {
    font-size: 18px !important;
    line-height: 1.4 !important;
  }
}

/* ── 14. Counter Section Mobile ─────────────────────────────── */
@media (max-width: 767px) {
  .counter-item {
    text-align: center;
    padding: 20px 16px;
  }

  .counter-item h3,
  .counter-item .odometer {
    font-size: 40px !important;
  }

  .counter-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
}

/* ── 15. Process Steps Mobile ───────────────────────────────── */
@media (max-width: 767px) {
  .process-item {
    padding: 20px !important;
    border-radius: var(--app-card-radius) !important;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--app-border);
    margin-bottom: 16px;
  }

  .process-item .process-number {
    font-size: 40px !important;
  }
}

/* ── 16. Gallery Scroll Mobile ──────────────────────────────── */
@media (max-width: 767px) {
  .gallary-section {
    overflow: hidden;
  }

  .gallary-scroll-item {
    border-radius: 14px !important;
    overflow: hidden;
  }

  .gallary-scroll-item img {
    border-radius: 14px !important;
  }
}

/* ── 17. Newsletter / CTA Mobile ────────────────────────────── */
@media (max-width: 767px) {
  .newsletter-wrap {
    padding: 32px 20px !important;
    border-radius: var(--app-card-radius) !important;
  }

  .newsletter-form {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
  }

  .newsletter-form input {
    width: 100% !important;
    padding: 14px 20px !important;
    border-radius: 50px !important;
    font-size: 14px !important;
    min-height: 48px;
  }

  .newsletter-form button {
    width: 100% !important;
    border-radius: 50px !important;
  }
}

/* ── 18. Footer Mobile ──────────────────────────────────────── */
@media (max-width: 767px) {
  .footer-section {
    padding-top: 50px !important;
  }

  .footer-widget {
    margin-bottom: 30px;
    text-align: right;
  }

  .footer-widget .footer-logo {
    margin-bottom: 16px;
  }

  .footer-bottom {
    flex-direction: column !important;
    text-align: center;
    gap: 12px;
  }
}

/* ── 19. Container Mobile Padding ───────────────────────────── */
@media (max-width: 767px) {
  .container,
  .container-2 {
    padding-left: 18px !important;
    padding-right: 18px !important;
    width: 100% !important;
  }
}

/* ── 20. Prevent ALL overflow on mobile ─────────────────────── */
@media (max-width: 767px) {
  .overflow-hidden,
  [class*="overflow"] {
    max-width: 100vw;
  }

  /* Clip project house image */
  .project-house-img {
    overflow: hidden;
    max-width: 100%;
  }

  .project-house-img img {
    width: 100%;
    object-fit: cover;
  }

  /* Running text clip */
  .running-text {
    overflow: hidden !important;
    max-width: 100vw !important;
  }

  /* Gallery scrolling area */
  .gallary-section,
  .gallary-wrap {
    overflow: hidden !important;
    max-width: 100vw !important;
  }
}

/* ── 21. Touch Scrolling Improvements ──────────────────────── */
.swiper,
.swiper-wrapper,
[class*="scroll"] {
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 767px) {
  /* Swiper navigation hidden on very small screens */
  .swiper-button-prev,
  .swiper-button-next {
    width: 40px !important;
    height: 40px !important;
    min-height: 40px;
  }

  .swiper-button-prev::after,
  .swiper-button-next::after {
    font-size: 14px !important;
  }
}

/* ── 22. Safe Area Insets (iPhone notch/home bar) ───────────── */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 767px) {
    body {
      padding-bottom: calc(var(--app-bottom-nav-h) + env(safe-area-inset-bottom));
    }

    #app-bottom-nav {
      padding-bottom: env(safe-area-inset-bottom);
    }
  }

  @media (max-width: 767px) and (orientation: landscape) {
    body {
      padding-left: env(safe-area-inset-left);
      padding-right: env(safe-area-inset-right);
    }
  }
}

/* ── 23. App-like Page Transitions ──────────────────────────── */
@media (max-width: 767px) {
  .fade-wrapper > section,
  .fade-wrapper > div {
    will-change: opacity;
  }
}

/* ── 24. Input / Form Mobile Optimization ───────────────────── */
@media (max-width: 767px) {
  input,
  textarea,
  select {
    font-size: 16px !important; /* prevents iOS zoom on focus */
    min-height: 48px;
    border-radius: 12px !important;
  }

  textarea {
    min-height: 120px;
  }
}

/* ── 25. Swiper Pagination Dots Mobile ──────────────────────── */
@media (max-width: 767px) {
  .swiper-pagination-bullet {
    width: 8px !important;
    height: 8px !important;
  }

  .swiper-pagination-bullet-active {
    width: 24px !important;
    height: 8px !important;
    border-radius: 4px !important;
  }
}

/* ── 26. About Section Mobile ───────────────────────────────── */
@media (max-width: 767px) {
  .about-img-wrap {
    margin-bottom: 24px;
  }

  .about-img-wrap img {
    border-radius: var(--app-card-radius) !important;
    width: 100% !important;
  }

  .about-feature-list {
    padding: 0 !important;
  }

  .about-feature-item {
    padding: 14px 16px;
    background: rgba(255,255,255,0.04);
    border-radius: 12px;
    margin-bottom: 10px;
  }
}

/* ── 27. Sponsor / Partner Logos Mobile ─────────────────────── */
@media (max-width: 767px) {
  .sponsor-item img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
    filter: brightness(0.9);
  }
}

/* ── 28. Page Header (inner pages) Mobile ───────────────────── */
@media (max-width: 767px) {
  .page-header-section {
    padding-top: 80px !important;
    padding-bottom: 50px !important;
    min-height: 220px !important;
  }

  .page-header-section .page-title {
    font-size: 30px !important;
  }
}

/* ── 29. Shop / Product Cards Mobile ───────────────────────── */
@media (max-width: 767px) {
  .shop-item {
    margin-bottom: 20px;
  }

  .shop-item .shop-img {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
  }

  .shop-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 14px !important;
  }
}

/* ── 30. Pricing Cards Mobile ───────────────────────────────── */
@media (max-width: 767px) {
  .pricing-item {
    margin-bottom: 20px;
    padding: 28px 20px !important;
    border-radius: var(--app-card-radius) !important;
  }
}

/* ── 31. FAQ Accordion Mobile ───────────────────────────────── */
@media (max-width: 767px) {
  .accordion-item {
    border-radius: 14px !important;
    overflow: hidden;
    margin-bottom: 10px;
  }

  .accordion-button {
    min-height: 52px !important;
    padding: 14px 18px !important;
    font-size: 14px !important;
  }
}

/* ── 32. Contact Form Mobile ────────────────────────────────── */
@media (max-width: 767px) {
  .contact-form-wrap {
    padding: 28px 20px !important;
    border-radius: var(--app-card-radius) !important;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--app-border);
  }

  .contact-info-item {
    padding: 16px !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,0.04);
    margin-bottom: 12px;
  }
}

/* ── 33. Lazy Loading Placeholder ───────────────────────────── */
img[loading="lazy"] {
  background: rgba(255,255,255,0.05);
}

/* ── 34. Smooth Tap Feedback ────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
  a, button, [role="button"] {
    cursor: pointer;
  }

  .tl-primary-btn:active,
  .tl-secondary-btn:active {
    transform: scale(0.97);
    opacity: 0.9;
    transition: transform 0.1s, opacity 0.1s;
  }
}

/* ── 35. Tablet Optimizations (768px - 991px) ───────────────── */
@media (min-width: 768px) and (max-width: 991px) {
  .section-heading .section-title {
    font-size: 38px !important;
  }

  .container,
  .container-2 {
    padding-left: 24px;
    padding-right: 24px;
  }

  .pt-150 { padding-top: 90px !important; }
  .pt-130 { padding-top: 80px !important; }
  .pb-130 { padding-bottom: 80px !important; }
}

/* ── 36. Ultra-small screens (320px) ───────────────────────── */
@media (max-width: 359px) {
  .section-heading .section-title {
    font-size: 24px !important;
  }

  .tl-primary-btn {
    font-size: 13px !important;
    padding: 10px 18px !important;
  }

  #app-bottom-nav .app-nav-item span {
    display: none; /* hide labels on very small screens */
  }

  #app-bottom-nav .app-nav-item i {
    font-size: 22px;
  }
}

/* ── 37. 4K / Large Screen Support ─────────────────────────── */
@media (min-width: 2000px) {
  .container,
  .container-2 {
    max-width: 1600px;
  }

  .section-heading .section-title {
    font-size: 90px;
  }

  body {
    font-size: 18px;
  }
}

/* ── 38. Panorama / Virtual Tour Mobile ─────────────────────── */
@media (max-width: 767px) {
  .antra-panoroma-container {
    height: 280px !important;
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
  }
}

/* ── 39. Stats / Number counters Mobile ─────────────────────── */
@media (max-width: 479px) {
  .counter-section .row > [class*="col-"] {
    padding: 0 8px;
  }

  .counter-content h3 {
    font-size: 42px !important;
  }
}

/* ── 40. Preloader Mobile ───────────────────────────────────── */
@media (max-width: 767px) {
  .preloader .site-name span {
    font-size: 40px !important;
  }
}

/* ── 41. Video Section Mobile ───────────────────────────────── */
@media (max-width: 767px) {
  .video-section {
    min-height: 280px !important;
  }

  .video-section .video-btn {
    width: 60px !important;
    height: 60px !important;
  }
}

/* ── 42. Horizontal Scrolling Sections (Gallery) ────────────── */
@media (max-width: 767px) {
  .gallary-scroll-item {
    width: 200px !important;
    min-width: 200px !important;
    height: 140px !important;
  }

  .gallary-scroll-item img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
}

/* ── 43. Before/After Compare Mobile ───────────────────────── */
@media (max-width: 767px) {
  .twentytwenty-container {
    border-radius: var(--app-card-radius) !important;
    overflow: hidden;
  }
}

/* ── 44. Row adjustments on mobile ─────────────────────────── */
@media (max-width: 575px) {
  .row {
    --bs-gutter-x: 16px;
  }
}
