/* ==========================================================================
   DSR4U-Streamify — Global Styles & Variables
   ========================================================================== */

   :root {
    --bg-primary: #080a10;
    --bg-secondary: #0f131f;
    --bg-card: rgba(18, 24, 38, 0.7);
    --bg-card-hover: rgba(26, 34, 54, 0.9);
    --bg-glass: rgba(15, 19, 31, 0.75);
    
    --accent-red: #e50914;
    --accent-red-hover: #ff1e27;
    --accent-glow: rgba(229, 9, 20, 0.35);
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(229, 9, 20, 0.5);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px var(--accent-glow);
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
  }
  
  a {
    text-decoration: none;
    color: inherit;
  }
  
  button, input, select {
    font-family: inherit;
    font-size: inherit;
    outline: none;
    border: none;
  }
  
  /* ==========================================================================
     Navigation Bar
     ========================================================================== */
  
  .navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    transition: background-color var(--transition-normal);
  }
  
  .nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }
  
  .nav-left, .nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
  }
  
  .brand-logo {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 0.2rem;
  }
  
  .logo-red {
    color: var(--accent-red);
  }
  
  .logo-white {
    color: #fff;
  }
  
  .badge-tag {
    background: var(--accent-red);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    margin-left: 6px;
  }
  
  .nav-links {
    display: flex;
    gap: 0.5rem;
  }
  
  .nav-btn {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-fast);
  }
  
  .nav-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
  }
  
  .nav-btn.active {
    color: #fff;
    background: rgba(229, 9, 20, 0.15);
    border: 1px solid rgba(229, 9, 20, 0.3);
  }
  
  .nav-pill {
    background: var(--accent-red);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
  }
  
  .search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.45rem 1rem;
    width: 260px;
    transition: all var(--transition-fast);
  }
  
  .search-box:focus-within {
    border-color: var(--border-focus);
    box-shadow: 0 0 12px var(--accent-glow);
    width: 320px;
    background: rgba(255, 255, 255, 0.08);
  }
  
  .search-box i {
    color: var(--text-dim);
    margin-right: 0.6rem;
    font-size: 0.9rem;
  }
  
  .search-box input {
    background: transparent;
    color: #fff;
    width: 100%;
  }
  
  .search-box input::placeholder {
    color: var(--text-dim);
  }
  
  .clear-btn {
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    display: none;
    font-size: 0.8rem;
  }
  
  .clear-btn:hover {
    color: #fff;
  }
  
  /* ==========================================================================
     Buttons
     ========================================================================== */
  
  .btn {
    cursor: pointer;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all var(--transition-fast);
  }
  
  .btn-primary {
    background: var(--accent-red);
    color: #fff;
  }
  
  .btn-primary:hover {
    background: var(--accent-red-hover);
    box-shadow: 0 0 16px var(--accent-glow);
  }
  
  .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid var(--border-color);
  }
  
  .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
  }
  
  .btn-glow {
    background: var(--accent-red);
    color: #fff;
    padding: 0.8rem 1.6rem;
    font-size: 1rem;
    box-shadow: 0 0 25px var(--accent-glow);
  }
  
  .btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 35px rgba(229, 9, 20, 0.6);
  }
  
  .btn-icon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
  }
  
  .btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
  }
  
  .btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
  }
  
  /* ==========================================================================
     Hero Section
     ========================================================================== */
  
  .hero-section {
    position: relative;
    min-height: 520px;
    display: flex;
    align-items: flex-end;
    padding: 4rem 1.5rem 4rem;
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
  }
  
  .hero-backdrop {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center 25%;
    transform: scale(1.02);
    transition: background-image 0.5s ease-in-out;
    z-index: 1;
  }
  
  .hero-gradient-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
      0deg,
      var(--bg-primary) 0%,
      rgba(8, 10, 16, 0.85) 40%,
      rgba(8, 10, 16, 0.3) 100%
    );
    z-index: 2;
  }
  
  .hero-content {
    position: relative;
    z-index: 3;
    max-width: 750px;
    margin: 0 auto 0 0;
    width: 100%;
  }
  
  .hero-meta-badge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
  }
  
  .badge-live {
    color: #ef4444;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
  }
  
  .badge-live i {
    font-size: 0.55rem;
    animation: pulse 1.5s infinite;
  }
  
  @keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
  }
  
  .badge-type, .badge-quality {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    text-transform: uppercase;
  }
  
  .hero-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2rem, 4.5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.8rem;
  }
  
  .hero-subinfo {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
  }
  
  .hero-rating {
    color: #fbbf24;
    font-weight: 700;
  }
  
  .hero-plot {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 650px;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .hero-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  
  /* ==========================================================================
     Catalog & Filter Section
     ========================================================================== */
  
  .main-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
  }
  
  .catalog-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 2rem;
  }
  
  .section-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 700;
  }
  
  .section-subtitle {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 0.2rem;
  }
  
  .genre-pill-wrapper {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
  }
  
  .pill {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
  }
  
  .pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  
  .pill.active {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
  }
  
  /* Media Cards Grid */
  .media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
  }
  
  .media-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: all var(--transition-normal);
  }
  
  .media-card:hover {
    transform: translateY(-6px);
    border-color: rgba(229, 9, 20, 0.4);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.5), 0 0 15px rgba(229, 9, 20, 0.2);
  }
  
  .card-poster-wrapper {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    background: #111420;
  }
  
  .card-poster-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
  }
  
  .media-card:hover .card-poster-wrapper img {
    transform: scale(1.05);
  }
  
  .card-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(8, 10, 16, 0.8);
    backdrop-filter: blur(8px);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    text-transform: uppercase;
  }
  
  .card-bookmark-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(8, 10, 16, 0.75);
    backdrop-filter: blur(8px);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
  }
  
  .media-card:hover .card-bookmark-btn {
    opacity: 1;
  }
  
  .card-bookmark-btn:hover, .card-bookmark-btn.saved {
    color: #fff;
    background: var(--accent-red);
    opacity: 1;
  }
  
  .card-hover-overlay {
    position: absolute;
    inset: 0;
    background: rgba(8, 10, 16, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
  }
  
  .media-card:hover .card-hover-overlay {
    opacity: 1;
  }
  
  .play-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--accent-red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: 0 0 20px var(--accent-glow);
    transform: scale(0.85);
    transition: transform var(--transition-fast);
  }
  
  .media-card:hover .play-circle {
    transform: scale(1);
  }
  
  .card-details {
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
  }
  
  .card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-dim);
  }
  
  .card-rating {
    color: #fbbf24;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
  }
  
  /* ==========================================================================
     Loading & Empty States
     ========================================================================== */
  
  .loading-state, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 5rem 1rem;
    color: var(--text-muted);
  }
  
  .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1.2rem;
  }
  
  @keyframes spin {
    to { transform: rotate(360deg); }
  }
  
  .empty-state i {
    font-size: 3rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
  }
  
  .empty-state h3 {
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 0.5rem;
  }
  
  /* ==========================================================================
     Modals (General)
     ========================================================================== */
  
  .modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal);
  }
  
  .modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
  
  .modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px) scale(0.98);
    transition: transform var(--transition-normal);
  }
  
  .modal-overlay.active .modal-content {
    transform: translateY(0) scale(1);
  }
  
  .close-btn:hover {
    background: rgba(229, 9, 20, 0.2);
    color: var(--accent-red);
  }
  
  /* ==========================================================================
     Player Theater Modal
     ========================================================================== */
  
  .player-modal-content {
    max-width: 1050px;
    padding: 1.2rem;
    background: #0d111a;
    transition: max-width var(--transition-normal);
  }
  
  .player-modal-content.theater-mode {
    max-width: 95vw;
  }
  
  .player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    gap: 1rem;
  }
  
  .player-title-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    overflow: hidden;
  }
  
  .player-title-info h3 {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .player-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  /* TV Episode Switcher */
  .tv-selector-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
  }
  
  .tv-control-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
  }
  
  .tv-control-group input {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    width: 60px;
    text-align: center;
  }
  
  /* Server Selector */
  .server-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    overflow-x: auto;
    padding-bottom: 0.3rem;
  }
  
  .server-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-right: 0.3rem;
  }
  
  .server-pill {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    white-space: nowrap;
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
  }
  
  .server-pill:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }
  
  .server-pill.active {
    background: rgba(229, 9, 20, 0.2);
    color: #fff;
    border-color: var(--accent-red);
  }
  
  /* 16:9 Player Container */
  .player-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  }
  
  .player-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #05070a;
    z-index: 2;
    transition: opacity 0.3s ease;
  }
  
  .player-loader.hidden {
    opacity: 0;
    pointer-events: none;
  }
  
  .player-container iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 1;
  }
  
  .player-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.8rem;
    font-size: 0.82rem;
    color: var(--text-dim);
  }
  
  .link-external {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: color var(--transition-fast);
  }
  
  .link-external:hover {
    color: #fff;
  }
  
  /* ==========================================================================
     Add Movie Modal
     ========================================================================== */
  
  .add-modal-content {
    max-width: 580px;
    padding: 1.8rem;
  }
  
  .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
  }
  
  .modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 0.8rem;
  }
  
  .modal-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(229, 9, 20, 0.15);
    color: var(--accent-red);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
  }
  
  .modal-title-wrap h3 {
    font-size: 1.2rem;
    font-weight: 700;
  }
  
  .modal-title-wrap p {
    font-size: 0.8rem;
    color: var(--text-dim);
  }
  
  .add-form {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
  }
  
  .form-row {
    display: flex;
    gap: 1rem;
  }
  
  .flex-1 { flex: 1; }
  .flex-2 { flex: 2; }
  
  .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
  }
  
  .form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
  }
  
  .form-group input, .form-group select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-md);
    color: #fff;
    transition: border-color var(--transition-fast);
  }
  
  .form-group input:focus, .form-group select:focus {
    border-color: var(--border-focus);
  }
  
  .form-group select option {
    background: var(--bg-secondary);
    color: #fff;
  }
  
  .input-with-button {
    display: flex;
    gap: 0.5rem;
  }
  
  .input-with-button input {
    flex-grow: 1;
  }
  
  .helper-text {
    font-size: 0.75rem;
    color: var(--text-dim);
  }
  
  .helper-text code {
    color: var(--accent-red);
  }
  
  /* Preview Box */
  .preview-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.9rem;
    border-radius: var(--radius-md);
    display: flex;
    gap: 1rem;
    align-items: center;
  }
  
  .preview-poster {
    width: 65px;
    height: 95px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: #111;
  }
  
  .preview-details h4 {
    font-size: 1rem;
    margin-bottom: 0.2rem;
  }
  
  .preview-tags {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
  }
  
  .preview-tags i {
    color: #fbbf24;
  }
  
  .preview-plot {
    font-size: 0.8rem;
    color: var(--text-dim);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .form-status {
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
  }
  
  .form-status.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
  }
  
  .form-status.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.4);
    color: #86efac;
  }
  
  .modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.5rem;
  }
  
  /* ==========================================================================
     Responsive Adaptations
     ========================================================================== */
  
  @media (max-width: 900px) {
    .hero-section {
      min-height: 420px;
      padding-top: 2rem;
    }
    .hero-title {
      font-size: 2.2rem;
    }
  }
  
  @media (max-width: 768px) {
    .nav-links {
      display: none;
    }
    .search-box {
      width: 180px;
    }
    .search-box:focus-within {
      width: 200px;
    }
    .hero-content {
      max-width: 100%;
    }
    .media-grid {
      grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 1rem;
    }
    .form-row {
      flex-direction: column;
    }
  }

/* ==========================================================================
   Premium responsive polish
   ========================================================================== */

html {
  background: #07070a;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(229, 9, 20, .08), transparent 28rem),
    radial-gradient(circle at 90% 20%, rgba(229, 9, 20, .045), transparent 32rem),
    var(--bg-primary);
}

.navbar {
  background: rgba(7, 7, 10, .82);
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}

.nav-container {
  width: min(100%, 1500px);
}

.brand-logo {
  flex: 0 0 auto;
}

.hero-section {
  width: min(100%, 1500px);
  min-height: min(620px, 72vh);
  margin: 0 auto;
  padding-left: clamp(1rem, 4vw, 3rem);
  padding-right: clamp(1rem, 4vw, 3rem);
}

.main-wrapper {
  width: min(100%, 1500px);
  padding-left: clamp(1rem, 3vw, 2rem);
  padding-right: clamp(1rem, 3vw, 2rem);
}

.media-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: clamp(.75rem, 1.5vw, 1.35rem);
}

.media-card {
  min-width: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,.14);
}

.card-details {
  min-width: 0;
}

.card-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-modal-content:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
  padding: clamp(.65rem, 2vw, 1.25rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: #050507;
}

.player-modal-content:fullscreen .player-container {
  width: 100%;
  max-height: calc(100vh - 150px);
  aspect-ratio: 16 / 9;
}

.player-modal-content:fullscreen .player-footer {
  flex: 0 0 auto;
}

.player-modal-content.theater-mode {
  width: min(96vw, 1600px);
  max-width: 1600px;
}

.player-container {
  contain: layout paint;
  border: 1px solid rgba(255,255,255,.08);
}

.player-container iframe {
  background: #000;
}

.modal-overlay {
  padding: clamp(.5rem, 2vw, 1.25rem);
}

@media (max-width: 1100px) {
  .nav-container {
    flex-wrap: wrap;
  }
  .nav-left {
    min-width: 0;
    flex: 1 1 auto;
  }
  .nav-right {
    flex: 1 1 100%;
    justify-content: flex-end;
  }
  .search-box {
    width: min(100%, 360px);
  }
}

@media (max-width: 768px) {
  .nav-container {
    padding: .7rem .85rem;
    gap: .65rem;
  }
  .nav-left {
    width: 100%;
    justify-content: space-between;
  }
  .nav-right {
    width: 100%;
    justify-content: stretch;
  }
  .nav-right .search-box {
    width: 100%;
    flex: 1;
  }
  .nav-right .search-box:focus-within {
    width: 100%;
  }
  .nav-right .btn {
    flex: 0 0 auto;
  }

  .hero-section {
    min-height: 500px;
    align-items: flex-end;
    padding-top: 1rem;
    padding-bottom: 2.2rem;
  }
  .hero-title {
    font-size: clamp(2rem, 9vw, 2.8rem);
  }
  .hero-plot {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }
  .hero-actions {
    flex-wrap: wrap;
  }

  .catalog-header {
    align-items: flex-start;
  }
  .genre-pill-wrapper {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    padding-bottom: .35rem;
    scrollbar-width: none;
  }
  .genre-pill-wrapper::-webkit-scrollbar {
    display: none;
  }
  .pill {
    flex: 0 0 auto;
  }

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .75rem;
  }

  .modal-content {
    max-height: 96vh;
  }
  .player-modal-content {
    max-width: 100%;
    padding: .7rem;
    border-radius: 12px;
  }
  .player-header {
    margin-bottom: .65rem;
  }
  .player-title-info h3 {
    font-size: 1rem;
  }
  .player-header-actions {
    gap: .3rem;
  }
  .btn-icon {
    width: 34px;
    height: 34px;
  }
  .server-bar {
    margin-bottom: .55rem;
  }
  .player-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: .5rem;
  }
  .tv-selector-bar {
    gap: .55rem;
    padding: .55rem;
  }
  .add-modal-content {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .brand-logo {
    font-size: 1.25rem;
  }
  .badge-tag {
    display: none;
  }
  .nav-right .btn span {
    display: none;
  }
  .nav-right .btn {
    width: 42px;
    justify-content: center;
    padding: .6rem;
  }
  .hero-section {
    min-height: 450px;
  }
  .hero-meta-badge {
    flex-wrap: wrap;
  }
  .hero-actions .btn {
    flex: 1 1 100%;
    justify-content: center;
  }
  .main-wrapper {
    padding-top: 1.6rem;
  }
  .section-title {
    font-size: 1.4rem;
  }
  .section-subtitle {
    font-size: .8rem;
  }
  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .card-details {
    padding: .65rem;
  }
  .card-meta {
    font-size: .7rem;
  }
  .player-modal-content {
    padding: .45rem;
  }
  .player-container {
    border-radius: 7px;
  }
  .player-title-info .badge-type {
    display: none;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
