/* =============================================
   QR CODE GENERATOR - Responsive Design
   ============================================= */

/* Large Desktop (1200px and below) */
@media (max-width: 1200px) {
  .hero h1 { font-size: 3rem; }
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; gap: 32px; }
}

/* Desktop (1024px and below) */
@media (max-width: 1024px) {
  .hero .container { grid-template-columns: 1fr; gap: 40px; text-align: center; }
  .hero-content { padding: 20px 0; }
  .hero p { margin: 0 auto 32px; }
  .hero-buttons { justify-content: center; }
  .hero-visual { order: -1; }
  .hero-float-card:nth-child(2) { right: 5%; }
  .hero-float-card:nth-child(3) { left: 5%; }

  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; gap: 40px; }

  .qr-generator-layout { grid-template-columns: 1fr; }
  .qr-preview-area { order: -1; }
}

/* Tablet & Mobile (768px and below) */
@media (max-width: 768px) {
  .section { padding: 60px 0; }
  .section-header h2 { font-size: 2rem; }
  .section-header { margin-bottom: 40px; }

  .navbar .container {
    padding: 0 12px !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
  }

  .navbar-logo {
    font-size: 1rem !important;
    gap: 6px !important;
    flex-shrink: 1 !important;
    min-width: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .navbar-logo .logo-icon {
    width: 30px !important;
    height: 30px !important;
    font-size: 1rem !important;
    flex-shrink: 0 !important;
  }

  .navbar-links { display: none; margin-left: 0 !important; }
  .navbar-actions { gap: 6px !important; flex-shrink: 0 !important; display: flex !important; align-items: center !important; margin-left: auto !important; }
  .navbar-actions .btn { display: none; }
  .navbar-actions #google_translate_element { display: inline-block !important; flex-shrink: 0 !important; }
  .navbar-actions .theme-toggle, .navbar-actions #themeToggle { display: flex !important; margin: 0 !important; width: 32px !important; height: 32px !important; padding: 0 !important; font-size: 1rem !important; flex-shrink: 0 !important; align-items: center; justify-content: center; }
  
  .goog-te-gadget .goog-te-combo {
    padding: 4px 6px !important;
    font-size: 0.75rem !important;
    max-width: 85px !important;
  }

  .nav-toggle { display: flex !important; margin: 0 0 0 6px !important; padding: 6px !important; flex-shrink: 0 !important; align-self: center !important; }

  .navbar-links.active {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-left: 0 !important;
    background: var(--bg-card);
    padding: 0;
    gap: 0;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--border);
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    z-index: 1001;
  }
  .navbar-links.active a {
    display: block;
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 1rem;
    color: var(--text);
  }
  .navbar-links.active a::after {
    display: none !important;
  }
  .navbar-links.active a.active {
    color: var(--primary);
    background: rgba(91,91,255,0.05);
  }

  .navbar-links.active .nav-dropdown {
    display: block !important;
    width: 100%;
  }
  .navbar-links.active .nav-dropdown-toggle {
    display: flex !important;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 1rem;
    color: var(--text);
  }
  .navbar-links.active .nav-dropdown-menu {
    display: none !important;
    position: static !important;
    transform: none !important;
    width: calc(100% - 24px);
    margin: 8px auto 12px;
    min-width: 0;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: none;
    padding: 6px;
    background: var(--bg);
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .navbar-links.active .nav-dropdown.open .nav-dropdown-menu {
    display: grid !important;
  }
  .navbar-links.active .nav-dropdown-menu a {
    display: flex !important;
    padding: 10px 14px !important;
    font-size: 0.9rem !important;
    border-radius: var(--radius-sm);
    background: transparent;
  }
  .navbar-links.active .nav-dropdown-menu a:hover {
    background: rgba(91,91,255,0.08) !important;
  }

  .hero { min-height: auto; padding: 120px 0 60px; }
  .hero h1 { font-size: 2.2rem; }
  .hero p { font-size: 1rem; }
  .hero-qr-showcase { width: 240px; height: 240px; }
  .hero-float-card { display: none; }

  .features-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 24px; }
  .stat-item h3 { font-size: 2rem; }

  .timeline { grid-template-columns: repeat(2, 1fr); }
  .timeline::before { display: none; }

  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; margin: 0 auto; }
  .templates-grid { grid-template-columns: repeat(2, 1fr); }
  .testimonial-card { min-width: 280px; }

  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }

  .page-header { padding: 100px 0 40px; }
  .page-header h1 { font-size: 2.2rem; }

  .contact-form .form-row { grid-template-columns: 1fr; }

  .qr-generator-section { padding: 20px; }
  .qr-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
  .qr-tab { flex-shrink: 0; }

  /* Back to top button adjustment for mobile bottom navigation */
  .back-to-top-btn {
    bottom: 148px !important;
    right: 20px !important;
    width: 36px !important;
    height: 36px !important;
    z-index: 9999 !important;
  }
  .back-to-top-btn svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Ad layout: 1 ad centered on mobile */
  .ad-row-wrapper {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    margin: 20px auto !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .ad-slot {
    margin: 0 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    max-width: 100% !important;
  }
  .ad-slot iframe {
    margin: 0 auto !important;
    display: block !important;
  }
  .ad-slot.ad-left,
  .ad-slot.ad-right {
    display: none !important;
  }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
  html { font-size: 14px; }
  body { overflow-x: hidden; width: 100%; position: relative; }
  html { overflow-x: hidden; width: 100%; }
  
  /* Clamp all negative-positioned decorative elements to prevent overflow */
  .hero-blob-1 { left: -200px; }
  .hero-blob-2 { right: -200px; }
  .hero-blob-3 { display: none; }
  .hero-gradient { right: -50%; }
  .hero-float-card { display: none; }

  .container { padding: 0 10px; }

  .navbar { padding: 12px 0; }
  .navbar.scrolled { padding: 8px 0; }
  .navbar-logo { font-size: 0.92rem !important; }
  .goog-te-gadget .goog-te-combo { max-width: 70px !important; font-size: 0.7rem !important; padding: 3px 4px !important; }
  .nav-toggle { margin-left: 2px !important; }

  .hero { min-height: auto; padding: 100px 0 40px; }
  .hero h1 { font-size: 1.6rem; letter-spacing: -0.01em; }
  .hero p { font-size: 0.95rem; margin-bottom: 20px; }
  .hero-badge { font-size: 0.75rem; padding: 4px 12px; }
  .hero-visual { overflow: visible; padding: 28px 0 18px; }
  .hero-qr-showcase { width: 160px; height: 160px; padding: 16px; }
  .hero-buttons { flex-direction: column; align-items: center; }
  .hero-buttons .btn { width: 100%; text-align: center; }
  .hero .container { gap: 20px; }

  .section { padding: 40px 0; }
  .section-header { margin-bottom: 24px; }
  .section-header h2 { font-size: 1.4rem; }
  .section-header p { font-size: 0.9rem; }

  .features-grid { gap: 12px; }
  .feature-card { padding: 20px; }
  .feature-card .icon-wrap { width: 40px; height: 40px; font-size: 1.2rem; margin-bottom: 12px; }
  .feature-card h3 { font-size: 1rem; }
  .feature-card p { font-size: 0.85rem; }

  .stats { padding: 40px 0; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .stat-item h3 { font-size: 1.5rem; }
  .stat-item p { font-size: 0.8rem; }

  .timeline { grid-template-columns: 1fr; gap: 16px; }
  .timeline-step { display: flex; gap: 12px; text-align: left; align-items: flex-start; }
  .timeline-step .step-number { width: 40px; height: 40px; font-size: 1rem; flex-shrink: 0; margin: 0; }
  .timeline-step h4 { font-size: 0.95rem; margin-bottom: 4px; }
  .timeline-step p { font-size: 0.8rem; }

  .templates-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .template-card { padding: 16px 12px; }
  .template-card .template-icon { font-size: 1.8rem; margin-bottom: 8px; }
  .template-card h4 { font-size: 0.85rem; }
  .template-card p { font-size: 0.75rem; }

  .testimonial-card { min-width: 240px; padding: 20px; }
  .testimonial-card p { font-size: 0.85rem; }

  .faq-question { padding: 14px 16px; font-size: 0.9rem; }
  .faq-answer { font-size: 0.85rem; }
  .faq-item.open .faq-answer { padding: 0 16px 14px; }

  .footer { padding: 40px 0 20px; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-col h4 { font-size: 0.9rem; margin-bottom: 12px; }
  .footer-col a { font-size: 0.85rem; margin-bottom: 8px; }
  .footer-newsletter { flex-direction: column; }
  .footer-newsletter .btn { width: 100%; }
  .footer-bottom { flex-direction: column; text-align: center; gap: 8px; }
  .footer-bottom p { font-size: 0.8rem; }

  .pricing-card { padding: 24px 16px; }
  .pricing-card .price { font-size: 2rem; }

  .page-header { padding: 80px 0 30px; }
  .page-header h1 { font-size: 1.6rem; }
  .page-header p { font-size: 0.9rem; }

  /* === QR GENERATOR MOBILE === */
  .qr-generator-section { padding: 12px; margin: 12px 0; border-radius: var(--radius-lg); overflow: hidden; }
  .qr-generator-layout { gap: 16px; }
  .qr-form-area,
  .qr-form { overflow: hidden; }
  .qr-preview-container { width: 160px; height: 160px; margin: 0 auto; }
  .qr-customization { gap: 10px; width: 100%; }
  .customization-row { display: flex; flex-direction: column; gap: 8px; }
  .customization-group { display: flex; flex-direction: column; gap: 4px; }
  .customization-group label { font-size: 0.7rem; }
  .customization-group input[type="color"] { width: 40px; height: 40px; }
  .customization-group input[type="range"] { width: 100%; }
  .customization-group input[type="file"] { font-size: 0.8rem; width: 100%; }
  .qr-customization .btn { width: 100%; }
  .download-controls { margin-top: 4px; }
  .download-controls .btn { font-size: 0.75rem; padding: 6px 12px; }
  .download-controls [style*="flex-wrap"] { gap: 4px !important; }

  .qr-tabs-wrapper .qr-scroll-btn {
    display: flex;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.1rem;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    padding: 0;
    line-height: 1;
  }
  .qr-tabs-wrapper .qr-scroll-btn:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
  }
  .qr-tabs {
    gap: 4px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
  .qr-tabs::-webkit-scrollbar { display: none; }
  .qr-tab { font-size: 0.75rem; padding: 5px 10px; flex-shrink: 0; white-space: nowrap; }
  .qr-form-area .qr-tabs::-webkit-scrollbar { display: none; }

  .phone-input-wrapper { flex-direction: column; gap: 6px; }
  .phone-input-wrapper .country-code-select { width: 100%; min-width: 0; padding: 10px 12px; font-size: 0.9rem; }
  .phone-input-wrapper .phone-number-input { width: 100%; font-size: 0.9rem; padding: 10px 12px; }

  .form-group label { font-size: 0.8rem; }
  .form-input { padding: 10px 14px; font-size: 0.9rem; }
  .qr-form .form-group { width: 100%; }
  .qr-form .form-input,
  .qr-form input,
  .qr-form textarea,
  .qr-form select { width: 100% !important; max-width: 100% !important; min-width: 0; box-sizing: border-box !important; }

  .error-page h1 { font-size: 4rem; }
  .error-page h2 { font-size: 1.1rem; }
  .error-page p { font-size: 0.9rem; }

  .toast-container { left: 10px; right: 10px; top: 60px; }
  .toast { min-width: auto; font-size: 0.85rem; padding: 10px 14px; }

  .cookie-banner { flex-direction: column; text-align: center; padding: 14px 16px; gap: 10px; }
  .cookie-banner p { font-size: 0.8rem; }
  .cookie-banner .btn { width: 100%; }

  .bottom-nav { display: flex; padding: 4px 0; }
  .bottom-nav a { font-size: 0.65rem; padding: 2px 8px; }
  .bottom-nav a .nav-icon { font-size: 1.2rem; }
  .floating-generate { display: flex; width: 48px; height: 48px; font-size: 1.3rem; bottom: 70px; right: 14px; }

  body { padding-bottom: 56px; }

  .scanner-controls { flex-direction: column; align-items: center; }
  .scanner-controls .btn { width: 100%; }

  .contact-grid { gap: 24px; }
  .contact-info-item .icon { width: 40px; height: 40px; font-size: 1rem; }
  .contact-info-item h4 { font-size: 0.9rem; }
  .contact-info-item p { font-size: 0.85rem; }

  .hero-float-card { display: none; }
  .hero-visual { margin-bottom: 0; }
  .stats-grid { gap: 12px; }
}

/* Small phones (360px and below) */
@media (max-width: 360px) {
  .hero h1 { font-size: 1.5rem; }
  .hero-qr-showcase { width: 160px; height: 160px; }
  .navbar-logo { font-size: 1.1rem; }
  .navbar-logo .logo-icon { width: 30px; height: 30px; font-size: 1rem; }
  .testimonial-card { min-width: 220px; padding: 20px; }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { min-height: auto; padding: 100px 0 40px; }
  .hero .container { grid-template-columns: 1fr 1fr; gap: 24px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.85rem; margin-bottom: 16px; }
  .hero-qr-showcase { width: 140px; height: 140px; }
  .hero-buttons .btn { padding: 10px 20px; font-size: 0.85rem; }
  .section { padding: 40px 0; }
}

/* Print styles */
@media print {
  .navbar, .bottom-nav, .floating-generate, .toast-container, .cookie-banner, .pwa-install-banner {
    display: none !important;
  }
  body { padding-bottom: 0; }
  .hero { min-height: auto; padding: 40px 0; }
}

/* Dark mode responsive */
.dark-mode .hero-float-card { background: var(--bg-card); }
.dark-mode .navbar-links.active { background: var(--bg-card); }
