/* ==========================================================================
   Sinhala Dubbed Cartoons & Movies - Responsive Media Queries
   ජංගම දුරකථන සහ ටැබ්ලට් සඳහා ප්‍රශස්තකරණය
   ========================================================================== */

/* Mobile Bottom Navigation Bar */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(8, 11, 18, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  padding: 0.45rem 1rem;
  z-index: 4000;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-family: var(--font-sinhala);
  cursor: pointer;
  padding: 0.3rem;
  transition: color var(--transition-fast);
}

.mobile-nav-item span.icon {
  font-size: 1.2rem;
}

.mobile-nav-item.active,
.mobile-nav-item:hover {
  color: var(--accent-gold);
}

/* Mobile Drawer Overlay */
.mobile-nav-drawer {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  z-index: 6000;
  transition: left var(--transition-smooth);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.mobile-nav-drawer.active {
  left: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  list-style: none;
}

.drawer-links a, .drawer-links button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 1.05rem;
  color: var(--text-primary);
  background: transparent;
  border: none;
  font-family: var(--font-sinhala);
  cursor: pointer;
  text-align: left;
  padding: 0.5rem 0;
}

/* ==========================================================================
   Breakpoints
   ========================================================================== */

/* Universal Overflow Protection across all devices */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}

/* Tablets and below (max-width: 1024px) */
@media (max-width: 1024px) {
  .hero-carousel-wrapper {
    min-height: 420px;
  }
  .hero-title {
    font-size: 2.2rem;
  }
  .hero-content {
    padding: 2rem;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
  }
}

/* Mobile Devices (max-width: 768px) */
@media (max-width: 768px) {
  body {
    padding-bottom: 75px; /* Space for bottom nav */
  }

  .container {
    padding: 0 0.85rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Header mobile layout */
  .site-header {
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 0.65rem 0;
    box-sizing: border-box;
  }

  .header-inner {
    width: 100%;
    max-width: 100%;
    gap: 0.5rem;
  }

  /* Compact Brand Logo */
  .brand-logo {
    gap: 0.45rem;
    flex-shrink: 0;
  }
  .brand-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .brand-name {
    font-size: 1.12rem;
    letter-spacing: -0.3px;
  }
  .brand-tagline {
    display: none !important;
  }

  /* Search Input flexes nicely */
  .header-search-wrapper {
    flex: 1;
    min-width: 0;
    max-width: none;
    position: relative;
  }
  .search-input {
    padding: 0.5rem 1.8rem 0.5rem 2.2rem;
    font-size: 0.82rem;
  }
  .search-icon-left {
    left: 0.75rem;
    font-size: 0.85rem;
  }
  .search-kbd-hint {
    display: none;
  }

  /* Mobile Live Search Suggestions Dropdown */
  .search-suggestions-dropdown {
    position: fixed !important;
    top: 56px !important;
    left: 0.75rem !important;
    right: 0.75rem !important;
    width: auto !important;
    max-height: 65vh !important;
    border-radius: 14px !important;
    z-index: 5000 !important;
    background: rgba(10, 15, 28, 0.98) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.95), 0 0 24px rgba(245, 158, 11, 0.15) !important;
    padding: 0.5rem !important;
  }

  .search-sug-item {
    padding: 0.6rem 0.7rem;
    gap: 0.75rem;
  }

  .search-sug-thumb {
    width: 44px;
    height: 58px;
    border-radius: 6px;
    flex-shrink: 0;
  }

  .search-sug-title-en {
    font-size: 0.9rem;
    font-weight: 700;
  }

  .search-sug-title-si {
    font-size: 0.78rem;
  }

  /* Header Actions: hide Request and Admin buttons from header (available in hamburger drawer) */
  .header-actions {
    gap: 0.4rem;
    flex-shrink: 0;
  }
  .header-actions .nav-link-btn,
  .header-actions #btnOpenRequestModal,
  .header-actions a[href="admin.html"],
  .header-actions a[href*="sinhalaflixhub200616791870"] {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
  }

  /* Mobile Bottom Navigation Bar */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Hero Banner Carousel */
  .hero-banner-section {
    padding: 0.35rem 0 1rem;
  }
  .hero-carousel-wrapper {
    min-height: 520px;
    width: 100%;
    border-radius: var(--radius-md);
  }

  .hero-slide {
    align-items: flex-end;
  }

  .hero-content {
    padding: 1.1rem 0.9rem 0.85rem;
    width: 100%;
    box-sizing: border-box;
    margin-top: auto;
  }

  .hero-badges {
    gap: 0.35rem;
    margin-bottom: 0.35rem;
  }

  .hero-title {
    font-size: 1.48rem;
    margin-bottom: 0.2rem;
    line-height: 1.2;
  }

  .hero-subtitle {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
  }

  .hero-meta {
    gap: 0.75rem;
    font-size: 0.82rem;
    margin-bottom: 0.45rem;
  }

  .hero-desc {
    font-size: 0.84rem;
    line-height: 1.4;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    width: 100%;
  }

  .hero-actions .btn:first-child {
    width: 100%;
    padding: 0.72rem 1rem;
    font-size: 0.95rem;
  }

  .hero-actions .btn:nth-child(2) {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.85rem;
    font-size: 0.88rem;
  }

  .hero-actions .btn:nth-child(3) {
    width: 44px;
    flex: 0 0 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
  }

  .hero-indicators {
    bottom: 0.5rem;
    right: 0.75rem;
  }

  /* Filter bar */
  .filter-bar-container {
    padding: 1rem 0.85rem;
    margin-bottom: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: var(--radius-md);
  }

  .category-tabs-list {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
  }

  .filter-sub-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
  }

  .channel-pills-list {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .channel-pills-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .sort-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .sort-pills-list {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  .sort-pills-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .catalog-grid,
  .continue-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
    width: 100%;
  }

  .cartoon-card {
    border-radius: 10px;
    background: #0d1527;
    border: 1px solid rgba(255, 255, 255, 0.08);
  }

  .card-info {
    padding: 0.55rem 0.6rem;
  }

  .card-meta-top {
    font-size: 0.68rem;
    margin-bottom: 0.2rem;
  }

  .card-title-main {
    font-size: 0.82rem;
    line-height: 1.25;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 0.15rem;
  }

  .card-title-sub {
    font-size: 0.72rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
  }

  .card-ep-tag {
    font-size: 0.58rem;
    padding: 0.06rem 0.28rem;
  }

  .card-meta-bottom {
    font-size: 0.68rem;
    padding-top: 0.35rem;
  }

  .badge-cat-tag {
    font-size: 0.6rem;
    padding: 0.1rem 0.35rem;
    max-width: 105px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-bookmark-btn {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .card-title-si {
    font-size: 0.95rem;
  }

  .detail-hero-layout {
    grid-template-columns: 1fr;
  }

  .detail-poster-img {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 16 / 9;
    margin: 0 auto;
  }

  /* Site Footer full width */
  .site-footer {
    padding: 2.5rem 0 5.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    width: 100%;
  }

  .footer-brand p {
    max-width: 100%;
    font-size: 0.85rem;
    line-height: 1.6;
  }

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

  .controls-row {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .volume-slider {
    width: 50px;
  }

  .video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
  }

  .toast-container {
    bottom: 5.5rem;
    right: 0.75rem;
    left: 0.75rem;
  }

  .toast-message {
    max-width: 100%;
  }

  .modal-container {
    max-height: 94vh;
    width: 100%;
    margin: 0 0.5rem;
  }

  .modal-body {
    padding: 1rem;
  }
}

/* Very Small Smart Phones (max-width: 480px) */
@media (max-width: 480px) {
  .container {
    padding: 0 0.65rem;
  }

  .hero-carousel-wrapper {
    min-height: 510px;
  }

  .hero-content {
    padding: 1rem 0.75rem 0.75rem;
  }

  .hero-title {
    font-size: 1.35rem;
    margin-bottom: 0.15rem;
  }

  .hero-subtitle {
    font-size: 0.82rem;
    margin-bottom: 0.25rem;
  }

  .hero-badges .badge-featured,
  .hero-badges .badge-channel,
  .hero-badges .badge-audio {
    font-size: 0.7rem;
    padding: 0.18rem 0.45rem;
  }

  .hero-meta {
    font-size: 0.78rem;
    gap: 0.6rem;
    margin-bottom: 0.35rem;
  }

  .hero-desc {
    font-size: 0.8rem;
    line-height: 1.35;
    margin-bottom: 0.65rem;
  }

  .hero-actions .btn:first-child {
    width: 100%;
    padding: 0.68rem 0.85rem;
    font-size: 0.9rem;
  }

  .hero-actions .btn:nth-child(2) {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem;
    font-size: 0.82rem;
  }

  .hero-actions .btn:nth-child(3) {
    width: 42px;
    flex: 0 0 42px;
    height: 42px;
    font-size: 1.1rem;
  }

  .catalog-grid,
  .continue-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.55rem !important;
  }

  .cat-scroll-arrow {
    display: none !important;
  }

  .category-tabs-wrapper::before,
  .category-tabs-wrapper::after {
    width: 24px;
  }
}
