/* Responsive — Mobile First */

/* Tablet (768px and up) */
@media (min-width: 768px) {
  .header-search { display: flex; }
  .search-form { display: flex; }
}

/* Mobile (under 1024px) */
@media (max-width: 1023px) {

  /* Show bottom nav */
  .bottom-nav {
    display: block;
  }

  /* Hide desktop nav */
  .main-navigation {
    display: none;
  }

  /* Show mobile menu toggle */
  .mobile-menu-toggle {
    display: flex;
  }

  /* Compact header */
  .header-search {
    flex: 1;
  }
  .search-field {
    width: 100%;
  }
  .search-form {
    width: 100%;
  }

  /* Site content padding for bottom nav */
  .site-content {
    padding-bottom: calc(var(--xreel-bottom-nav-height) + 24px);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

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

  .footer-menu {
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* Mobile (under 768px) */
@media (max-width: 767px) {

  /* Reduce header height */
  :root {
    --xreel-header-height: 56px;
  }

  .header-container {
    padding: 0 12px;
    gap: 8px;
  }

  .logo-text {
    font-size: 18px;
  }

  .logo-icon {
    width: 28px;
    height: 28px;
  }

  .search-field {
    width: 140px;
  }

  /* Site main padding */
  .site-main {
    padding: 12px;
  }

  /* Hero */
  .hero-banner {
    height: 320px;
    border-radius: var(--xreel-radius);
  }

  .hero-slide {
    padding: 20px;
  }

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

  .hero-title {
    font-size: 22px;
  }

  .hero-desc {
    font-size: 13px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Sections */
  .home-sections {
    gap: 24px;
  }

  .section-title-row {
    font-size: 16px;
  }

  /* Series card */
  .section-carousel .series-card {
    width: 130px;
  }

  .series-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .series-card-title {
    font-size: 12px;
  }

  /* Series detail */
  .single-series {
    padding-top: 8px;
  }

  .series-hero {
    height: 280px;
    border-radius: var(--xreel-radius);
  }

  .series-hero-content {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px;
    gap: 12px;
  }

  .series-poster {
    width: 100px;
    height: 150px;
  }

  .series-title {
    font-size: 20px;
  }

  .series-meta {
    font-size: 12px;
    gap: 12px;
  }

  /* Episode grid */
  .episodes-grid {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
  }

  .ep-card {
    font-size: 14px;
  }

  /* Related */
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
  }

  /* Watch page */
  .watch-page {
    padding-top: 8px;
  }

  .player-wrapper {
    border-radius: var(--xreel-radius-sm);
  }

  .episode-nav {
    padding: 8px 12px;
  }

  .episode-info h1 {
    font-size: 18px;
  }

  /* Search page */
  .search-box form {
    flex-direction: column;
    gap: 8px;
  }

  .search-box input,
  .search-box button {
    width: 100%;
  }

  /* 404 */
  .error-code {
    font-size: 80px;
  }

  .error-title {
    font-size: 20px;
  }

  .error-actions {
    flex-direction: column;
    gap: 8px;
  }

  .error-actions .btn-primary,
  .error-actions .btn-secondary {
    width: 100%;
    justify-content: center;
  }

  /* Continue watching cards */
  .continue-watching-list {
    grid-template-columns: 1fr;
  }
}

/* Small mobile (under 480px) */
@media (max-width: 479px) {

  /* Hide logo text — keep icon only */
  .logo-text {
    display: none;
  }

  /* Hide footer fully on small mobile */
  .site-footer {
    display: none;
  }

  /* Series grid — 3 columns */
  .series-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .section-carousel .series-card {
    width: 120px;
  }

  /* Episode grid — 5 columns */
  .episodes-grid {
    grid-template-columns: repeat(5, 1fr);
  }

  /* Smaller bottom nav labels */
  .bottom-nav-item span {
    font-size: 9px;
  }

  /* Hero */
  .hero-banner {
    height: 280px;
  }

  .hero-title {
    font-size: 18px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn-primary,
  .hero-actions .btn-secondary {
    justify-content: center;
    padding: 12px 20px;
  }
}

/* Landscape phones */
@media (max-width: 900px) and (orientation: landscape) {
  .player-wrapper {
    aspect-ratio: 16/9;
    max-height: 70vh;
  }
}

/* Print */
@media print {
  .site-header,
  .site-footer,
  .bottom-nav,
  .player-wrapper,
  .episode-nav {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast */
@media (prefers-contrast: high) {
  :root {
    --xreel-border: rgba(255,255,255,0.5);
    --xreel-text-secondary: #ffffff;
    --xreel-text-muted: #cccccc;
  }
}
