/**
 * WAZAIF COUNTER — RESPONSIVE MEDIA QUERIES & MOBILE OPTIMIZATION
 * Fully responsive on all mobile devices, tablets, and viewports.
 * Desktop layout (width > 1024px) remains 100% untouched.
 */

/* Global Responsive Base Safeguards */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
}

/* Ensure link text underlines are removed globally */
a, a:hover, a:focus, a:visited {
  text-decoration: none !important;
}

/* DEFAULT BASE STATE: Strictly hide mobile drawer & overlay by default everywhere */
.mobile-nav-overlay,
.mobile-nav-drawer {
  display: none !important;
}

/* DESKTOP SAFEGUARD: Strictly hide mobile menu elements on desktop (width > 768px) */
@media (min-width: 769px) {
  .mobile-nav-drawer,
  .mobile-nav-overlay,
  .nav-toggle {
    display: none !important;
  }
  .header-download-btn {
    display: inline-flex !important;
  }
}

/* ==========================================================================
   BREAKPOINT 1: LAPTOPS & TABLETS (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }

  .hero-content p {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-ctas {
    justify-content: center;
  }

  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }

  .footer-brand {
    grid-column: span 3;
  }

  .quran-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

/* ==========================================================================
   BREAKPOINT 2: MOBILE SCREENS & TABLETS (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  /* Hide Desktop Navigation bar */
  .desktop-nav {
    display: none !important;
  }

  /* --- MINIMAL MOBILE HEADER LAYOUT ---
     [ ☰ Menu ]                [ 🟢 Wazaif Counter ]                [ 🌙 Theme ]
  */
  .header-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
    gap: 0.5rem !important;
  }

  .header-actions {
    display: contents !important;
  }

  /* Hamburger Menu Icon (Start / Far Left) */
  .nav-toggle {
    display: flex !important;
    order: 1 !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    border-radius: var(--radius-md, 0.5rem) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    color: var(--text-primary) !important;
    flex-shrink: 0 !important;
    margin-right: auto !important;
    cursor: pointer !important;
  }

  /* Brand Logo (Center) */
  .brand-logo {
    order: 2 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.4rem !important;
    font-size: 1.05rem !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    margin: 0 auto !important;
    flex-shrink: 1 !important;
  }

  .brand-logo span {
    white-space: nowrap !important;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.01em !important;
    display: inline-block !important;
  }

  .brand-logo-mark img {
    width: 26px !important;
    height: 26px !important;
    flex-shrink: 0 !important;
  }

  /* Theme Toggle Icon (End / Far Right) */
  .theme-toggle-btn {
    order: 3 !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-left: auto !important;
    flex-shrink: 0 !important;
    border-radius: var(--radius-md, 0.5rem) !important;
    border: 1px solid var(--border-color) !important;
    background: var(--bg-surface) !important;
    cursor: pointer !important;
  }

  /* Header Download Button - Hidden if any stray exists */
  .header-download-btn {
    display: none !important;
  }

  /* --- MOBILE SECTION & CONTAINER SPACING --- */
  .section {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
  }

  .page-hero {
    padding-top: 5.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  /* --- MOBILE CARDS & GRIDS RESPONSIVENESS (ALL PAGES) --- */

  /* 1. All Multi-Column Grids convert to 1 column on Mobile */
  .grid-2, 
  .grid-3, 
  .grid-4, 
  .features-grid, 
  .cards-grid, 
  .tech-grid, 
  .stats-grid,
  .quran-stats-grid,
  .contact-grid,
  .download-grid,
  .roadmap-grid,
  .feedback-grid,
  .legal-grid {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    width: 100% !important;
  }

  /* 2. Landing Page Procedure Step Cards Fix */
  .procedure-grid {
    grid-template-columns: 1fr !important;
    gap: 3.5rem 1.5rem !important;
    margin-top: 2.5rem !important;
  }

  .procedure-card-wrapper {
    position: relative !important;
    margin-bottom: 1rem !important;
    width: 100% !important;
  }

  /* Unify procedure badges to top center for all cards on Mobile */
  .procedure-card-wrapper.top-badge .procedure-badge,
  .procedure-card-wrapper.bottom-badge .procedure-badge {
    position: absolute !important;
    top: -28px !important;
    bottom: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    width: 56px !important;
    height: 56px !important;
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.25) !important;
  }

  /* Accent frame pseudo-element unification on mobile */
  .procedure-card-wrapper.top-badge::before,
  .procedure-card-wrapper.bottom-badge::before {
    top: 10px !important;
    bottom: -6px !important;
    left: -4px !important;
    right: -4px !important;
  }

  .procedure-card-wrapper.top-badge .procedure-card,
  .procedure-card-wrapper.bottom-badge .procedure-card {
    padding-top: 2.25rem !important;
    padding-bottom: 1.5rem !important;
    padding-left: 1.25rem !important;
    padding-right: 1.25rem !important;
    text-align: center !important;
  }

  /* 3. Universal Card Component Mobile Styling across All Pages */
  .card, 
  .feature-card, 
  .initiative-card,
  .card-tech,
  .card-shariah,
  .card-mentorship,
  .blessing-card,
  .changelog-acc-card,
  .changelog-brand-box,
  .changelog-group-card,
  .dua-box,
  .faq-item,
  .download-option-card,
  .roadmap-card,
  .timeline-item,
  .policy-card,
  .contact-info-card,
  .stat-card,
  .leader-landscape-card,
  .attribution-item {
    padding: 1.5rem 1.25rem !important;
    border-radius: var(--radius-lg, 1rem) !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .notice-box {
    padding: 1rem 1.1rem !important;
    gap: 0.75rem !important;
    margin-bottom: 1.75rem !important;
  }

  .notice-icon {
    font-size: 1.3rem !important;
  }

  /* 4. Footer Mobile Layout */
  .footer-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 2rem 1.5rem !important;
  }

  .footer-brand {
    grid-column: span 2 !important;
  }

  .device-mockup {
    width: 250px !important;
    height: 500px !important;
    border-width: 8px !important;
    border-radius: 40px !important;
    margin: 0 auto !important;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3) !important;
  }

  .mockup-wrapper {
    padding: 1.5rem 0.5rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  .floating-chip {
    padding: 0.45rem 0.8rem !important;
    font-size: 0.75rem !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15) !important;
  }

  .floating-chip-1 {
    top: 6% !important;
    left: 4px !important;
  }

  .floating-chip-2 {
    bottom: 10% !important;
    right: 4px !important;
  }

  /* 404 Error Page Mobile Responsive Adjustments */
  .error-section {
    padding-top: 6rem !important;
    padding-bottom: 3.5rem !important;
  }

  .error-card {
    padding: 2.25rem 1.25rem !important;
    border-radius: 1.5rem !important;
  }

  .error-code {
    font-size: 4.8rem !important;
  }

  .error-title {
    font-size: 1.6rem !important;
  }

  .error-desc {
    font-size: 0.95rem !important;
    margin-bottom: 1.75rem !important;
  }

  .error-ctas {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.75rem !important;
  }

  .error-ctas .btn {
    width: 100% !important;
  }

  .error-hero-bg {
    width: 320px !important;
    height: 320px !important;
  }

  /* Stack Back-to-Top Button neatly above reCAPTCHA badge */
  .back-to-top {
    bottom: 85px !important;
    right: 1rem !important;
    width: 44px !important;
    height: 44px !important;
  }
}

/* ==========================================================================
   BREAKPOINT 3: SMALL MOBILE PHONES (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
  .container {
    padding-left: 0.85rem !important;
    padding-right: 0.85rem !important;
  }

  .section-title {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
  }

  .section-subtitle {
    font-size: 0.925rem !important;
  }

  .hero-title {
    font-size: 1.8rem !important;
    line-height: 1.25 !important;
  }

  .hero-subtitle {
    font-size: 0.925rem !important;
  }

  .hero-ctas {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.85rem !important;
  }

  .hero-ctas .btn {
    width: 100% !important;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2rem !important;
  }

  .footer-brand {
    grid-column: span 1 !important;
  }

  /* Form Controls Full Width on Small Mobile */
  .form-input, .form-textarea, .form-group {
    width: 100% !important;
  }

  /* Smartphone Mockup & Floating Chips for Small Phones */
  .device-mockup {
    width: 220px !important;
    height: 440px !important;
    border-width: 6px !important;
    border-radius: 34px !important;
  }

  .floating-chip-1 {
    top: 4% !important;
    left: -2px !important;
  }

  .floating-chip-2 {
    bottom: 6% !important;
    right: -2px !important;
  }

  /* Prevent text & long URLs from breaking container bounds */
  p, a, span, h1, h2, h3, h4, h5, h6 {
    overflow-wrap: break-word !important;
    word-break: break-word !important;
  }

  /* WhatsApp Channel Footer Card Mobile Responsiveness */
  .whatsapp-channel-card {
    flex-direction: column !important;
    text-align: center !important;
    padding: 1.5rem 1.25rem !important;
    gap: 1.25rem !important;
    margin-bottom: 2.5rem !important;
  }
  .whatsapp-card-content {
    flex-direction: column !important;
    text-align: center !important;
    gap: 0.85rem !important;
  }
  .btn-whatsapp {
    width: 100% !important;
    justify-content: center !important;
  }

  /* Master Dual CTA Footer Deck Mobile Responsiveness */
  .footer-master-cta {
    grid-template-columns: 1fr !important;
    gap: 1.5rem !important;
    margin-bottom: 3rem !important;
  }

  .master-cta-card {
    padding: 1.75rem 1.35rem !important;
    text-align: left !important;
  }

  .cta-card-top {
    justify-content: space-between !important;
  }

  .cta-card-action .playstore-badge,
  .cta-card-action .btn-whatsapp {
    width: 100% !important;
    justify-content: center !important;
  }
}
