/* ==========================================================================
   RESPONSIVE DESIGN & MOBILE BAR ADAPTATIONS
   BOBIWINE MOVIES — Pixel-perfect alignment for Mobile, Tablet & Desktop
   ========================================================================== */

/* Base main container padding for bottom clearance */
#appMain {
  padding-bottom: 40px;
}

/* Mobile Bottom Navigation Bar */
.nv-mobile-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 17, 21, 0.94);
  border-top: 1px solid var(--nv-border);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nv-mobile-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--nv-text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all var(--nv-duration-fast) ease;
  user-select: none;
}

.nv-mobile-tab svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.2px;
  transition: transform var(--nv-duration-fast) ease;
}

.nv-mobile-tab.active {
  color: var(--nv-accent);
}

.nv-mobile-tab.active svg {
  stroke: var(--nv-accent);
  transform: scale(1.1);
}

/* --------------------------------------------------------------------------
   TABLET ADAPTATIONS (769px to 1024px)
   -------------------------------------------------------------------------- */
@media (min-width: 769px) and (max-width: 1024px) {
  .nv-nav-pill {
    padding: 4px 8px;
    gap: 2px;
  }

  .nv-nav-link {
    padding: 6px 10px;
    font-size: 12.5px;
  }

  .nv-nav-brand {
    padding: 4px 10px 4px 6px;
  }

  .nv-brand-name {
    font-size: 14px;
  }

  .nv-poster-card {
    flex: 0 0 160px;
    width: 160px;
  }

  .nv-vj-filter-bar {
    padding: 14px 4vw 8px 4vw;
  }
}

/* --------------------------------------------------------------------------
   MOBILE & SMALL TABLET SCREENS (<= 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  /* Show Mobile Bottom Bar */
  .nv-mobile-bottom-bar {
    display: flex;
  }

  /* Prevent bottom content from being blocked by the 64px mobile bar */
  #appMain,
  #homeContainer,
  #searchContainer {
    padding-bottom: calc(76px + env(safe-area-inset-bottom, 16px));
  }

  /* Compact Top Navbar */
  .nv-nav-wrapper {
    top: 8px;
    padding: 0 10px;
  }

  .nv-nav-pill {
    padding: 3px 8px;
    gap: 6px;
  }

  .nv-nav-link {
    display: none; /* Handled by bottom mobile bar */
  }

  .nv-nav-divider {
    display: none;
  }

  .nv-search-shortcut {
    display: none;
  }

  .nv-brand-logo-img {
    width: 26px;
    height: 26px;
  }

  .nv-brand-name {
    font-size: 13.5px;
  }

  /* Mobile Catalog Segment Bar: pinned floating below website name button with clean spacing */
  .nv-mobile-catalog-bar {
    display: flex;
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    z-index: 999;
    justify-content: center;
    margin: 0;
    padding: 0 10px;
    pointer-events: none;
  }

  .nv-mobile-catalog-bar .nv-catalog-pill {
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  /* Hero Billboard Section: covers all the way to top under floating pills */
  .nv-hero {
    position: relative;
    width: 100%;
    height: auto;
    min-height: 520px;
    margin-top: 0;
    padding-top: 0;
    overflow: hidden;
  }

  .nv-hero-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
  }

  .nv-hero-content {
    padding: 124px 5vw 28px 5vw;
    gap: 10px;
  }

  .nv-hero-title {
    font-size: 1.8rem;
    line-height: 1.15;
    word-break: break-word;
  }

  .nv-hero-meta {
    font-size: 12px;
    gap: 8px;
  }

  .nv-hero-overview {
    font-size: 13px;
    line-height: 1.5;
    -webkit-line-clamp: 2;
  }

  .nv-hero-dots {
    display: none;
  }

  .nv-hero-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
  }

  .nv-btn-play {
    padding: 9px 18px;
    font-size: 13.5px;
  }

  .nv-btn-secondary {
    padding: 9px 15px;
    font-size: 13px;
  }

  /* Content Catalog Rows */
  .nv-content-section {
    padding: 16px 0 24px 0;
  }

  .nv-section-header {
    padding: 0 5vw 10px 5vw;
  }

  .nv-section-title {
    font-size: 17px;
  }

  .nv-section-controls {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  .nv-section-controls .nv-row-nav-btn {
    display: none !important; /* Touch mobile devices use native swipe */
  }

  .nv-row-track {
    padding: 4px 5vw 12px 5vw;
    gap: 12px;
  }

  /* Poster Cards */
  .nv-poster-card {
    flex: 0 0 135px;
    width: 135px;
  }

  .nv-card-info {
    margin-top: 7px;
    padding: 2px 2px 0 2px;
    gap: 3px;
  }

  .nv-card-title {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
    height: 31px; /* Uniform height ensures all cards align on the exact same baseline */
  }

  .nv-card-sub {
    font-size: 10.5px;
    line-height: 1.35;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
  }

  .nv-card-sub span {
    white-space: nowrap;
  }

  .nv-sub-vj {
    color: #c084fc;
    font-weight: 700;
  }

  .nv-card-overlay {
    opacity: 1;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 45%);
    pointer-events: none;
  }

  .nv-card-play-icon {
    display: none; /* Mobile users tap anywhere on the card */
  }

  /* Mobile Download Button: always visible and tappable */
  .nv-card-dl-btn {
    pointer-events: auto;
    opacity: 0.95;
    bottom: 6px;
    right: 6px;
    width: 30px;
    height: 30px;
  }

  /* Detail Modal (Bottom Sheet on Mobile) */
  .nv-modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .nv-modal-window {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    border-bottom: none;
  }

  .nv-detail-hero {
    height: 240px;
  }

  .nv-detail-body {
    padding: 0 16px calc(60px + env(safe-area-inset-bottom, 16px)) 16px;
    margin-top: -50px;
  }

  .nv-detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
  }

  .nv-detail-poster {
    flex: 0 0 120px;
    width: 120px;
  }

  .nv-detail-main {
    align-items: center;
  }

  .nv-detail-title {
    font-size: 1.45rem;
  }

  .nv-detail-badges {
    justify-content: center;
    gap: 6px;
    font-size: 11.5px;
  }

  .nv-detail-actions {
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nv-detail-actions button {
    padding: 9px 16px;
    font-size: 13px;
  }

  /* Series Episodes */
  .nv-episodes-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .nv-episode-card {
    padding: 8px 10px;
    gap: 10px;
  }

  .nv-episode-thumb {
    width: 90px;
    height: 56px;
  }

  .nv-episode-name {
    font-size: 13px;
  }

  .nv-ep-dl-btn {
    flex-shrink: 0;
    min-width: 32px;
    height: 32px;
  }

  /* Search View Container */
  .nv-search-container {
    padding: 124px 5vw calc(80px + env(safe-area-inset-bottom, 16px)) 5vw;
  }

  .nv-search-bar-wrap {
    margin-bottom: 18px;
  }

  .nv-filter-pills {
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 8px;
    padding-bottom: 4px;
  }

  .nv-filter-pills::-webkit-scrollbar {
    display: none;
  }

  .nv-grid-results {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
  }

  /* Cinema Embed Player View */
  .nv-player-topbar {
    padding: 10px 12px;
  }

  .nv-player-back-btn {
    left: 10px;
    top: 10px;
    padding: 6px 10px;
  }

  .nv-player-back-btn span {
    display: none;
  }

  .nv-player-title-info {
    max-width: 65%;
  }

  .nv-player-title {
    font-size: 13px;
    max-width: 100%;
  }

  .nv-player-sub {
    font-size: 11px;
    display: block;
    max-width: 100%;
  }

  .nv-server-switcher {
    padding: 2px;
    gap: 2px;
  }

  .nv-server-btn {
    font-size: 10px;
    padding: 4px 6px;
  }

  .nv-player-action-btn {
    padding: 6px 8px;
    font-size: 11px;
  }

  .nv-player-action-btn span {
    display: none;
  }

  /* Universal Download Modal */
  .nv-download-modal-window {
    max-width: 95vw;
    padding: 20px 16px;
  }

  .nv-download-server-card {
    padding: 10px 12px;
  }

  /* See More / See All Buttons */
  .nv-see-all-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    padding: 5px 12px;
    border-radius: var(--nv-radius-pill);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--nv-accent, #00DC82);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .nv-see-all-btn:hover,
  .nv-see-all-btn:active {
    background: rgba(0, 220, 130, 0.2);
    border-color: var(--nv-accent, #00DC82);
    color: var(--nv-accent, #00DC82);
  }

  .nv-category-container {
    padding: 70px 3.5vw 60px 3.5vw;
  }

  .nv-category-header {
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
  }

  .nv-category-title {
    font-size: 18px;
  }

  .nv-category-back-btn {
    padding: 6px 12px;
    font-size: 12.5px;
  }
}

/* Extra small mobile screens (<= 380px) */
@media (max-width: 380px) {
  .nv-poster-card {
    flex: 0 0 118px;
    width: 118px;
  }

  .nv-card-title {
    font-size: 11px;
    height: 28px;
  }

  .nv-card-sub {
    font-size: 9.5px;
    gap: 1px 3px;
  }

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

  .nv-hero-title {
    font-size: 1.55rem;
  }

  .nv-player-title {
    max-width: 80px;
  }
}

/* ==========================================================================
   Mobile Fullscreen Landscape Rotation Fallback
   Forces true landscape fill when mobile device is held in portrait
   ========================================================================== */
@media (max-width: 1024px) {
  .nv-player-view.nv-fullscreen-landscape {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    width: 100vh !important;
    height: 100vw !important;
    transform: translate(-50%, -50%) rotate(90deg) !important;
    transform-origin: center center !important;
    z-index: 999999 !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    overflow: hidden !important;
  }
}
