/* ── Global ─────────────────────────────────────────────── */
:root {
  --brand: #f5c518;
  --brand-dark: #d4a800;
  --bg-dark: #141414;
  --bg-card: #1c1c1c;
  --bg-card2: #242424;
  --text-main: #f0f0f0;
  --text-muted: #aaaaaa;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
}

/* ── Bootstrap text overrides ───────────────────────────── */
.text-muted { color: var(--text-muted) !important; }
.form-label { color: #d0d0d0; }
.form-text  { color: var(--text-muted); }
.small, small { color: inherit; }

/* ── Cards inherit text ─────────────────────────────────── */
.card { color: var(--text-main); }
.card-body, .card-footer { color: var(--text-main); }

/* ── Modal text ─────────────────────────────────────────── */
.modal-content { color: var(--text-main); }
.modal-title   { color: var(--text-main); }

/* ── Dropdown ───────────────────────────────────────────── */
.dropdown-menu { background: #1c1c1c; border-color: #333; }
.dropdown-item { color: #d0d0d0; }
.dropdown-item:hover { background: #2a2a2a; color: var(--brand); }
.dropdown-item-text { color: var(--text-muted); }
.dropdown-divider { border-color: #333; }

/* ── Accordion ──────────────────────────────────────────── */
.accordion-button { color: var(--text-muted); }
.accordion-button:not(.collapsed) { color: var(--brand); }

/* ── Alert text ─────────────────────────────────────────── */
.alert-success { color: #a3d9a5; background: #0f2e12; border-color: #1a4a1e; }
.alert-danger  { color: #f5a5a5; background: #2e0f0f; border-color: #4a1a1a; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  background: #0d0d0d !important;
  border-bottom: 2px solid var(--brand);
}
.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--brand) !important;
  letter-spacing: 1px;
}
.navbar-brand span { color: #fff; }
.nav-link { color: #ccc !important; transition: color .2s; }
.nav-link:hover, .nav-link.active { color: var(--brand) !important; }

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid #2a2a2a;
  border-radius: 12px;
}
.card:hover { border-color: #444; }

/* ── Movie Card ─────────────────────────────────────────── */
.movie-card {
  transition: transform .2s, box-shadow .2s;
}
.movie-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(245,197,24,.15);
  border-color: var(--brand) !important;
}
.movie-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px 8px 0 0;
  background: #2a2a2a;
}
.movie-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #2a2a2a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: #444;
  border-radius: 8px 8px 0 0;
}
.imdb-badge {
  background: var(--brand);
  color: #000;
  font-weight: 700;
  font-size: .7rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.stars { color: var(--brand); font-size: 1rem; letter-spacing: 1px; }
.stars .empty { color: #444; }

/* ── Search ─────────────────────────────────────────────── */
.search-hero {
  background: linear-gradient(135deg, #1a1a1a 0%, #0d0d0d 100%);
  border-bottom: 1px solid #2a2a2a;
  padding: 2rem 0;
}
.search-hero h1 { color: var(--brand); font-weight: 800; }
.form-control, .form-select {
  background: #1e1e1e;
  border-color: #333;
  color: #eee;
}
.form-control:focus, .form-select:focus {
  background: #252525;
  border-color: var(--brand);
  box-shadow: 0 0 0 .2rem rgba(245,197,24,.15);
  color: #fff;
}
.form-control::placeholder { color: #777; }

/* ── Buttons ────────────────────────────────────────────── */
.btn-brand {
  background: var(--brand);
  color: #000;
  font-weight: 700;
  border: none;
}
.btn-brand:hover { background: var(--brand-dark); color: #000; }
.btn-outline-brand {
  border-color: var(--brand);
  color: var(--brand);
}
.btn-outline-brand:hover { background: var(--brand); color: #000; }

/* ── Admin ──────────────────────────────────────────────── */
.sidebar {
  background: #111;
  min-height: calc(100vh - 60px);
  border-right: 1px solid #222;
}
.sidebar .nav-link {
  color: #bbb !important;
  border-radius: 8px;
  margin-bottom: 2px;
  padding: .6rem 1rem;
}
.sidebar .nav-link:hover, .sidebar .nav-link.active {
  background: rgba(245,197,24,.12);
  color: var(--brand) !important;
}
.sidebar .nav-link i { width: 20px; text-align: center; }

/* ── Stats Cards ────────────────────────────────────────── */
.stat-card {
  background: var(--bg-card2);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  border: 1px solid #2a2a2a;
}
.stat-card .stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--brand);
}

/* ── Feedback ───────────────────────────────────────────── */
.feedback-box {
  background: #1a1a1a;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: .75rem 1rem;
  font-style: italic;
  color: #d8d8d8;
  font-size: .9rem;
}

/* ── Badge genre ────────────────────────────────────────── */
.badge-genre {
  background: #2a2a2a;
  color: #ccc;
  border-radius: 20px;
  font-size: .72rem;
  padding: 3px 10px;
  display: inline-block;
  margin: 2px;
}

/* ── Modal ──────────────────────────────────────────────── */
.modal-content {
  background: var(--bg-card);
  border: 1px solid #333;
}
.modal-header { border-bottom-color: #333; }
.modal-footer { border-top-color: #333; }

/* ── Table ──────────────────────────────────────────────── */
.table { color: #e8e8e8; }
.table-dark-custom { background: var(--bg-card); }
.table > :not(caption) > * > * {
  background-color: transparent;
  border-color: #2a2a2a;
}
.table tbody tr:hover td { background: rgba(255,255,255,.03); }

/* ── Login ──────────────────────────────────────────────── */
.login-card {
  max-width: 400px;
  margin: auto;
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #111; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }

/* ── Pagination ─────────────────────────────────────────── */
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #000; }
.page-link { background: #1e1e1e; border-color: #333; color: #ccc; }
.page-link:hover { background: #2a2a2a; color: var(--brand); }

/* ── Shared by ──────────────────────────────────────────── */
.avatar-initials {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
}

/* ── Skeleton loader ────────────────────────────────────── */
@keyframes pulse {
  0%, 100% { opacity: .4; }
  50%       { opacity: .8; }
}

/* ── Community clickable card ───────────────────────────── */
.comm-card {
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.comm-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(245,197,24,.18);
  border-color: var(--brand) !important;
}
.comm-card .click-hint {
  font-size: .68rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity .2s;
}
.comm-card:hover .click-hint { opacity: 1; }

/* ── Movie detail modal ──────────────────────────────────── */
#movieDetailModal .modal-dialog {
  max-width: 720px;
}
#movieDetailModal .modal-content {
  background: #181818;
  border: 1px solid #2a2a2a;
}
#movieDetailModal .modal-header {
  background: #111;
  border-bottom: 1px solid #2a2a2a;
  padding: 1rem 1.25rem;
}
#movieDetailModal .modal-body { padding: 0; }
.mdl-poster {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 8px;
}
.mdl-poster-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: #222;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
}
.mdl-section {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #222;
}
.mdl-section:last-child { border-bottom: none; }
.mdl-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--brand);
  margin-bottom: .6rem;
}
.mdl-plot-text {
  color: #c8c8c8;
  font-size: .9rem;
  line-height: 1.65;
}
.mdl-feedback {
  background: #141414;
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  padding: .75rem 1rem;
  color: #d0d0d0;
  font-style: italic;
  font-size: .9rem;
  line-height: 1.6;
}
[dir="rtl"] .mdl-feedback {
  border-left: none;
  border-right: 3px solid var(--brand);
  border-radius: 8px 0 0 8px;
}
.mdl-comments-list {
  max-height: 340px;
  overflow-y: auto;
}

/* ── Comments ───────────────────────────────────────────── */
.comments-section {
  background: #111;
  border-top: 1px solid #2a2a2a;
  border-radius: 0 0 12px 12px;
}
.comment-item {
  padding: .6rem 1rem;
  border-bottom: 1px solid #1e1e1e;
  transition: background .15s;
}
.comment-item:last-of-type { border-bottom: none; }
.comment-item:hover { background: rgba(255,255,255,.02); }
.comment-body {
  color: #d0d0d0;
  font-size: .875rem;
  line-height: 1.5;
  word-break: break-word;
}
.comment-meta {
  font-size: .7rem;
  color: var(--text-muted);
}
.comment-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #2a2a2a;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .7rem;
  flex-shrink: 0;
}
.comment-input-wrap {
  padding: .6rem 1rem;
  background: #0f0f0f;
  border-top: 1px solid #1e1e1e;
  border-radius: 0 0 12px 12px;
}
.comment-input-wrap .form-control {
  background: #1a1a1a;
  border-color: #2a2a2a;
  font-size: .875rem;
  resize: none;
}
.comment-input-wrap .form-control:focus {
  border-color: var(--brand);
  background: #1e1e1e;
}
.btn-comment-del {
  opacity: 0;
  transition: opacity .15s;
  background: none;
  border: none;
  color: #666;
  padding: 0 4px;
  line-height: 1;
  font-size: .8rem;
}
.comment-item:hover .btn-comment-del { opacity: 1; }
.btn-comment-del:hover { color: #e74c3c; }
.comments-toggle {
  font-size: .8rem;
  color: var(--text-muted);
  background: none;
  border: none;
  padding: .5rem 1rem;
  width: 100%;
  text-align: start;
  border-top: 1px solid #2a2a2a;
  transition: color .15s;
}
.comments-toggle:hover { color: var(--brand); }
.comments-toggle i { transition: transform .2s; }
.comments-toggle.open i.bi-chevron-down { transform: rotate(180deg); }

/* ── RTL overrides ──────────────────────────────────────── */
[dir="rtl"] body {
  font-family: 'Cairo', system-ui, sans-serif;
}
/* Flip the feedback quote bar side */
[dir="rtl"] .feedback-box {
  border-left: none;
  border-right: 3px solid var(--brand);
  border-radius: 6px 0 0 6px;
}
/* Flip the plot summary bar in the add-modal */
[dir="rtl"] #modal_plot_wrap > div {
  border-left: none;
  border-right: 3px solid var(--brand);
  border-radius: 6px 0 0 6px;
}
/* Sidebar border flips in RTL */
[dir="rtl"] .sidebar {
  border-right: none;
  border-left: 1px solid #222;
}
/* Community card image rounds the correct side in RTL */
[dir="rtl"] .card .row.g-0 img {
  border-radius: 0 12px 12px 0;
}
[dir="rtl"] .card .row.g-0 > .col-4 > div {
  border-radius: 0 12px 12px 0;
}
/* Star rating row direction stays LTR so ★ order is natural */
[dir="rtl"] #star_picker,
[dir="rtl"] #edit_star_picker {
  direction: ltr;
  justify-content: flex-end;
}
/* Dropdown alignment */
[dir="rtl"] .dropdown-menu-end {
  --bs-position: start;
}
/* Input-group icons */
[dir="rtl"] .input-group > .input-group-text:first-child {
  border-radius: 0 .375rem .375rem 0;
}
[dir="rtl"] .input-group > .form-control:last-child {
  border-radius: .375rem 0 0 .375rem;
}

/* ── Responsive tweaks ──────────────────────────────────── */
@media (max-width: 576px) {
  .movie-card { margin-bottom: 1rem; }
  .stat-card .stat-num { font-size: 1.8rem; }
}
