/* ============================================================================
 * CinephileHub — components.css
 * THE REUSABLE PIECES: buttons, badges, cards, grids, hero, film detail,
 * search controls, admin panel, forms, affiliate notice.
 *
 * main.css gave us the skeleton (variables, layout, nav, footer).
 * This file gives us the "Lego bricks" we snap together on every page.
 * Like main.css, this file is identical in all three locations.
 * ==========================================================================*/


/* ----------------------------------------------------------------------------
 * BUTTONS
 * The .btn base sets shape/spacing; modifier classes (.btn-primary etc.) set
 * color. This "base + modifier" idea is the heart of scalable CSS (it is what
 * big systems like BEM formalize). Learn it here, recognize it everywhere.
 * --------------------------------------------------------------------------*/
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.75rem 1.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  text-transform: uppercase;
}
.btn-primary { background: var(--color-gold); color: #0d0d0d; }
.btn-primary:hover { background: var(--color-gold-light); color: #0d0d0d; transform: translateY(-2px); }
.btn-outline { background: transparent; color: var(--color-gold); border-color: var(--color-gold); }
.btn-outline:hover { background: var(--color-gold); color: #0d0d0d; }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #e74c3c; }
.btn-ghost { background: var(--color-surface-alt); color: var(--color-text); border-color: var(--color-border); }
.btn-ghost:hover { border-color: var(--color-gold); color: var(--color-gold); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.8rem; }
.btn-block { display: block; width: 100%; }


/* ----------------------------------------------------------------------------
 * DIFFICULTY BADGE (pill)
 * A tiny status chip. The color is driven by a modifier class so the meaning is
 * encoded visually: green = approachable, orange = demanding, red = serious study.
 * --------------------------------------------------------------------------*/
.badge {
  display: inline-block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;       /* huge radius = perfect pill shape */
  color: #0d0d0d;
}
.badge-easy        { background: var(--color-easy); }
.badge-challenging { background: var(--color-challenging); }
.badge-essential   { background: var(--color-essential); color: #fff; }


/* ----------------------------------------------------------------------------
 * FILM GRID  ::  the one-line responsive magic
 *
 * CSS GRID is the most powerful layout tool in modern CSS — think of it as
 * drawing rows AND columns at the same time, like a spreadsheet you can drop
 * HTML elements into.
 *
 *   auto-fill           : "make as many columns as will fit"
 *   minmax(280px, 1fr)  : "each column is at least 280px, but stretches to
 *                          share leftover space equally when there is room"
 *
 * The magic: this ONE line builds a fully responsive grid with NO media
 * queries. Phone -> 1 column. Tablet -> 2. Desktop -> 3-4. All automatic.
 *   -> WGU: Front-End Web Development (Term 2), UI Design (Term 3)
 * --------------------------------------------------------------------------*/
.film-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}


/* ----------------------------------------------------------------------------
 * FILM CARD
 * --------------------------------------------------------------------------*/
.film-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;                 /* clip the poster's corners to the radius */
  display: flex;
  flex-direction: column;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}
.film-card:hover {
  border-color: var(--color-gold);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.5); /* gentle "lift" toward the viewer */
}

/* The poster wrapper enforces a 2:3 movie-poster aspect ratio regardless of
   the actual image. object-fit: cover crops (never squishes) to fill. */
.film-card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--color-surface-alt);
  overflow: hidden;
}
.film-card-poster img { width: 100%; height: 100%; object-fit: cover; }
.film-card-poster .badge { position: absolute; top: var(--space-xs); left: var(--space-xs); }

.film-card-body { padding: var(--space-sm); display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.film-card-title { font-size: 1.15rem; }
.film-card-meta { color: var(--color-text-muted); font-size: 0.85rem; }

/* Clamp Kevin's Take to 2 lines on the card so every card lines up neatly.
   -webkit-line-clamp is widely supported and degrades gracefully. */
.film-card-take {
  font-size: 0.9rem;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.film-card-link { margin-top: auto; color: var(--color-gold); font-weight: 700; font-size: 0.9rem; }


/* ----------------------------------------------------------------------------
 * HERO (homepage)
 * A full-viewport-height stage. Layered backgrounds create cinematic depth:
 * a dark gradient overlay sits ON TOP of an atmospheric image so the headline
 * stays readable no matter the picture behind it.
 * --------------------------------------------------------------------------*/
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: var(--nav-height) var(--space-md) var(--space-md);
  background:
    linear-gradient(rgba(13,13,13,0.72), rgba(13,13,13,0.92)),
    radial-gradient(circle at 50% 30%, #1f1a10 0%, #0d0d0d 70%);
}
.hero-content { max-width: 760px; }

/* ----------------------------------------------------------------------------
 * HERO HEADLINE — two-line "kicker + statement" treatment
 *
 * THE PROBLEM: one long sentence set entirely in big Cinzel capitals is
 * beautiful for a few words but becomes a wall of shouting caps when the line
 * runs long — hard to read and visually overpowering.
 *
 * THE FIX (a common editorial/design pattern): split the idea into two lines
 * with a clear HIERARCHY.
 *   - .hero-kicker   : a small, gold, letter-spaced lead-in (the setup).
 *   - .hero-statement: the larger payoff line, set in the BODY font (Lato) in
 *                      normal case so it reads easily, not as engraved capitals.
 * Two type sizes + two colors + two fonts = the eye knows exactly where to go.
 *   -> WGU: UI Design, UX Design (visual hierarchy & readability)
 * --------------------------------------------------------------------------*/
.hero h1 {
  margin-bottom: var(--space-sm);
  text-shadow: 0 2px 20px rgba(0,0,0,0.8);
}
.hero-kicker {
  display: block;
  font-family: var(--font-heading);          /* Cinzel — keeps the brand voice */
  font-size: clamp(0.95rem, 2.4vw, 1.45rem); /* deliberately smaller than line 2 */
  font-weight: 600;
  letter-spacing: 0.16em;                    /* airy tracking reads well in caps */
  text-transform: uppercase;
  color: var(--color-gold);                  /* gold sets the lead-in apart      */
  margin-bottom: var(--space-sm);
}
.hero-statement {
  display: block;
  font-family: var(--font-body);             /* Lato */
  font-weight: 400;                          /* lighter weight reads as graceful  */
  font-style: italic;                        /* a touch of elegance for the payoff */
  font-size: clamp(1.5rem, 4vw, 2.8rem);     /* the payoff line carries the size  */
  line-height: 1.3;
  letter-spacing: 0.01em;                    /* airy, refined; NOT small-caps      */
  text-transform: none;
  color: var(--color-text);
}
.hero-sub {
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--color-text-muted);
  margin-bottom: var(--space-md);
  font-style: italic;
}


/* ----------------------------------------------------------------------------
 * FEATURED FILM (homepage spotlight)
 * Flexbox two-column layout: sharp poster on the left, editorial on the right.
 * A blurred copy of the poster fills the panel background for a dreamy "now
 * showing" glow. On mobile the columns stack (flex-wrap).
 * --------------------------------------------------------------------------*/
.featured {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--color-surface);
}
.featured-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(30px) brightness(0.35);
  transform: scale(1.1);              /* hide blurred edges */
  z-index: 0;
}
.featured-inner {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: var(--space-md);
  padding: var(--space-md);
}
.featured-poster { flex: 0 0 260px; aspect-ratio: 2/3; border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 10px 40px rgba(0,0,0,0.6); }
.featured-poster img { width: 100%; height: 100%; object-fit: cover; }
.featured-body { flex: 1 1 320px; display: flex; flex-direction: column; gap: var(--space-sm); }
.featured-label { color: var(--color-gold); letter-spacing: 0.12em; text-transform: uppercase;
  font-size: 0.8rem; font-weight: 700; }
.featured-title { font-size: clamp(1.6rem, 4vw, 2.6rem); }
.featured-meta { color: var(--color-text-muted); }
.featured-excerpt { font-size: 1.05rem; }


/* ----------------------------------------------------------------------------
 * GENRE CARDS
 * Desktop: an auto-fitting grid. Mobile: a horizontal scroll "shelf" (a common
 * mobile pattern — think Netflix rows). The media query at the bottom switches
 * the display strategy.
 * --------------------------------------------------------------------------*/
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-md);
}
.genre-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-md);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.genre-card:hover {
  border-color: var(--color-gold);
  box-shadow: 0 0 24px rgba(201,168,76,0.25); /* the requested gold hover glow */
  transform: translateY(-3px);
}
.genre-card h3 { color: var(--color-gold); font-size: 1.3rem; margin-bottom: 0.3rem; }
.genre-card .genre-tagline { color: var(--color-text); font-style: italic; font-size: 0.95rem;
  margin-bottom: var(--space-xs); }
.genre-card .genre-count { color: var(--color-text-muted); font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.08em; }


/* ----------------------------------------------------------------------------
 * EDITORIAL STATEMENT (homepage prose band)
 * --------------------------------------------------------------------------*/
.editorial {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}
.editorial-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.editorial-inner h2 { color: var(--color-gold); font-size: 1.8rem; margin-bottom: var(--space-sm); }
.editorial-inner p { font-size: 1.1rem; margin-bottom: var(--space-sm); }


/* ----------------------------------------------------------------------------
 * PAGE HEADER (genre / search / about banners)
 * --------------------------------------------------------------------------*/
.page-header { padding: calc(var(--nav-height) + var(--space-lg)) 0 var(--space-md); text-align: center; }
.page-header h1 { font-size: clamp(2rem, 5vw, 3rem); color: var(--color-gold); }
.page-header p { color: var(--color-text-muted); max-width: 640px; margin: var(--space-sm) auto 0;
  font-style: italic; }


/* ----------------------------------------------------------------------------
 * FILM DETAIL PAGE
 * --------------------------------------------------------------------------*/
.film-hero {
  position: relative;
  padding: calc(var(--nav-height) + var(--space-md)) 0 var(--space-md);
  overflow: hidden;
}
.film-hero-bg {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: blur(40px) brightness(0.3);
  transform: scale(1.15);
  z-index: 0;
}
.film-hero-inner {
  position: relative; z-index: 1;
  display: flex; flex-wrap: wrap; gap: var(--space-md); align-items: flex-end;
}
.film-hero-poster { flex: 0 0 240px; aspect-ratio: 2/3; border-radius: var(--radius);
  overflow: hidden; box-shadow: 0 12px 50px rgba(0,0,0,0.7); }
.film-hero-poster img { width:100%; height:100%; object-fit: cover; }
.film-hero-meta { flex: 1 1 320px; }
.film-hero-meta h1 { font-size: clamp(1.8rem, 5vw, 3rem); margin-bottom: 0.4rem; }
.film-hero-meta .film-sub { color: var(--color-text-muted); font-size: 1.1rem; margin-bottom: var(--space-sm); }
.film-hero-meta .film-sub span { margin-right: var(--space-sm); }

/* Editorial sections share one card-like style for a calm reading rhythm. */
.film-section { padding: var(--space-md) 0; border-bottom: 1px solid var(--color-border); }
.film-section h2 { color: var(--color-gold); font-size: 1.5rem; margin-bottom: var(--space-sm);
  display: flex; align-items: center; gap: 0.6rem; }
.film-section p { font-size: 1.05rem; white-space: pre-line; } /* keep line breaks from data */

/* Where-to-watch renders as a clean list of streaming/physical options. */
.watch-list { display: flex; flex-direction: column; gap: var(--space-xs); }
.watch-list .watch-item { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--space-sm); }


/* ----------------------------------------------------------------------------
 * AFFILIATE BUTTONS + DISCLOSURE
 * The buttons only render when a URL exists (handled in JS / Jinja). The
 * .affiliate-notice disclosure is legally required and appears under every
 * affiliate section and in the footer.
 * --------------------------------------------------------------------------*/
.affiliate-buttons { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin: var(--space-sm) 0; }
.affiliate-notice {
  font-size: 0.82rem;
  color: var(--color-text-muted);
  font-style: italic;
  line-height: 1.6;
  border-left: 2px solid var(--color-gold);
  padding-left: var(--space-sm);
  margin-top: var(--space-sm);
}


/* ----------------------------------------------------------------------------
 * SEARCH CONTROLS
 * --------------------------------------------------------------------------*/
.search-controls { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-bottom: var(--space-md);
  align-items: center; justify-content: center; }
.search-input, .search-select {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
}
.search-input { min-width: 280px; flex: 1 1 280px; }
.search-input:focus, .search-select:focus { outline: 2px solid var(--color-gold); outline-offset: 1px; }
.search-input::placeholder { color: var(--color-text-muted); }
.search-count { text-align: center; color: var(--color-text-muted); margin-bottom: var(--space-md); }
.no-results { text-align: center; color: var(--color-text-muted); padding: var(--space-lg) 0; font-style: italic; }


/* ----------------------------------------------------------------------------
 * ADMIN PANEL (Flask version only — but the CSS lives here so the design system
 * stays in ONE place). Kevin should feel the same "dark cinema" world even
 * behind the scenes.
 * --------------------------------------------------------------------------*/
.admin-shell { padding: calc(var(--nav-height) + var(--space-md)) 0 var(--space-lg); }
.admin-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-sm); margin-bottom: var(--space-md); }
.admin-bar h1 { color: var(--color-gold); font-size: 1.8rem; }

.stats-strip { display: flex; flex-wrap: wrap; gap: var(--space-md); margin-bottom: var(--space-md); }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--space-md); flex: 1 1 160px; text-align: center; }
.stat-card .stat-num { font-family: var(--font-heading); font-size: 2.2rem; color: var(--color-gold); }
.stat-card .stat-label { color: var(--color-text-muted); text-transform: uppercase;
  font-size: 0.75rem; letter-spacing: 0.08em; }

/* The admin film list IS tabular data, so a real <table> is correct here. */
.admin-table { width: 100%; border-collapse: collapse; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.admin-table th, .admin-table td { padding: 0.75rem var(--space-sm); text-align: left;
  border-bottom: 1px solid var(--color-border); }
.admin-table th { background: var(--color-surface-alt); color: var(--color-gold);
  font-family: var(--font-heading); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table .pill-yes { color: var(--color-easy); }
.admin-table .pill-no { color: var(--color-text-muted); }
.admin-actions { display: flex; gap: var(--space-xs); }

/* Login card — centered, focused. */
.login-wrap { min-height: 80vh; display: flex; align-items: center; justify-content: center;
  padding: var(--nav-height) var(--space-md) var(--space-md); }
.login-card { background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--space-lg); max-width: 380px; width: 100%; }
.login-card h1 { color: var(--color-gold); text-align: center; margin-bottom: var(--space-md); font-size: 1.6rem; }


/* ----------------------------------------------------------------------------
 * FORMS (admin film/genre forms)
 * --------------------------------------------------------------------------*/
.form-group { margin-bottom: var(--space-sm); }
.form-group label { display: block; margin-bottom: 0.3rem; color: var(--color-text);
  font-size: 0.9rem; font-weight: 700; }
.form-control {
  width: 100%;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
}
.form-control:focus { outline: 2px solid var(--color-gold); outline-offset: 1px; }
textarea.form-control { min-height: 110px; resize: vertical; line-height: 1.6; }
.form-row { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.form-row .form-group { flex: 1 1 200px; }
.form-hint { color: var(--color-text-muted); font-size: 0.8rem; margin-top: 0.2rem; }
.form-check { display: flex; align-items: center; gap: 0.5rem; }
.form-check input { width: 18px; height: 18px; accent-color: var(--color-gold); }
.poster-preview { margin-top: var(--space-xs); max-width: 160px; aspect-ratio: 2/3; object-fit: cover;
  border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface-alt); }
.form-actions { display: flex; gap: var(--space-sm); margin-top: var(--space-md); flex-wrap: wrap; }

/* Flash messages (Flask flashes login errors, save confirmations, etc.) */
.flash { padding: var(--space-sm); border-radius: var(--radius); margin-bottom: var(--space-sm);
  border: 1px solid var(--color-border); }
.flash-success { border-color: var(--color-easy); color: var(--color-easy); background: rgba(46,204,113,0.08); }
.flash-error { border-color: var(--color-danger); color: #e8908a; background: rgba(192,57,43,0.10); }


/* ----------------------------------------------------------------------------
 * RELATED FILMS strip + small utilities
 * --------------------------------------------------------------------------*/
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-md); }
.back-link { display: inline-block; margin-bottom: var(--space-sm); color: var(--color-text-muted); }
.back-link:hover { color: var(--color-gold); }


/* ----------------------------------------------------------------------------
 * RESPONSIVE TWEAKS for components
 * --------------------------------------------------------------------------*/
@media (max-width: 768px) {
  /* Turn the genre grid into a swipeable horizontal shelf on phones. */
  .genre-grid {
    display: flex;
    overflow-x: auto;
    gap: var(--space-sm);
    padding-bottom: var(--space-xs);
    scroll-snap-type: x mandatory;
  }
  .genre-card { flex: 0 0 75%; scroll-snap-align: start; }

  .featured-poster { flex: 0 0 180px; margin: 0 auto; }
  .film-hero-poster { flex: 0 0 160px; }
  .admin-table { display: block; overflow-x: auto; white-space: nowrap; } /* let wide tables scroll, not break layout */
}

/* ----------------------------------------------------------------------------
 * BRAND LOGO IMAGES (nav + footer)
 * The transparent PNG logo replaces the old text wordmark. We size by HEIGHT and
 * let width scale automatically (width:auto) so the aspect ratio never distorts.
 *   -> WGU: Front-End Web Development (responsive images)
 * --------------------------------------------------------------------------*/
.nav-logo img { height: 42px; width: auto; display: block; }
.footer-logo img { height: 54px; width: auto; display: block; margin-bottom: var(--space-xs); }
@media (max-width: 768px) { .nav-logo img { height: 34px; } }

/* ----------------------------------------------------------------------------
 * INTRO SPLASH (homepage logo animation overlay)
 * A full-screen black overlay that sits ABOVE everything (high z-index) while
 * the logo video plays, then fades out (opacity transition) and is removed by
 * splash.js. position:fixed + inset:0 makes it cover the whole viewport.
 *   -> WGU: Front-End Web Development; UI Design (motion & first impressions)
 * --------------------------------------------------------------------------*/
.intro-splash {
  position: fixed; inset: 0; z-index: 3000;
  background: #000;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.75s ease;
}
.intro-splash.hide { opacity: 0; }            /* splash.js adds .hide to fade out */
.intro-video { max-width: 100%; max-height: 100%; width: auto; height: auto; }
.intro-skip {
  position: absolute; top: 1rem; right: 1.25rem;
  background: rgba(0,0,0,0.45); color: var(--color-text-muted);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 0.4rem 0.9rem; font-family: var(--font-body); font-size: 0.85rem;
  letter-spacing: 0.05em; cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
}
.intro-skip:hover { color: var(--color-gold); border-color: var(--color-gold); }
