:root{
  --bg:#1f1f1f;
  --card:#ffffff;
  --muted:#6b7280;
  --accent:#0ea5a4;
  --accent-variant:#047d7a;
  --danger:#ef4444;
  --glass: rgba(15,23,42,0.02);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

*{box-sizing:border-box}
html,body,#app{height:100%}
body{
  margin:0;
  background:var(--bg);
  display:flex;
  align-items:center;
  justify-content:center;
  -webkit-tap-highlight-color:transparent;
  padding:18px;
}

.card{
  width:100%;
  max-width:420px;
  background:linear-gradient(180deg,var(--card),var(--glass));
  border-radius:14px;
  box-shadow:0 8px 30px rgba(2,6,23,0.08);
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:12px;
  transform-origin:center;
}

/* brand */
.brand{
  display:flex;
  gap:12px;
  align-items:center;
}
/* hide the small brand logo dot next to the auth card label */
.brand .logo{
  display: none;
}
.brand-text{font-weight:600;font-size:18px;color:#0f172a}

/* tabs */
.tabs{display:flex;border-radius:10px;overflow:hidden;background:#f3f4f6;padding:4px;}
.tab{
  flex:1;padding:10px 12px;border:0;background:transparent;
  font-weight:600;color:var(--muted);
  border-radius:8px;
  min-width:44px;
}
.tab:focus{outline:2px solid rgba(14,165,164,0.15)}
.tab.active{background:white;color:var(--accent);box-shadow:0 1px 0 rgba(2,6,23,0.04)}

/* forms */
.form{display:none;gap:10px;flex-direction:column}
.form.active{display:flex}
.field{display:flex;flex-direction:column;gap:6px}
.field span{font-size:13px;color:var(--muted)}
.field input{
  height:46px;padding:10px 12px;border-radius:10px;border:1px solid #e6e9ef;background:white;
  font-size:15px;color:#0f172a;
}
.field input:focus{outline:2px solid rgba(14,165,164,0.12);border-color:rgba(14,165,164,0.25)}

.row{display:flex;align-items:center;gap:8px}
.between{justify-content:space-between}
.inline{display:flex;gap:8px;align-items:center;color:var(--muted);font-size:14px}
.inline input{width:18px;height:18px}

.link{background:none;border:0;color:var(--accent);padding:6px;border-radius:8px}
.link.small{font-size:13px;padding:6px 8px}

.btn{height:48px;border-radius:10px;border:0;font-weight:700}
.btn.primary{background:linear-gradient(90deg,var(--accent),var(--accent-variant));color:white;box-shadow:0 6px 18px rgba(4,125,122,0.12)}

.small{font-size:13px;color:var(--muted)}
.center{text-align:center}

.providers{display:flex;gap:10px;justify-content:center;padding-top:6px}
.provider{width:44px;height:44px;border-radius:10px;border:1px solid #e9eef6;background:white;font-weight:700;color:#0f172a}

/* toast */
.toast{
  margin-top:6px;
  min-height:36px;padding:8px 12px;border-radius:8px;
  background:transparent;color:var(--accent-variant);font-weight:600;font-size:14px;
  opacity:0;transform:translateY(8px);transition:200ms ease;
}
.toast.show{opacity:1;transform:none}

/* dashboard (hidden until signed-in) */
.dashboard{display:none;padding:12px;border-radius:8px;background:linear-gradient(180deg,var(--card),var(--glass));margin-top:6px}
.dash-inner{display:flex;flex-direction:column;align-items:center;gap:8px;padding:8px}
.dash-hello{font-weight:700;font-size:18px;color:#0f172a}
.card.signed-in .tabs,
.card.signed-in .form,
.card.signed-in .providers,
.card.signed-in .brand {display:none}
.card.signed-in .dashboard{display:block}
.card.signed-in {align-items:stretch}

/* accessibility focus */
:focus{outline:none}
@media (max-width:420px){
  .card{padding:14px}
  .brand-text{font-size:16px}
}

/* Fullscreen dashboard when user is signed-in */
.card.signed-in {
  position: fixed;
  inset: 0; /* top:0; right:0; bottom:0; left:0; */
  width: 100vw;
  height: 100vh;
  max-width: 100%;
  margin: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  background: var(--card);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  z-index: 9999;
}

/* Make the dashboard region fill the card vertically and allow scrolling inside
   Increased padding and top offset to give the dashboard more breathing room */
.card.signed-in .dashboard {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 24px;                 /* increased overall padding */
  padding-top: 96px;            /* larger top spacing for a bigger header/nav feeling */
  overflow: auto;
  background: #141414;
  border-radius: 0;
}

/* Ensure the hero and movies container stretch nicely */
.hero {
  min-height: 36vh;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
  padding: 18px;
  color: white;
}

.movies-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  padding: 12px 0 24px;
}

/* Ensure modals overlay above the fullscreen dashboard */
.modal-overlay {
  z-index: 10010;
}

/* Tweak body to avoid double background showing when dashboard is fullscreen */
body {
  background: var(--bg);
}

/* Dashboard-specific reset and dark theme styles (appended) */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg);
    color: white;
}

nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    padding: 14px 20px; /* increased vertical and horizontal padding for a bigger navbar */
    display: flex;
    gap: 14px;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap; /* keep items on one line when possible */
    /* Match the dashboard dark background for a seamless header */
    background: #141414;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    z-index: 1100;
    backdrop-filter: blur(6px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.45);
}

.logo {
    color: #e50914;
    font-size: 1.05rem; /* slightly larger logo label for improved presence */
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: -6px;
}

.logo svg {
    height: 26px; /* larger SVG/logo height to match increased navbar */
    width: auto;
}

/* Update existing logo styles to handle SVG */
.logo path {
    transition: fill 0.4s ease;
}

.logo:hover path {
    fill: #ff0f1a;
}

.logo text {
    transition: fill 0.4s ease;
}

.logo:hover text {
    fill: #ff0f1a;
}

.nav-links {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-links a {
    color: white;
    text-decoration: none;
    margin-left: 20px;
    font-size: 1.1rem;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: #e50914;
}

/* Dropdown menu styles */
.legal-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    background-color: #1a1a1a;
    min-width: 200px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
    z-index: 1001;
    border-radius: 4px;
    border: 1px solid #333;
    padding: 8px 0;
    top: 100%;
    margin-top: 5px;
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    margin: 0;
    font-size: 1rem;
    transition: background-color 0.3s ease;
}

.dropdown-content a:hover {
    background-color: #333;
    color: #e50914;
}

.legal-dropdown:hover .dropdown-content {
    display: block;
}

.legal-dropdown > a::after {
    content: ' ▼';
    font-size: 0.8rem;
    margin-left: 5px;
}

.search-container {
    display: flex;
    align-items: center;
    margin: 0 12px;
    flex: 1 1 320px;     /* allow the search area to flex but stay capped */
    max-width: 640px;    /* allow the search area to breathe more in the larger navbar */
    justify-content: center;
}

#search-input {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    padding: 10px 12px;
    color: white;
    font-size: 1rem;
    width: 100%;
    max-width: 420px;    /* increased cap so search feels more prominent in the bigger nav */
    transition: all 0.2s ease;
}

#search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

#search-input:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: #e50914;
    outline: none;
}

#search-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 8px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

#search-button:hover {
    transform: scale(1.1);
}

.hero {
    min-height: 52vh;             /* increased hero height for a larger featured area */
    height: auto;
    background: linear-gradient(to right, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.2) 50%, transparent 100%);
    background-position: center;
    background-size: cover;
    display: flex;
    align-items: flex-end;
    padding: 28px 40px;           /* slightly more padding to match larger hero */
    box-sizing: border-box;
    color: white;
}

/* Constrain hero content and make typography responsive */
.hero-content {
    width: 100%;
    max-width: 920px;
    padding: 24px;
    background: linear-gradient(180deg, rgba(0,0,0,0.0), rgba(0,0,0,0.35));
    border-radius: 8px;
    transition: opacity 0.4s ease, transform 0.3s ease;
}

/* Responsive heading that clamps between sizes */
.hero-content h1 {
    font-size: clamp(1.6rem, 4vw, 3rem);
    line-height: 1.05;
    margin: 0 0 12px 0;
    text-shadow: 0 6px 18px rgba(0,0,0,0.6);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Overview should wrap and truncate gracefully */
.hero-content p {
    font-size: clamp(0.95rem, 2.2vw, 1.15rem);
    margin: 0 0 16px 0;
    line-height: 1.4;
    max-height: 4.2em; /* roughly 3 lines */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Buttons layout */
.hero-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.hero-buttons button {
    padding: 10px 20px;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* make play stand out and info subtle */
.play-btn {
    background: white;
    color: black;
    font-weight: 700;
}

.info-btn {
    background: rgba(109,109,110,0.65);
    color: white;
}

/* ensure hero background images cover the area and remain centered on resize */
#featured-movie {
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}

/* movie card images keep consistent aspect ratio and don't overflow */
.movie-card img {
    width: 100%;
    height: auto;
    aspect-ratio: 2/3; /* common poster ratio */
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

.play-btn {
    background: white;
    color: black;
}

.info-btn {
    background: rgba(109, 109, 110, 0.7);
    color: white;
}

.row {
    padding: 20px 50px;
}

.row h2 {
    margin-bottom: 20px;
}

.slider {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 14px 0;
}

.slider::-webkit-scrollbar {
    display: none;
}

.slide {
    flex: 0 0 auto;
    width: 180px;
    position: relative;
}

.thumbnail {
    width: 100%;
    height: 110px;
    background: #303030;
    border-radius: 4px;
    transition: transform 0.25s;
    background-size: cover;
    background-position: center;
}

.slide:hover .thumbnail {
    transform: scale(1.1);
}

.movie-title {
    position: absolute;
    bottom: -30px;
    left: 0;
    width: 100%;
    padding: 5px;
    font-size: 0.9rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.slide:hover .movie-title {
    opacity: 1;
}

.progress-bar {
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 100%;
    height: 4px;
    background: #404040;
}

.progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 75%;
    background: #e50914;
}

.movies-container {
    padding: 20px 48px;                              /* more room around grid */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); /* larger cards per user's request */
    gap: 20px;                                       /* increased spacing between cards */
    margin-top: 18px;
}

.movie-card {
    position: relative;
    transition: transform 0.3s;
    cursor: pointer;
}

.movie-card:hover {
    transform: scale(1.05);
}

.movie-card img {
    width: 100%;
    height: 320px;          /* taller poster images to emphasize the larger dashboard */
    object-fit: cover;
    border-radius: 8px;
}

.movie-card .title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(transparent, rgba(0,0,0,0.9));
    color: white;
    text-align: center;
    border-radius: 0 0 8px 8px;
}

.loading {
    text-align: center;
    padding: 20px;
    font-size: 1.2rem;
    color: #e50914;
    display: none; /* Keep initial display none */
    justify-content: center; /* Center content when visible */
    align-items: center;
    gap: 10px; /* Space between text and spinner */
}

/* Spinner for loading indicator */
.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #e50914; /* Red part of spinner */
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Base modal styles for both movie details and welcome popup */
/* Target the actual modal element by ID used in the HTML/JS */
#movie-details-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: none; /* Hidden by default; JS toggles display:flex/none */
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    pointer-events: none; /* Allows clicks to pass through when hidden */
}

/* When visible, JS sets display:flex and this class helps with transitions */
#movie-details-modal.show {
    display: flex;
    opacity: 1;
    pointer-events: all; /* Blocks clicks when visible */
}

#movie-details-modal.fade-out {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: #141414;
    border-radius: 8px;
    overflow: hidden;
    overflow-y: auto;
    transform: scale(0.98); /* Start slightly smaller for transition */
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* When the modal wrapper has .show, scale up the content for a pop effect */
#movie-details-modal.show .modal-content {
    transform: scale(1); /* Scale up when shown */
    opacity: 1;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: 1;
}

.modal-body {
    position: relative;
    z-index: 2;
    padding: 40px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    z-index: 3; /* Ensure close button is above content */
}

.movie-meta {
    margin: 20px 0;
}

.movie-meta span {
    margin-right: 20px;
}

.rating {
    color: #46d369;
}

.overview {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-bottom: 30px;
    max-width: 600px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    font-size: 1.1rem;
    cursor: pointer;
}

.modal-buttons .play-btn {
    background: white;
    color: black;
}

.modal-buttons .add-list-btn {
    background: rgba(109, 109, 110, 0.7);
    color: white;
}

.modal-buttons button:hover {
    opacity: 0.9;
}

.video-container {
    width: 100%;
    height: 360px;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 14px;
}

/* Ad blocker notification styles */
.ad-blocked-notice {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #e50914;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    font-size: 0.9rem;
    z-index: 10000;
    opacity: 0;
    transform: translateY(100px);
    transition: all 0.3s ease;
}

.ad-blocked-notice.show {
    opacity: 1;
    transform: translateY(0);
}

/* Hide common ad containers that might slip through */
[id*="google_ads"],
[class*="google_ads"],
.adsbygoogle,
[data-ad-client],
[data-ad-slot] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    width: 0 !important;
    overflow: hidden !important;
}

/* Specific styling for the welcome modal */
.welcome-modal .modal-content {
    background: #1a1a1a; /* Slightly different background for welcome */
    max-width: 500px; /* Smaller for a welcome message */
    padding: 20px; /* Add padding to modal-content for welcome popup */
}

.welcome-modal .modal-body {
    padding: 20px; /* Adjust padding for welcome modal body */
    text-align: center;
    justify-content: center;
}

.welcome-modal h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
    color: #e50914;
}

.welcome-modal p.overview {
    font-size: 1.1rem;
    margin-bottom: 30px;
    max-width: none; /* Remove max-width constraint */
}

.welcome-modal .modal-buttons {
    justify-content: center; /* Center the "Got It!" button */
}

.welcome-modal .welcome-got-it-btn {
    background: #e50914; /* Netflix red for the button */
    color: white;
    padding: 12px 40px;
}

.welcome-modal .welcome-got-it-btn:hover {
    background: #ff0f1a;
}

/* Hide the welcome modal by default */
.welcome-modal {
    display: none;
    opacity: 0;
    pointer-events: none;
}

.welcome-modal.show {
    display: flex; /* Override display:none when .show is added */
}

/* Footer styles */
footer {
    background: #0d0d0d;
    color: #888;
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
    font-size: 0.9rem;
    border-top: 1px solid #222;
}

footer p {
    margin-bottom: 10px;
}

footer p:last-child {
    margin-bottom: 0;
}

/* Utility hidden class used by JS */
.hidden {
    display: none !important;
}

/* Movie player container: maintain aspect ratio and make iframe fill it */
.movie-player-container {
    position: relative;
    width: 100%;
    height: 0; /* create an aspect-ratio box via padding-bottom */
    padding-bottom: calc(100% / (16 / 9)); /* default 16:9 rectangle; JS may override inline */
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 20px;
}

/* Make native <video> elements fill the rectangular player and preserve aspect */
.movie-player-container video,
.movie-player-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover; /* keep a filled rectangular look */
    display: block;
}

/* Movie details header layout and poster sizing */
.movie-details-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}
.movie-details-header img.modal-poster {
    width: 160px;
    height: auto;
    border-radius: 6px;
    flex-shrink: 0;
}

/* Tidy movie card title and make cards fit grid */
.movie-card h3 {
    display: block;
    margin: 10px 0 0;
    font-size: 1rem;
    color: #fff;
    text-align: center;
    max-height: 2.6em;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    padding: 0 6px;
}

/* Ensure welcome modal transitions and centering work reliably */
.welcome-modal {
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    align-items: center;
    justify-content: center;
}
.welcome-modal.show {
    display: flex;
    opacity: 1;
    pointer-events: all;
}

/* Ensure movie-details modal transitions reliably when toggled by JS */
#movie-details-modal {
    /* keep existing rules but ensure pointer-events/opacity controlled by .show */
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
#movie-details-modal.show {
    pointer-events: all;
    opacity: 1;
}

/* Make loading indicator visible when toggled by JS */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}