/* ==========================================================================
   Siddique Tech Solution - Comprehensive Responsive Stylesheet
   Author: Muhammad Mussab Siddique
   Optimized for: Ultra-Compact (320px), Mobile (360px-480px), Phablets (600px),
   Tablets (768px-868px), Laptops (1024px), & HiDPI Retina Screens
   ========================================================================== */

/* Universal Mobile Safeguards */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden !important;
  position: relative;
  -webkit-text-size-adjust: 100%;
}

body.nav-open {
  overflow: hidden !important;
  touch-action: none;
}

.mobile-nav-cta {
  display: none !important;
}

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

/* Prevent any container or grid item from forcing horizontal screen overflow */
.container,
.site-header,
.site-main,
.site-footer,
.hero-section,
.hero-grid,
.hero-content,
.hero-visual,
.hero-card-glow {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}

.badge-tech {
  max-width: 100% !important;
  white-space: normal !important;
  word-break: break-word !important;
}

/* ==========================================================================
   1. Large Tablets & Small Laptops (max-width: 1024px)
   ========================================================================== */
@media (max-width: 1024px) {
  :root {
    --header-height: 76px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 3rem;
  }

  .hero-content {
    max-width: 100%;
    margin: 0 auto;
  }

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

  .hero-stats-row {
    justify-content: center;
    max-width: 620px;
    margin: 2.5rem auto 0;
  }

  .hero-visual {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 3.5rem;
    text-align: center;
  }

  .about-image-wrapper {
    max-width: 480px;
    margin: 0 auto;
    width: 100%;
  }

  .about-content {
    max-width: 720px;
    margin: 0 auto;
  }

  .about-content h2,
  .about-lead,
  .about-highlights {
    text-align: left;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .cart-layout {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-top {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
}

/* ==========================================================================
   2. Medium Tablets & Mobile Navigation (max-width: 868px)
   ========================================================================== */
@media (max-width: 868px) {
  :root {
    --header-height: 72px;
  }

  /* Clear backdrop-filter on mobile to eliminate containing block clipping bug */
  .site-header,
  .site-header.scrolled {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: #050811 !important;
    border-bottom: 1px solid rgba(0, 229, 255, 0.2) !important;
  }

  /* Mobile Toggle Activation */
  .mobile-nav-toggle {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    transition: all var(--transition-fast);
    z-index: 1000001;
  }

  .mobile-nav-toggle:hover {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--cyan-glow);
  }

  .hamburger-line {
    display: block;
    width: 20px;
    height: 2px;
    margin: 3px 0;
    background-color: var(--cyan-glow);
    transition: all var(--transition-medium);
    border-radius: 2px;
  }

  .mobile-nav-toggle.open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .mobile-nav-toggle.open .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .mobile-nav-toggle.open .hamburger-line:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Mobile Navigation Slide-Down Drawer */
  .nav-menu {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    width: 100vw;
    height: calc(100vh - var(--header-height));
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: #050811 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 2px solid var(--border-hover);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.95), 0 0 25px rgba(0, 229, 255, 0.15);
    flex-direction: column;
    padding: 1.5rem 1.25rem 3rem;
    gap: 0;
    align-items: stretch;
    z-index: 1000000;
  }

  .nav-menu.open {
    display: flex !important;
  }

  .nav-menu li {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-menu a,
  .nav-menu .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-light);
    width: 100%;
    padding: 0.95rem 0.5rem;
    text-decoration: none;
    transition: color var(--transition-fast), padding-left var(--transition-fast);
  }

  .nav-menu a:hover,
  .nav-menu a:focus,
  .nav-menu .current-menu-item > a,
  .nav-menu .nav-link:hover,
  .nav-menu .nav-link.active {
    color: var(--cyan-glow);
    padding-left: 0.75rem;
  }

  .nav-menu a::after,
  .nav-menu .nav-link::after {
    display: none !important;
  }

  /* Real Semantic Mobile Free Consultation Link */
  .mobile-nav-cta {
    display: block !important;
    margin-top: 1.25rem !important;
    padding-top: 0.5rem !important;
    border-bottom: none !important;
  }

  .mobile-nav-cta a,
  .mobile-nav-cta a.mobile-cta-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    background: var(--grad-cyan-blue) !important;
    color: #050811 !important;
    font-family: var(--font-heading) !important;
    font-weight: 700 !important;
    font-size: 1rem !important;
    border-radius: 12px !important;
    padding: 0.95rem 1.25rem !important;
    box-shadow: 0 4px 20px rgba(0, 229, 255, 0.4) !important;
    text-align: center !important;
    text-decoration: none !important;
  }

  /* Header CTA Button - Hidden on mobile header to prevent crowding */
  .header-cta-btn {
    display: none !important;
  }

  .header-actions {
    gap: 0.75rem;
  }

  /* Reposition Floating Badges inside bounds */
  .float-card {
    position: static !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    margin: 1rem auto 0 !important;
    display: inline-flex !important;
    max-width: 100% !important;
  }

  .float-card-1, .float-card-2 {
    display: none !important;
  }

  /* Stack Form Rows */
  .form-row {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Fix Featured Pricing Card Overflow */
  .pricing-card.featured {
    transform: none !important;
  }
  .pricing-card.featured:hover {
    transform: translateY(-6px) !important;
  }
}

/* ==========================================================================
   3. Smartphones (max-width: 640px)
   ========================================================================== */
@media (max-width: 640px) {
  /* Container Padding */
  .container {
    padding-left: 1.15rem !important;
    padding-right: 1.15rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Responsive Section Spacing */
  .section-padding {
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
  }

  /* Fluid Typography for Mobile - Completely Eliminates Overflow */
  h1 {
    font-size: clamp(1.6rem, 6.8vw, 2.15rem) !important;
    line-height: 1.25 !important;
    letter-spacing: -0.02em !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }

  h2 {
    font-size: clamp(1.4rem, 5.5vw, 1.85rem) !important;
    line-height: 1.28 !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }

  h3 {
    font-size: 1.25rem !important;
    word-break: break-word !important;
  }

  .badge-tech {
    font-size: 0.72rem !important;
    letter-spacing: 0.02em !important;
    padding: 0.3rem 0.65rem !important;
    max-width: 100% !important;
    white-space: normal !important;
    word-break: break-word !important;
    line-height: 1.35 !important;
    display: inline-flex !important;
    align-items: center !important;
  }

  /* Hero Section */
  .hero-section {
    display: block !important;
    min-height: auto !important;
    padding-top: calc(var(--header-height) + 1.25rem) !important;
    padding-bottom: 3.5rem !important;
    overflow: hidden !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .hero-grid {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    gap: 2rem !important;
  }

  .hero-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  .hero-subtitle {
    font-size: 0.95rem !important;
    line-height: 1.6 !important;
    margin-top: 1rem !important;
    margin-bottom: 1.5rem !important;
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 100% !important;
  }

  .hero-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0.75rem !important;
  }

  .hero-actions .btn {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0.85rem 1.25rem !important;
    font-size: 0.95rem !important;
    box-sizing: border-box !important;
    text-align: center !important;
  }

  /* 3-Column Compact Stats Row with Zero Overflow */
  .hero-stats-row {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 0.4rem !important;
    padding: 1.15rem 0.5rem !important;
    margin-top: 1.75rem !important;
    background: rgba(13, 22, 45, 0.55) !important;
    border-radius: 16px !important;
    border: 1px solid var(--border-subtle) !important;
    box-sizing: border-box !important;
  }

  .stat-item {
    min-width: 0 !important;
    overflow: hidden !important;
    text-align: center !important;
  }

  .stat-item h3 {
    font-size: clamp(1.15rem, 3.8vw, 1.45rem) !important;
    white-space: nowrap !important;
    margin-bottom: 2px !important;
  }

  .stat-item p {
    font-size: 0.68rem !important;
    line-height: 1.2 !important;
    margin-top: 2px !important;
    word-break: break-word !important;
  }

  /* Hero Visual Card */
  .hero-card-glow {
    padding: 1.5rem 1.25rem;
    border-radius: 20px;
  }

  .hero-card-header {
    gap: 0.85rem;
  }

  .hero-card-logo {
    width: 44px;
    height: 44px;
  }

  .hero-features-list {
    margin: 1.25rem 0;
    gap: 0.75rem;
    font-size: 0.85rem;
  }

  .ceo-mini-endorsement {
    padding: 0.85rem;
    gap: 0.75rem;
  }

  .ceo-mini-img {
    width: 44px;
    height: 44px;
  }

  .ceo-mini-info h4 {
    font-size: 0.9rem;
  }

  .ceo-mini-info p {
    font-size: 0.72rem;
  }

  /* Services Grid - Clean Single Column on Mobile */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .service-card {
    padding: 1.6rem 1.35rem;
    border-radius: 18px;
  }

  .service-card h3 {
    font-size: 1.22rem;
    margin-top: 0.75rem;
  }

  .service-card p {
    font-size: 0.92rem;
    line-height: 1.55;
  }

  .service-card-meta {
    margin-top: 1.25rem;
    padding-top: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .service-card-meta .btn {
    width: 100%;
  }

  /* Pricing Grid & Cards */
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .pricing-card {
    padding: 2rem 1.4rem;
    border-radius: 20px;
  }

  .pricing-title {
    font-size: 1.35rem;
  }

  .pricing-amount {
    font-size: 2.8rem;
  }

  .pricing-features {
    gap: 0.75rem;
    font-size: 0.88rem;
    margin: 1.5rem 0;
  }

  .pricing-cta .btn {
    width: 100%;
    padding: 0.85rem;
  }

  /* Portfolio Grid */
  .portfolio-filters {
    gap: 0.5rem;
    margin-bottom: 2rem;
  }

  .filter-btn {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .portfolio-thumb {
    height: 200px;
  }

  .portfolio-info {
    padding: 1.35rem;
  }

  /* About CEO Section on Mobile */
  .about-image-wrapper {
    position: relative;
    max-width: 100%;
  }

  .about-badge-overlay {
    position: relative !important;
    bottom: auto !important;
    right: auto !important;
    left: auto !important;
    margin: -25px auto 0 !important;
    max-width: calc(100% - 24px) !important;
    padding: 1rem 1.25rem !important;
    border-radius: 16px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
  }

  .about-badge-overlay h4 {
    font-size: 1rem;
  }

  .about-badge-overlay p {
    font-size: 0.78rem;
  }

  .about-highlights {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1.5rem 0;
  }

  .highlight-box {
    padding: 1.1rem;
  }

  /* Contact Page on Mobile */
  .contact-info-card {
    padding: 1.75rem 1.35rem;
    border-radius: 20px;
  }

  .contact-item {
    gap: 0.85rem;
    margin-bottom: 1.4rem;
  }

  .contact-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .contact-item-text h4 {
    font-size: 0.98rem;
  }

  .contact-item-text p, 
  .contact-item-text a {
    font-size: 0.88rem;
    word-break: break-word;
  }

  /* Input fields - 16px font-size to prevent iOS Safari auto-zoom */
  .form-control,
  .newsletter-input {
    font-size: 16px !important;
    padding: 0.85rem 1rem;
    border-radius: 10px;
  }

  /* ==========================================================================
     Shopping Cart Responsive Card Layout for Mobile
     ========================================================================== */
  .cart-items-box,
  .cart-summary-box {
    padding: 1.5rem 1.2rem;
    border-radius: 20px;
  }

  .cart-table thead {
    display: none;
  }

  .cart-table, 
  .cart-table tbody, 
  .cart-table tr, 
  .cart-table td {
    display: block;
    width: 100%;
  }

  .cart-table tr {
    position: relative;
    padding: 1.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .cart-table tr:last-child {
    border-bottom: none;
  }

  .cart-table td {
    border: none;
    padding: 0.35rem 0;
  }

  /* Product details */
  .cart-item-info {
    gap: 0.75rem;
    padding-right: 40px;
  }

  .cart-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
  }

  .cart-item-title {
    font-size: 0.95rem;
  }

  .cart-item-plan {
    font-size: 0.75rem;
  }

  /* Delete / Remove Button - top right of row card */
  .cart-table td:nth-child(5) {
    position: absolute;
    top: 1.25rem;
    right: 0;
    width: auto;
    padding: 0;
  }

  .cart-remove-btn {
    width: 34px;
    height: 34px;
  }

  /* Controls and totals row */
  .cart-table td:nth-child(2) {
    display: inline-block;
    width: auto;
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.5rem;
  }

  .cart-table td:nth-child(3) {
    display: inline-block;
    width: auto;
    margin-left: 0.75rem;
    margin-top: 0.5rem;
  }

  .cart-table td:nth-child(4) {
    display: block;
    margin-top: 0.6rem;
    font-size: 1.1rem;
  }

  .cart-coupon-form {
    flex-direction: column;
    gap: 0.75rem;
  }

  .cart-coupon-form .btn {
    width: 100%;
  }

  .cart-summary-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .cart-summary-actions .btn {
    width: 100%;
  }

  /* Footer on Mobile */
  .footer-top {
    grid-template-columns: 1fr;
    gap: 2.25rem;
    margin-bottom: 2.5rem;
  }

  .footer-col h4 {
    margin-bottom: 1rem;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .footer-legal-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  /* Modal Window on Mobile */
  .modal-overlay {
    padding: 1rem;
    align-items: flex-end;
  }

  .modal-window {
    padding: 1.75rem 1.25rem;
    border-radius: 20px 20px 0 0;
    max-height: 90vh;
    overflow-y: auto;
    width: 100%;
  }

  .modal-close-btn {
    top: 1rem;
    right: 1rem;
  }

  /* Mobile Toast Alert */
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: calc(100% - 24px);
  }

  .toast {
    min-width: 100%;
    padding: 0.85rem 1.1rem;
  }

  /* Dedicated Admin Login on Mobile */
  .login-container {
    padding: 2.25rem 1.4rem;
    border-radius: 20px;
  }

  .login-title {
    font-size: 1.35rem;
  }
}

/* ==========================================================================
   4. Ultra-Compact Phones & Narrow Screens (max-width: 380px)
   ========================================================================== */
@media (max-width: 380px) {
  .brand-logo-img {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 0.98rem;
  }

  .brand-tagline {
    font-size: 0.6rem;
  }

  .cart-nav-btn {
    width: 38px;
    height: 38px;
  }

  .mobile-nav-toggle {
    width: 38px;
    height: 38px;
  }

  .hero-stats-row {
    gap: 0.25rem;
    padding: 1rem 0.35rem;
  }

  .stat-item h3 {
    font-size: 1.2rem;
  }

  .stat-item p {
    font-size: 0.66rem;
  }

  .btn {
    padding: 0.75rem 1.2rem;
    font-size: 0.88rem;
  }

  .service-card,
  .pricing-card,
  .contact-info-card,
  .cart-items-box,
  .cart-summary-box {
    padding: 1.4rem 1.1rem;
  }

  .filter-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.76rem;
  }
}
