/* ===========================================
   وكالة المحمودي - التجاوب الكامل للجوال
   =========================================== */

/* === Medium Desktops (993px - 1350px) to prevent navbar overlaps === */
@media (min-width: 993px) and (max-width: 1350px) {
  .navbar-brand .desktop-brand {
    font-size: 11px !important;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
    vertical-align: middle;
  }
  .navbar-nav {
    gap: 8px !important;
    margin: 0 !important;
  }
  .navbar-nav a {
    font-size: 12.5px !important;
  }
  .navbar-cta-group {
    gap: 8px !important;
    margin: 0 !important;
  }
  .navbar-cta .btn {
    padding: 0 14px !important;
    font-size: 11.5px !important;
    height: 36px !important;
  }
  .lang-toggle-btn, .theme-toggle-btn, .client-profile-trigger {
    padding: 6px !important;
    font-size: 12px !important;
  }
}

/* === Tablet Landscape (≤1200px) === */
@media(max-width:1200px) {
  .hero-content h1 { font-size:42px; }
  .services-grid { grid-template-columns:repeat(3,1fr); }
  .cta-image { max-width:400px; }
}

/* === Tablet Portrait (≤992px) === */
@media(max-width:992px) {
  /* Navbar Mobile */
  .navbar { background:var(--navbar-bg); backdrop-filter:blur(15px); -webkit-backdrop-filter:blur(15px); border-bottom:1px solid var(--glass-border); padding:10px 0; }
  .navbar-container { display: flex !important; justify-content: space-between !important; align-items: center !important; padding: 0 20px !important; }
  .navbar-brand-logo { height: 36px; max-width: 165px; }
  .navbar-nav { position:fixed; top:0; right:-100%; width:280px; height:100vh; background:var(--white); flex-direction:column; padding:80px 30px 30px; box-shadow:var(--shadow-lg); transition:var(--transition); z-index:1001; gap:10px; overflow-y:auto; margin-right:0; margin-left:0; }
  .navbar-nav.open { right:0; }
  .navbar-nav li { width:100%; }
  .navbar-nav a { display:block; padding:12px 0; border-bottom:1px solid var(--border); font-size:16px; }
  .navbar-nav a::after { display:none; }
  .menu-toggle { display:flex; z-index:1002; }
  .navbar-cta { display:none; }
  .navbar-cta-group { margin-right: auto; }
  .menu-overlay { position:fixed; inset:0; background:rgba(42,18,40,0.6); z-index:1000; opacity:0; visibility:hidden; transition:var(--transition); }
  .menu-overlay.open { opacity:1; visibility:visible; }

  .mobile-only-link { display:list-item !important; }
  .desktop-only-link { display:none !important; }

  /* Hero */
  .hero .container { grid-template-columns:1fr; text-align:center; gap:30px; }
  .hero-content h1 { font-size:34px; }
  .hero-content p { margin:0 auto 30px; }
  .hero-buttons { justify-content:center; flex-wrap:wrap; }
  .hero-stats { justify-content:center; }
  .hero-image { order:-1; }
  .hero-image img { max-height:350px; }
  .hero-video-btn { bottom:20px; right:50%; transform:translateX(50%); width:50px; height:50px; }

  /* Services */
  .services-grid { 
    grid-template-columns: repeat(2,1fr) !important; 
    grid-auto-rows: auto !important; 
    gap: 15px; 
  }
  .service-card.tall,
  .service-card.wide,
  .service-card.square {
    grid-row: span 1 !important;
    grid-column: span 1 !important;
    min-height: auto !important;
  }
  .services-grid.cols-3 { grid-template-columns:repeat(2,1fr); }
  .services-grid.cols-3 .service-card { padding:25px 15px; text-align:right; }
  .services-grid.cols-3 .service-card .icon { margin:0 0 20px auto; }
  .service-card { padding:25px 15px; text-align: start; }
  .service-card .icon { width:55px; height:55px; font-size:22px; margin: 0 0 20px 0; }
  .service-quote { padding-top: 15px; font-size: 11.5px; }

  /* Portfolio */
  .portfolio-grid { grid-template-columns:repeat(2,1fr); }
  .portfolio-card .image { height:220px; }
  .portfolio-card:hover .image img {
    transform: translateY(min(0px, calc(-100% + 220px)));
  }

  /* Stats */
  .stats-banner { margin:0; border-radius:0; padding:40px 15px; }
  .stats-banner .container { gap:20px; flex-wrap:wrap; justify-content:center; }
  .stat-item { min-width:120px; }
  .stat-item .number { font-size:30px; }
  .stat-item .label { font-size:12px; }

  /* Portfolio Bottom CTA Mobile & Tablet */
  .portfolio-bottom-cta { padding: 60px 0; min-height: auto; }
  .cta-astronaut-container { width: 180px; height: 175px; bottom: -10px; left: 3%; overflow: hidden; }
  
  @media (max-width: 480px) {
    .cta-astronaut-container { display: none; } /* Hide to avoid overlapping with centered button */
  }

  /* Partners */
  .partners-section { padding: 40px 0 20px; }
  .marquee-item { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
  .marquee-item img { height: 80px !important; }

  /* CTA */
  .cta-section { padding:60px 0; }
  .cta-section .container { flex-direction:column; text-align:center; gap:30px; }
  .cta-content { max-width:100%; }
  .cta-content h2 { font-size:30px; }
  .cta-image { max-width:100%; order:1; }
  .cta-image img { max-width:400px; margin:0 auto; }

  /* Footer */
  .footer-grid { grid-template-columns:repeat(2,1fr); gap:30px; }
  .footer-bottom { flex-direction:column; gap:10px; text-align:center; }

  /* Inner Pages */
  .about-grid { grid-template-columns:1fr; gap:30px; }
  .contact-grid { grid-template-columns:1fr; }
  .pricing-grid { grid-template-columns:1fr; gap:20px; }
  .pricing-card.featured { transform:none; }
  .values-grid { grid-template-columns:repeat(2,1fr); }
  .project-detail-grid { grid-template-columns:1fr; }
  .section-title h2 { font-size:28px; }
  .section { padding:60px 0; }
  .page-hero { padding:120px 0 50px; }
  .page-hero h1 { font-size:30px; }
  .blog-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

/* === Mobile (≤768px) === */
@media(max-width:768px) {
  /* clip بدل hidden: يمنع السكرول الأفقي دون إنشاء حاوية سكرول تكسر position:sticky (الهيرو القصصي) */
  html, body { overflow-x: clip !important; max-width: 100% !important; }
  .container { padding:0 15px; }
  .profile-cards { flex-direction:column; align-items:stretch; }
  .profile-card { min-width:auto; padding:18px 20px; }

  /* Hero Mobile Redesign */
  .hero { min-height:auto; padding:100px 0 45px; position: relative; overflow: hidden; }
  .hero-content h1 { font-size:26px; line-height:1.35; font-weight:800; margin-bottom: 15px; letter-spacing:-0.5px; }
  .hero-content h1 span {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #7a4f78 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    position: relative;
  }
  .hero-content h1 span::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 10%;
    width: 80%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--primary-light), transparent);
    border-radius: 2px;
    box-shadow: 0 0 8px var(--primary-light);
  }
  .hero-content p { font-size:14px; line-height: 1.7; margin-bottom: 25px; }
  .hero-image { position: relative; display: flex; justify-content: center; align-items: center; margin-bottom: 30px; }
  .hero-image::after {
    content: '';
    position: absolute;
    width: 240px;
    height: 240px;
    background: radial-gradient(circle, rgba(122,79,120,0.18) 0%, rgba(90,47,88,0) 70%);
    border-radius: 50%;
    filter: blur(20px);
    z-index: 1;
    pointer-events: none;
  }
  .hero-image img { max-height:280px; z-index: 2; position: relative; }
  .hero-video-btn {
    position: absolute !important;
    bottom: -15px;
    left: 50% !important;
    right: auto !important;
    transform: translateX(-50%) !important;
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.75) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 32px rgba(90,47,88,0.2) !important;
    color: var(--primary) !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 5 !important;
    animation: heroPlayPulse 2s infinite ease-in-out;
  }
  @keyframes heroPlayPulse {
    0% { box-shadow: 0 0 0 0 rgba(122,79,120,0.4); transform: scale(1); }
    70% { box-shadow: 0 0 0 10px rgba(122,79,120,0); transform: scale(1.05); }
    100% { box-shadow: 0 0 0 0 rgba(122,79,120,0); transform: scale(1); }
  }
  .hero-stats { gap:20px; }
  .hero-stat .number { font-size:22px; }
  .hero-stat .label { font-size:11px; }
  .floating-circle { display:none; }
  
  /* Disable heavy canvas & bubbles on mobile for absolute performance */
  #heroParticles { display: none !important; }
  .glow-bubble { display: none !important; }
  
  /* FAQ Mobile adjustments */
  .faq-section { padding: 60px 0; }
  .faq-question { font-size: 15px; }
  .faq-header { padding: 18px 20px; }
  .faq-content { padding: 0 20px 18px 20px; font-size: 13.5px; }
  .faq-toggle-icon { width: 32px; height: 32px; font-size: 12px; }

  /* Services */
  .services-grid { grid-template-columns:1fr 1fr; gap:12px; }
  .services-grid.cols-3 { grid-template-columns:1fr 1fr; }
  .services-grid.cols-3 .service-card { padding:20px 12px; }
  .service-card { padding:20px 12px; }
  .service-card .icon { width:50px; height:50px; font-size:20px; margin-bottom:12px; }
  .service-card h3 { font-size:14px; }
  .service-card p { font-size:12px; }

  /* Portfolio */
  .portfolio-grid { grid-template-columns:1fr; }
  .portfolio-card .image { height:200px; }
  .portfolio-swiper { padding-bottom: 20px; overflow: hidden !important; }
  
  /* Robust CSS fallback for Portfolio Swiper when Swiper JS is not initialized (offline/CDN fail) */
  .portfolio-swiper:not(.swiper-initialized) {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-snap-type: x mandatory !important;
    padding: 10px 0 25px !important;
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
  }
  .portfolio-swiper:not(.swiper-initialized)::-webkit-scrollbar {
    display: none !important;
  }
  .portfolio-swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    gap: 16px !important;
    width: auto !important;
  }
  .portfolio-swiper:not(.swiper-initialized) .swiper-slide {
    width: 85% !important;
    max-width: 310px !important;
    flex-shrink: 0 !important;
    scroll-snap-align: start !important;
  }
  
  .portfolio-card .card-body { padding: 18px 15px; }
  .portfolio-title { font-size: 16px; }

  /* Mobile Swipe Hint */
  .portfolio-swipe-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 25px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    transition: opacity 0.4s ease, visibility 0.4s ease;
  }
  .portfolio-swipe-hint .hint-text {
    font-size: 12px;
    letter-spacing: 0.5px;
  }
  .portfolio-swipe-hint .hint-line {
    position: relative;
    width: 45px;
    height: 3px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
  }
  .portfolio-swipe-hint .hint-line::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 16px;
    height: 100%;
    background: var(--primary);
    border-radius: 10px;
    animation: hintSwipeAnim 1.6s infinite cubic-bezier(0.4, 0, 0.2, 1);
  }
  @keyframes hintSwipeAnim {
    0% { transform: translateX(35px); }
    100% { transform: translateX(-35px); }
  }

  /* Stats */
  .stats-banner { margin:0 !important; border-radius:0 !important; width:100% !important; padding:45px 16px !important; }
  .stats-banner .container { display:grid; grid-template-columns:repeat(2,1fr); gap:24px 15px; }
  .stats-banner .container .stat-item:last-child:nth-child(odd) { grid-column:span 2; justify-self:center; width:100%; max-width:220px; }
  .stat-item .number { font-size:26px; }
  .stat-item .icon { font-size:20px; }

  /* Partners */
  .partners-section { padding: 40px 0 20px; }
  .marquee-item { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
  .marquee-item img { height: 65px !important; }

  /* CTA */
  .cta-section { padding:50px 0; }
  .cta-content h2 { font-size:26px; }
  .cta-content p { font-size:15px; margin-bottom:25px; }
  .cta-image img { max-width:300px; border-radius:16px; }

  /* Footer */
  .footer { padding:50px 0 20px; }
  .footer-grid { grid-template-columns:1fr; gap:25px; }
  .footer-col { text-align:center; }
  .footer-col img { margin: 0 auto 15px auto !important; }
  .footer-col h3::after { right:50%; transform:translateX(50%); }
  .footer-social { justify-content:center; }

  /* Blog */
  .blog-grid { grid-template-columns:1fr; }

  /* Section titles */
  .section-title { margin-bottom:35px; }
  .section-title h2 { font-size:24px; }
  .section-title p { font-size:14px; }
  .section-title .subtitle { font-size:14px; }
  .section-title .subtitle::before, .section-title .subtitle::after { width:25px !important; }

  /* Page Hero */
  .page-hero { padding:100px 0 40px; }
  .page-hero h1 { font-size:26px; }
  .page-hero p { font-size:14px; }

  /* Contact */
  .contact-info h3 { font-size:22px; }
  .info-item { padding:12px; }

  /* Pricing */
  .pricing-card { padding:30px 20px; }
  .pricing-card .price { font-size:32px; }

  /* Swiper arrows */
  .swiper-button-next, .swiper-button-prev { display:none; }

  /* Blog Post Detail Mobile */
  .post-detail-wrapper { padding: 25px 20px; }
  .post-featured-image { margin-bottom: 25px; max-height: 320px; }
  .post-content-body { font-size: 15.5px; line-height: 2.0; }
  .post-content-body h2 { font-size: 20px; margin: 30px 0 15px; }
  .post-content-body h2::before { height: 20px; }
  .post-content-body h3 { font-size: 18px; margin: 25px 0 12px; }
  .post-content-body blockquote { padding: 15px 20px; margin: 20px 0; }
  .post-share-bar { margin-top: 35px; padding-top: 25px; flex-direction: column; align-items: flex-start; gap: 15px; }
}

/* === Small Mobile (≤480px) === */
@media(max-width:480px) {
  /* Hero */
  .hero { padding:80px 0 35px; }
  .hero-content h1 { font-size:24px; }
  .hero-content p { font-size:13.5px; margin-bottom:20px; }
  .hero-buttons { flex-direction:column; align-items:center; gap:10px; }
  .hero-buttons .btn { width:100%; justify-content:center; }
  .hero-stats { flex-wrap:wrap; gap:12px; }
  .hero-stat { min-width:70px; }
  .hero-stat .number { font-size:20px; }
  .hero-image img { max-height:240px; }
  .hero-image::after { width: 200px; height: 200px; }
  .hero-video-btn { bottom: -15px; left: 50% !important; transform: translateX(-50%) !important; width: 48px; height: 48px; font-size: 18px; }
  .hero-image { margin-bottom: 25px; }

  /* Buttons */
  .btn { padding:12px 22px; font-size:13px; }
  .btn-sm { padding:10px 18px; font-size:12px; }

  /* Services */
  .services-grid { grid-template-columns:1fr !important; gap:12px; }
  .services-grid.cols-3 { grid-template-columns:1fr; }
  .services-grid.cols-3 .service-card { display:flex; flex-direction:row; align-items:center; gap:15px; text-align:right; padding:18px 15px; }
  .services-grid.cols-3 .service-card .icon { margin:0; flex-shrink:0; width:50px; height:50px; }
  .service-card { display:flex; flex-direction:row; align-items:center; gap:15px; text-align:right; padding:18px 15px; }
  .service-card .icon { margin:0; flex-shrink:0; width:50px; height:50px; }
  .service-card-info { flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; text-align:right; }
  .service-card h3 { font-size:15px; margin-bottom:0; }
  .service-card p { font-size:12px; margin:0; line-height:1.5; }
  .service-quote { display: none !important; }

  /* Stats */
  .stats-banner .container { grid-template-columns:repeat(2,1fr); gap:18px 12px; }
  .stat-item .number { font-size:22px; }
  .stat-item .label { font-size:11px; }

  /* Partners */
  .partners-nav { display:none; }
  .partners-track-container { overflow-x:auto; -webkit-overflow-scrolling:touch; }
  .partners-track { justify-content:flex-start; gap:15px; padding:0 10px; }
  .marquee-item { background: transparent !important; border: none !important; box-shadow: none !important; padding: 0 !important; }
  .marquee-item img { height:60px !important; }

  /* CTA */
  .cta-section { padding:40px 0; }
  .cta-content h2 { font-size:22px; }
  .cta-content p { font-size:13px; }
  .cta-image img { max-width:100%; }

  /* Footer */
  .footer-col p { font-size:13px; }

  /* Values */
  .values-grid { grid-template-columns:1fr; }

  /* Project Detail */
  .project-gallery { grid-template-columns:repeat(2,1fr); gap:10px; }
  .project-sidebar { padding:20px; }

  /* Blog */
  .blog-card .image { height:160px; }
  .blog-card .content { padding:15px; }
  .blog-card h3 { font-size:14px; }
}

/* === Preloader Mobile === */
@media(max-width:768px) {
  .mp-word { font-size:24px; gap:12px; }
  .mp-word i { font-size:28px; }
  .mp-logo { height:70px; }
  .mp-brand { font-size:24px; }
  .mp-slogan { font-size:13px; letter-spacing:3px; }
  .mp-glow { width:120px; height:120px; }
}

/* === Scroll to Top Mobile === */
@media(max-width:768px) {
  .scroll-top { bottom: 100px; width: 40px; height: 40px; font-size: 16px; }
  html[dir="rtl"] .scroll-top { left: 30px; right: auto; }
  html[dir="ltr"] .scroll-top { right: 30px; left: auto; }

  /* Chatbot Mobile (Shifted to bottom) */
  .mah-chat { bottom: 30px !important; }
}

/* === Admin Login Mobile === */
@media(max-width:600px) {
  .login-card { margin:15px; padding:30px 20px; }
  .login-card h2 { font-size:22px; }
}
