/* ==========================================================================
   DEVCRAFT STUDIO — PRODUCTION RESPONSIVE ENGINE (320px to 4K)
   Ensures 100% flawless viewing, zero horizontal overflow, and touch optimization
   on all Android phones, iPhones, tablets, laptops, and ultra-wide screens.
   ========================================================================== */

/* --------------------------------------------------------------------------
   GLOBAL VIEWPORT & OVERFLOW RESILIENCY
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
}

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

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

pre, code, kbd, samp {
  max-width: 100%;
  overflow-x: auto;
  word-break: break-word;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   LARGE SCREENS / DESKTOPS (min-width: 1280px)
   -------------------------------------------------------------------------- */
@media (min-width: 1280px) {
  .container {
    max-width: 1240px;
  }
}

/* --------------------------------------------------------------------------
   LAPTOPS & MEDIUM SCREENS (max-width: 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

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

  .hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero-bio {
    margin-left: auto;
    margin-right: auto;
    max-width: 680px;
  }

  .hero-offerings-pills,
  .hero-cta-group,
  .hero-channels {
    justify-content: center;
  }

  .hero-canvas-container {
    height: 380px;
    order: -1;
    width: 100%;
    max-width: 650px;
    margin: 0 auto;
  }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

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

  .cart-layout-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .cart-summary-panel {
    position: static;
    top: auto;
  }
}

/* --------------------------------------------------------------------------
   TABLETS & MOBILE DEVICES (max-width: 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .section {
    padding: 60px 0;
  }

  .section-title {
    font-size: 1.85rem;
  }

  .section-subtitle {
    font-size: 0.95rem;
    padding: 0 8px;
  }

  .hero-headline {
    font-size: clamp(2rem, 6.5vw, 2.6rem);
    line-height: 1.25;
  }

  .hero-greeting {
    font-size: 1.15rem;
  }

  .nav-links,
  .nav-actions .btn-hire-nav {
    display: none;
  }

  .mobile-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: var(--bg-surface);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
  }

  /* Mobile Fullscreen Slide-Down Drawer */
  .mobile-drawer {
    position: fixed;
    top: 72px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 15, 23, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 24px 20px 40px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
    z-index: 998;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-drawer.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
  }

  .mobile-nav-link {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 12px 4px;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
  }

  .mobile-nav-link:hover,
  .mobile-nav-link.active {
    color: var(--cyan);
  }

  .mobile-drawer-cta {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-drawer-cta .btn {
    width: 100%;
    justify-content: center;
  }

  /* Grids Stack */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .service-card {
    padding: 22px 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hero-canvas-container {
    height: 300px;
  }

  .floating-actions-bar {
    bottom: 16px;
    right: 16px;
    gap: 10px;
  }

  .floating-btn {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 14px;
    text-align: center;
  }

  /* Cart & data table responsive wrapper */
  .cart-table-wrap,
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    margin-bottom: 20px;
  }

  .cart-table {
    min-width: 520px;
  }

  /* Flagship Products Section */
  .flagship-grid {
    grid-template-columns: 1fr !important;
    gap: 24px;
  }

  .flagship-card {
    padding: 22px 16px;
  }

  .terminal-mockup-body {
    padding: 14px;
    font-size: 0.8rem;
    min-height: 160px;
  }

  .voice-wave-simulator {
    padding: 16px;
  }
}

/* --------------------------------------------------------------------------
   MODALS ON MOBILE & TABLET (< 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .devcraft-modal-dialog {
    width: 95vw !important;
    max-width: 95vw !important;
    max-height: 92vh !important;
    margin: 16px auto;
    padding: 20px 16px !important;
    border-radius: 16px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  .checkout-form-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .product-modal-body-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  .product-modal-actions {
    flex-direction: column;
    gap: 10px;
  }

  .product-modal-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .price-breakdown-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  /* UPI QR Modal on mobile */
  #upi-qr-container {
    max-width: 100%;
    padding: 14px;
  }

  #upi-qr-image {
    width: 180px !important;
    height: 180px !important;
  }

  #upi-utr-form-wrap {
    padding: 12px !important;
  }
}

/* --------------------------------------------------------------------------
   SMALL MOBILE PHONES (max-width: 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .section {
    padding: 48px 0;
  }

  .hero-headline {
    font-size: clamp(1.75rem, 7.5vw, 2.15rem);
    letter-spacing: -0.02em;
  }

  .hero-greeting {
    font-size: 1.05rem;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

  .hero-cta-group .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-offerings-pills {
    gap: 6px;
  }

  .hero-pill {
    font-size: 0.76rem;
    padding: 4px 10px;
  }

  .hero-canvas-container {
    height: 250px;
  }

  .glass-card {
    padding: 18px 14px;
    border-radius: 12px;
  }

  .contact-info-card,
  .form-card {
    padding: 20px 14px;
    border-radius: 12px;
  }

  .form-control,
  .form-select,
  .form-textarea {
    font-size: 0.9rem;
    padding: 10px 12px;
  }

  .toast {
    min-width: unset;
    width: calc(100vw - 32px);
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .floating-actions-bar {
    bottom: 12px;
    right: 12px;
    gap: 8px;
  }

  .floating-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }

  /* UPI UTR input stacking for easy typing */
  #upi-utr-form-wrap > div:has(#upi-utr-input) {
    flex-direction: column !important;
    gap: 8px !important;
  }

  #upi-utr-input {
    width: 100% !important;
  }

  #upi-verify-btn {
    width: 100% !important;
    justify-content: center;
  }

  /* Coupon input stacking */
  .coupon-input-wrap {
    flex-direction: column;
    gap: 8px;
  }

  .coupon-input-wrap .btn {
    width: 100%;
  }

  /* Cart Summary */
  .cart-summary-panel {
    padding: 16px;
  }

  .cart-sum-total {
    font-size: 1.1rem;
  }

  /* Badges & tags wrap */
  .product-badges-row {
    flex-wrap: wrap;
    gap: 6px;
  }
}

/* --------------------------------------------------------------------------
   ULTRA-COMPACT SCREENS (max-width: 360px - e.g. iPhone SE, Galaxy Fold cover)
   -------------------------------------------------------------------------- */
@media (max-width: 360px) {
  .hero-headline {
    font-size: 1.6rem;
  }

  .section-title {
    font-size: 1.55rem;
  }

  .devcraft-modal-dialog {
    width: 98vw !important;
    max-width: 98vw !important;
    padding: 14px 10px !important;
  }

  #upi-qr-image {
    width: 150px !important;
    height: 150px !important;
  }

  .btn {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}
