/* =========================
   THEME VARIABLES
========================= */

:root {
  --bg: #0d0d0d;
  --bg-alt: #171717;
  --text: #ffffff;
  --muted: #aaaaaa;
  --accent: #4CAF50;
}

body.theme-light {
  --bg: #f2f2f2;
  --bg-alt: #ffffff;
  --text: #111111;
  --muted: #555555;
  --accent: #0077ff;
}

/* =========================
   GLOBAL
========================= */

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

/* =========================
   TOPBAR
========================= */

.topbar {
  background: #111;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 20;
}

body.theme-light .topbar {
  background: #ffffff;
  border-bottom: 1px solid #ddd;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  font-weight: bold;
  font-size: 18px;
  text-decoration: none;
  color: var(--text);
}

.nav-link {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}

.nav-link:hover {
  color: var(--accent);
}

/* search controls */

.controls {
  display: flex;
  gap: 10px;
  flex: 1;
  justify-content: center;
}

.controls input {
  padding: 8px;
  border-radius: 6px;
  border: none;
  width: 50%;
  max-width: 400px;
  outline: none;
}

.controls select {
  padding: 8px;
  border-radius: 6px;
  border: none;
}

/* auth area */

.auth-area {
  margin-right: 8px;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.user-dropdown {
  position: absolute;
  top: 36px;
  right: 0;
  background: var(--bg-alt);
  padding: 8px 12px;
  border-radius: 6px;
  display: none;
  min-width: 120px;
}

.user-dropdown a {
  display: block;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}

.user-menu:hover .user-dropdown {
  display: block;
}

/* theme button */

.theme-btn {
  background: var(--bg-alt);
  border: none;
  color: var(--text);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
}

/* =========================
   MAIN LAYOUT
========================= */

main {
  padding: 16px;
}

.section-title {
  font-size: 18px;
  margin: 8px 0 12px;
  color: var(--muted);
}

/* =========================
   SEARCH HISTORY
========================= */

.search-history {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.history-chip {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-alt);
  font-size: 12px;
  cursor: pointer;
  border: 1px solid #333;
}

.history-chip:hover {
  border-color: var(--accent);
}

.history-clear {
  padding: 4px 8px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid #444;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

/* =========================
   GRID & CARDS
========================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding-bottom: 10px;
}

.movie-card {
  background: var(--bg-alt);
  padding: 8px;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}

.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.movie-card img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.movie-card h3 {
  margin: 8px 0 4px;
  font-size: 14px;
}

.movie-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.rating {
  font-size: 12px;
  margin-top: 3px;
}

/* =========================
   MOVIE DETAIL PAGE
========================= */

.movie-page {
  padding: 20px;
  max-width: 1000px;
  margin: 0 auto;
}

.movie-top {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.poster-wrap img {
  width: 220px;
  border-radius: 12px;
}

.poster-placeholder {
  width: 220px;
  height: 320px;
  border-radius: 12px;
  background: var(--bg-alt);
}

.movie-main-info {
  flex: 1;
  min-width: 260px;
}

.movie-main-info h1 {
  margin-top: 0;
}

.meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.section-block {
  margin-top: 28px;
}

.section-block h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

/* =========================
   CAST GRID
========================= */

.cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.cast-card {
  background: var(--bg-alt);
  padding: 8px;
  border-radius: 8px;
  font-size: 12px;
  text-align: center;
  cursor: pointer;
}

.cast-card img {
  width: 100%;
  border-radius: 8px;
  object-fit: cover;
}

/* =========================
   SIMILAR GRID
========================= */

.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.similar-card {
  background: var(--bg-alt);
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  text-align: center;
}

.similar-card img {
  width: 100%;
  border-radius: 6px;
}

/* =========================
   PROVIDERS (WHERE TO WATCH)
========================= */

.providers-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.provider-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--bg-alt);
  border-radius: 20px;
  font-size: 12px;
}

.provider-chip img {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  object-fit: cover;
}

/* =========================
   BUTTONS & LINKS
========================= */

.btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.small-btn {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
}

.back-link {
  display: inline-block;
  margin: 8px 0 15px;
  color: var(--accent);
  text-decoration: none;
}

/* =========================
   COMMENTS (PRETTIER)
========================= */

.comment-card {
  display: flex;
  gap: 10px;
  background: var(--bg-alt);
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  animation: commentIn 0.2s ease-out;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4CAF50, #81C784);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: white;
  flex-shrink: 0;
}

.comment-main {
  flex: 1;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 4px;
}

.comment-user {
  font-weight: bold;
}

.comment-time {
  color: var(--muted);
}

.comment-body {
  margin-bottom: 6px;
}

.comment-actions {
  display: flex;
  gap: 6px;
}

.spoiler-comment .spoiler-hidden {
  display: none;
}

.spoiler-comment .spoiler-hidden.spoiler-revealed {
  display: inline;
  color: var(--text);
}

.spoiler-toggle {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  background: #444;
  cursor: pointer;
  margin-right: 6px;
  font-size: 11px;
}

/* animation */

@keyframes commentIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   AUTH PAGE
========================= */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-container {
  max-width: 400px;
  width: 100%;
  padding: 20px;
}

.auth-box {
  background: var(--bg-alt);
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: floatIn 0.4s ease-out;
}

.auth-box h1 {
  margin-top: 0;
  margin-bottom: 16px;
}

.auth-box input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: none;
  outline: none;
}

.auth-btn {
  width: 100%;
  margin-top: 6px;
}

.auth-switch {
  margin-top: 10px;
  font-size: 13px;
}

.auth-switch a {
  color: var(--accent);
  cursor: pointer;
  margin-left: 4px;
}

#authMessage {
  font-size: 13px;
  margin-top: 10px;
}

/* auth animation */

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =========================
   ACTOR PAGE
========================= */

.actor-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.actor-top {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.actor-photo-wrap {
  flex: 0 0 auto;
}

.actor-photo {
  width: 260px;
  border-radius: 12px;
}

.actor-photo.placeholder {
  width: 260px;
  height: 350px;
  background: var(--bg-alt);
  border-radius: 12px;
}

.actor-main-info {
  flex: 1;
  min-width: 260px;
}

.actor-meta {
  color: var(--muted);
  margin-bottom: 8px;
}

.actor-bio {
  white-space: pre-wrap;
  line-height: 1.5;
}

.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

.actor-card {
  background: var(--bg-alt);
  border-radius: 10px;
  padding: 8px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease;
}

.actor-card:hover {
  transform: translateY(-4px);
}

.actor-card img {
  width: 100%;
  border-radius: 10px;
}

.filmography {
  margin-top: 10px;
}

.film-row {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #333;
  cursor: pointer;
}

.film-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.film-year {
  width: 60px;
  color: var(--muted);
}

.film-title {
  flex: 1;
}

.film-role {
  color: var(--muted);
}

/* =========================
   GENRE PAGE
========================= */

.genres-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.genre-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
}

@media (max-width: 800px) {
  .genre-layout {
    grid-template-columns: 1fr;
  }
}

.genre-sidebar {
  background: var(--bg-alt);
  padding: 12px;
  border-radius: 10px;
}

.genre-sidebar h2 {
  margin-top: 0;
  font-size: 18px;
}

.genre-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.genre-card {
  padding: 6px 8px;
  border-radius: 6px;
  background: #111;
  font-size: 13px;
  cursor: pointer;
}

.genre-card:hover {
  background: #222;
}

.genre-results {
  background: var(--bg-alt);
  padding: 12px;
  border-radius: 10px;
}

.genre-results h2 {
  margin-top: 0;
  font-size: 18px;
}
.star-rating {
  display: flex;
  gap: 4px;
  font-size: 20px;
  cursor: pointer;
}

.star-item {
  color: #555;
}

.star-item.active {
  color: gold;
}


/* =========================
   RESPONSIVE
========================= */

@media (max-width: 700px) {
  .controls input {
    width: 60%;
  }

  .movie-top {
    flex-direction: column;
    align-items: center;
  }

  .poster-wrap img,
  .poster-placeholder {
    width: 180px;
  }

  .movie-main-info {
    text-align: left;
  }
}
/* === Profile dropdown polish (NON-DESTRUCTIVE) === */

.user-menu {
  position: relative;
  display: inline-block;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  object-fit: cover;
  border: 2px solid var(--accent, #4CAF50);
}

/* hidden by default – shown via .show class from JS */
.dropdown {
  position: absolute;
  right: 0;
  top: 42px;
  background: var(--bg-alt, #171717);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  padding: 4px 0;
  min-width: 160px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 50;
}

.dropdown.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dropdown-item {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text, #fff);
  text-align: left;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
  display: block;
}

.dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.dropdown-item.red {
  color: #ff6961;
}
/* ============================================================
   EDIT PROFILE PAGE — clean Netflix-style card
   (Safe to append; does NOT override your main layout)
============================================================ */

.edit-profile-container {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding-top: 40px;
  padding-bottom: 40px;
}

.edit-profile-card {
  background: var(--bg-alt, #1a1a1a);
  padding: 28px;
  width: 95%;
  max-width: 420px;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(0,0,0,0.45);
}

.edit-title {
  margin-bottom: 20px;
  font-size: 24px;
}

.edit-profile-card label {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
  margin-top: 10px;
}

.edit-profile-card input,
.edit-profile-card textarea {
  width: 100%;
  padding: 10px;
  background: #222;
  color: #fff;
  border: 1px solid #444;
  border-radius: 8px;
  margin-bottom: 5px;
  font-size: 14px;
}

.save-btn {
  width: 100%;
  margin-top: 14px;
}

.back-btn {
  margin-bottom: 12px;
}

.status-message {
  margin-top: 10px;
  font-size: 14px;
  min-height: 20px;
}
/* ==== FIX PROFILE AVATAR IMAGE SHAPE & SIZE ==== */

.profile-avatar {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  object-fit: cover; /* crop automatically */
  object-position: center; /* center the crop */
  border: 3px solid var(--accent, #4CAF50);
  background: #222;
}
/* ============================================================
   PROFILE PAGE REVAMP — modern clean layout
============================================================ */

.profile-page {
  padding: 30px 20px;
  max-width: 900px;
  margin: auto;
}

.profile-header-card {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 25px;
  background: var(--bg-alt, #111);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  margin-bottom: 30px;
}

.profile-info h1 {
  margin: 0;
  font-size: 28px;
}

.profile-info .muted {
  color: var(--muted, #888);
}

.profile-actions {
  margin-top: 12px;
}

.profile-section {
  margin-bottom: 40px;
}

.profile-section h2 {
  margin-bottom: 14px;
  font-size: 22px;
}

.activity-list {
  background: var(--bg-alt, #111);
  padding: 20px;
  border-radius: 12px;
}

.activity-list div {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #333;
}
/* ============================================================
   CROP IMAGE MODAL
============================================================ */

.cropper-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.84);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.cropper-modal.show {
  display: flex;
}

.cropper-box {
  background: #111;
  padding: 20px;
  border-radius: 12px;
  max-width: 90vw;
  max-height: 90vh;
}

#cropperImage {
  max-width: 70vw;
  max-height: 60vh;
  display: block;
  margin: auto;
  border-radius: 6px;
}

.cropper-actions {
  text-align: center;
  margin-top: 14px;
  display: flex;
  justify-content: center;
  gap: 15px;
}
/* ========= AUTH PAGE UPGRADE (login / signup) ========= */

.theme-dark.auth-body,
.theme-dark.auth-page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  background:
    radial-gradient(circle at top, #1b2540 0, #05060b 45%, #000 100%);
  color: #fff;
}

.auth-container {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 24px;
}

.auth-box {
  background: rgba(8, 8, 16, 0.9);
  backdrop-filter: blur(18px);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.06);
  animation: authPop 0.3s ease-out;
}

.auth-box h1,
.auth-title {
  margin-top: 0;
  margin-bottom: 18px;
  font-size: 24px;
  text-align: center;
}

.auth-box input,
.auth-input input {
  width: 100%;
  padding: 12px 11px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid #2b2b3f;
  background: #10101b;
  color: #f9f9ff;
  font-size: 14px;
}

.auth-box input:focus,
.auth-input input:focus {
  outline: none;
  border-color: #4cafef;
  box-shadow: 0 0 0 1px rgba(76, 175, 239, 0.5);
}

.auth-btn,
.auth-btn-full {
  width: 100%;
  padding: 11px 0;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #4cafef, #6f6bff);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.auth-btn:hover,
.auth-btn-full:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(76, 175, 239, 0.35);
  opacity: 0.95;
}

.auth-btn:active,
.auth-btn-full:active {
  transform: translateY(0);
  box-shadow: none;
}

.auth-switch {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: #c8c8dd;
}

.auth-switch a,
.auth-switch #switchLink {
  color: #4cafef;
  cursor: pointer;
  text-decoration: none;
}

.auth-switch a:hover,
.auth-switch #switchLink:hover {
  text-decoration: underline;
}

#authMessage,
.auth-message {
  margin-top: 10px;
  text-align: center;
  font-size: 13px;
  min-height: 18px;
  color: #f5f5f5;
}

/* Subtle entry animation */
@keyframes authPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Small screens auth layout */
@media (max-width: 600px) {
  .auth-box {
    padding: 24px 18px;
    max-width: 340px;
  }
}
/* ========= GLOBAL RESPONSIVE TWEAKS ========= */

@media (max-width: 900px) {
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
  }

  .topbar .logo {
    margin-bottom: 4px;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-top: 6px;
  }
}

/* Movie detail page layout on mobile */
@media (max-width: 768px) {
  .movie-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .poster-wrap img,
  .poster-placeholder {
    width: 190px;
    max-width: 70vw;
  }

  .movie-main-info {
    width: 100%;
    margin-top: 16px;
  }

  iframe {
    max-width: 100%;
  }
}

/* Grids (movies, actors, similar) on small screens */
@media (max-width: 700px) {
  .grid,
  .similar-grid,
  .cast-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 10px;
  }

  .movie-card img,
  .similar-card img,
  .cast-card img {
    width: 100%;
    height: auto;
    border-radius: 10px;
  }
}

/* Profile & edit profile on mobile */
@media (max-width: 700px) {
  .profile-header-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .edit-profile-container {
    padding: 24px 12px;
  }

  .edit-profile-card {
    max-width: 380px;
    width: 100%;
  }
}

/* Comments section mobile readability */
@media (max-width: 700px) {
  .comment-card {
    display: flex;
    gap: 8px;
  }

  .comment-main {
    font-size: 13px;
  }

  .comment-body {
    word-wrap: break-word;
  }
}
