/* ==========================================================================
   1024TeraBoxDL — Responsive Stylesheet (responsive.css)
   Mobile-first adjustments, touch targets, and viewport breakpoints
   Tested for: 320px, 360px, 375px, 390px, 414px, Tablet, Desktop
   ========================================================================== */

/* Viewport Global Overflow Guard */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
  box-sizing: border-box;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* Tablet & Medium Screens (<= 900px) */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

/* Small Tablets & Large Phones (<= 768px) */
@media (max-width: 768px) {
  .site-header {
    height: 60px;
  }

  .nav-desktop {
    display: none;
  }
  
  .mobile-menu-toggle {
    display: flex;
    width: 38px;
    height: 38px;
  }

  .header-actions {
    gap: 8px;
  }

  .theme-toggle-btn {
    width: 38px;
    height: 38px;
  }

  .lang-dropdown-btn {
    padding: 5px 10px;
    font-size: 0.82rem;
  }
  
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  
  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
  
  .content-block {
    padding: 24px;
  }
  
  .rating-container {
    padding: 24px;
  }
}

/* Mobile Devices (<= 640px) */
@media (max-width: 640px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .downloader-card {
    padding: 20px 16px;
  }
  
  .input-group-wrapper {
    padding: 2px 4px 2px 12px;
    flex-wrap: wrap;
  }
  
  .downloader-input {
    width: 100%;
    padding: 10px 0;
  }
  
  .input-actions {
    width: 100%;
    justify-content: flex-end;
    padding-bottom: 8px;
  }
  
  .downloader-submit-row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .btn-download-main {
    width: 100%;
  }
  
  .downloader-hints {
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
  }
  
  .skeleton-container.active {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .skeleton-thumbnail {
    width: 100%;
    height: 160px;
  }

  /* Result Card Mobile Layout */
  .result-card {
    padding: 20px 16px;
  }
  
  .result-layout {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  
  .result-thumb-box {
    width: 100%;
    height: 180px;
    max-height: 200px;
  }

  .result-details {
    width: 100%;
    min-width: 0;
  }

  .result-actions {
    width: 100%;
  }

  .result-actions .btn {
    flex: 1 1 140px;
    justify-content: center;
  }
}

/* Mobile Phones (<= 480px: 414px, 390px, 375px) */
@media (max-width: 480px) {
  .container {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Header Optimization for 375px - 414px */
  .site-header {
    height: 56px;
  }

  .header-inner {
    gap: 8px;
  }

  .brand-logo-wrap {
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
  }

  .logo-placeholder {
    width: 32px;
    height: 32px;
    font-size: 0.95rem;
    border-radius: 6px;
  }

  .brand-name {
    font-size: 1.05rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-actions {
    gap: 6px;
    flex-shrink: 0;
  }

  .btn-review-modal {
    padding: 4px 8px;
    font-size: 0.78rem;
    height: 34px;
    gap: 4px;
  }

  .theme-toggle-btn {
    width: 34px;
    height: 34px;
  }

  .mobile-menu-toggle {
    width: 34px;
    height: 34px;
  }

  .lang-dropdown-btn {
    padding: 4px 8px;
    font-size: 0.78rem;
    gap: 4px;
    height: 34px;
  }


  .lang-globe-icon {
    width: 14px;
    height: 14px;
  }

  .lang-arrow-icon {
    width: 10px;
    height: 10px;
  }

  .hero-section {
    padding: 24px 0 16px 0;
  }
  
  .hero-title {
    font-size: 1.65rem;
  }
  
  .promo-banner {
    padding: 20px 16px;
  }

  /* Result Card Optimization */
  .result-card {
    padding: 16px 12px;
  }

  .result-thumb-box {
    height: 160px;
  }

  .result-title {
    font-size: 1.05rem;
  }

  .result-meta-tags {
    gap: 8px;
  }

  .result-actions {
    gap: 8px;
  }

  .result-actions .btn {
    flex: 1 1 100%;
    width: 100%;
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}

/* Small Phones (<= 360px down to 320px) */
@media (max-width: 360px) {
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }

  /* Header Fit for 320px & 360px - Guaranteed Zero Horizontal Scroll */
  .site-header {
    height: 52px;
  }

  .header-inner {
    gap: 4px;
  }

  .brand-logo-wrap {
    gap: 6px;
  }

  .logo-placeholder {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
    border-radius: 5px;
  }

  .brand-name {
    font-size: 0.92rem;
    letter-spacing: -0.03em;
  }

  .header-actions {
    gap: 4px;
  }

  .btn-review-modal {
    padding: 3px 6px;
    height: 30px;
    font-size: 0.72rem;
    gap: 2px;
  }

  .btn-review-modal .btn-review-text {
    display: none; /* Show ⭐ icon only on ultra-compact 320px screens */
  }

  .theme-toggle-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
  }


  .theme-toggle-btn svg {
    width: 16px;
    height: 16px;
  }

  .mobile-menu-toggle {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
  }

  .mobile-menu-toggle svg {
    width: 18px;
    height: 18px;
  }

  .lang-dropdown-btn {
    padding: 3px 6px;
    height: 30px;
    font-size: 0.72rem;
    gap: 3px;
  }

  .lang-globe-icon {
    display: none; /* Hide globe icon at <= 360px to prevent overflow */
  }

  .lang-arrow-icon {
    width: 8px;
    height: 8px;
  }

  .hero-title {
    font-size: 1.45rem;
  }

  .downloader-card {
    padding: 16px 10px;
  }

  .result-thumb-box {
    height: 140px;
  }

  .result-meta-tags .meta-tag {
    font-size: 0.75rem;
    padding: 3px 8px;
  }
}

/* Review Modal Mobile Screen Adjustments */
@media (max-width: 520px) {
  .review-modal-card {
    max-height: 94vh;
    border-radius: var(--radius-md);
  }
  .review-modal-header {
    padding: 14px 16px;
  }
  .review-modal-title {
    font-size: 1.1rem;
  }
  .review-modal-body {
    padding: 16px;
  }
  .star-rating-selector .star-btn {
    font-size: 1.85rem;
    padding: 2px 2px;
  }
}

