/*
 * Main stylesheet — Portal Aleși Locali v2
 * Global reset, typography, components.
 */

/* ── Reset & Base ─────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Typography ───────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6 { font-weight: 700; line-height: 1.3; color: var(--text); }
h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }

.muted { color: var(--muted); }
.text-sm { font-size: var(--font-size-sm); }
.text-xs { font-size: var(--font-size-xs); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }

/* ── Layout ───────────────────────────────────────────────────────── */

.container {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.main-content {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-3xl);
}

/* ── Grid system ──────────────────────────────────────────────────── */

.grid { display: grid; gap: var(--space-lg); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ── Flex helpers ─────────────────────────────────────────────────── */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ── Header / Topbar ──────────────────────────────────────────────── */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background: rgba(15, 22, 50, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  order: 1;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--font-size-md);
  color: #ffffff;
}

.brand-title {
  font-size: var(--font-size-md);
  font-weight: 800;
  color: var(--text);
}

.brand-sub {
  font-size: var(--font-size-xs);
  color: var(--muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  order: 3;
  margin-left: auto;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  order: 2;
}

/* ── User menu: icon on mobile, name on desktop ─────────────────── */
.user-icon-mobile { display: none; vertical-align: middle; }
.user-name-text   { vertical-align: middle; }

/* ── Hamburger button (hidden on desktop) ───────────────────────── */

.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ── Navigation links ─────────────────────────────────────────────── */

.nav-link {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: all .15s ease;
  white-space: nowrap;
}

.nav-link:hover {
  background: var(--btn);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--primary);
  color: #fff;
}

/* ── App shell: sidebar layout ────────────────────────────────────── */

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

.app-sidebar {
  width: 232px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  position: fixed;            /* fix pe stânga, indiferent de overflow-ul din ancestori */
  left: 0;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;           /* derulează doar lista (.side-nav), brand-ul rămâne fix */
  z-index: var(--z-sticky);
  transition: width .18s ease;
}
.app-shell.collapsed .app-sidebar { width: 64px; }

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  flex: 0 0 auto;             /* rămâne fix sus când lista derulează */
}
.side-brand:hover { text-decoration: none; }
.side-brand .brand-logo { flex: 0 0 36px; width: 36px; height: 36px; font-size: var(--font-size-sm); }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.side-brand-title { font-weight: 800; font-size: var(--font-size-base); white-space: nowrap; }
.side-brand-sub { font-size: 10px; color: var(--muted); white-space: nowrap; }
.app-shell.collapsed .side-brand-text { display: none; }

.side-nav { display: flex; flex-direction: column; padding: 8px; gap: 1px; flex: 1 1 auto; overflow-y: auto; overflow-x: hidden; }

.side-section {
  font-size: 10px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #5e6e95;
  font-weight: 800;
  padding: 14px 12px 4px;
}
.app-shell.collapsed .side-section { font-size: 0; padding: 10px 0 4px; text-align: center; }
.app-shell.collapsed .side-section::before { content: "•"; font-size: 12px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--muted);
  font-weight: 600;
  font-size: var(--font-size-base);
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.side-link:hover { background: var(--btn); color: var(--text); text-decoration: none; }
.side-link.active { background: var(--primary); color: #fff; }
.side-link .side-ic { flex: 0 0 22px; width: 22px; text-align: center; font-size: 15px; }
.side-link .side-tx { overflow: hidden; text-overflow: ellipsis; }
.app-shell.collapsed .side-link { justify-content: center; padding: 10px 0; gap: 0; }
.app-shell.collapsed .side-link .side-tx { display: none; }

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  margin-left: 232px;          /* lasă loc sidebar-ului fix */
  transition: margin-left .18s ease;
}
.app-shell.collapsed .app-main { margin-left: 64px; }
.app-shell.no-sidebar .app-main { margin-left: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: calc(var(--z-sticky) - 1);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(15, 22, 50, .85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.sidebar-toggle:hover { color: var(--text); border-color: rgba(255, 255, 255, .25); }

.topbar-brand { display: none; font-weight: 800; color: var(--text); text-decoration: none; }
/* Fără sidebar (ex. panou admin) → arătăm brand-ul în topbar ca reper + link acasă */
.app-shell.no-sidebar .topbar-brand { display: inline-flex; align-items: center; }

.app-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  z-index: calc(var(--z-modal) - 1);
}

/* ── Cards ────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.card-title {
  font-size: var(--font-size-md);
  font-weight: 700;
}

/* ── Buttons ──────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-md);
  background: var(--btn);
  color: var(--text);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}

.btn:hover {
  background: var(--accent);
  text-decoration: none;
}

.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger-text);
}

.btn-success {
  background: var(--success-bg);
  border-color: var(--success);
  color: var(--success-text);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--btn);
}

.btn-sm {
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-base);
}

/* ── Badges ───────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
}

.badge.nou        { background: var(--info-bg);    color: var(--info-text);    border-color: var(--info); }
.badge.in_lucru   { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning); }
.badge.astept_detalii { background: var(--danger-bg); color: var(--danger-text); border-color: var(--danger); }
.badge.finalizat  { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }
.badge.respins    { background: var(--danger-bg);  color: var(--danger-text);  border-color: var(--danger); }
.badge.pending    { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning); }
.badge.approved   { background: var(--success-bg); color: var(--success-text); border-color: var(--success); }

.pill-new {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  background: #e14141;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

/* ── Forms ────────────────────────────────────────────────────────── */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--muted);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  transition: border-color .15s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(76, 125, 255, .15);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--muted);
  opacity: .6;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.form-select {
  cursor: pointer;
}

.form-error {
  color: var(--danger);
  font-size: var(--font-size-sm);
  display: none;
}

.form-hint {
  font-size: var(--font-size-xs);
  color: var(--muted);
}

/* ── Modals ───────────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-2xl);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
}

.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 800;
}

.modal-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 20px;
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
}

/* ── Toast notifications ──────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  z-index: var(--z-toast);
  display: grid;
  gap: var(--space-sm);
  pointer-events: none;
}

.toast {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: #fff;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
  animation: toastIn .3s ease;
}

.toast.success { background: var(--success-bg); border-color: var(--success); color: var(--success-text); }
.toast.error   { background: var(--danger-bg);  border-color: var(--danger);  color: var(--danger-text); }
.toast.warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning-text); }
.toast.info    { background: var(--info-bg);    border-color: var(--info);    color: var(--info-text); }

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

/* ── Tables ───────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.table th,
.table td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-weight: 700;
  color: var(--muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: .5px;
  position: sticky;
  top: 0;
  background: var(--card);
}

.table tbody tr:hover {
  background: rgba(76, 125, 255, .04);
}

/* ── Filters bar ──────────────────────────────────────────────────── */

.filters {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.filters .form-input,
.filters .form-select {
  max-width: 220px;
}

/* ── Section headers ──────────────────────────────────────────────── */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.section-title {
  font-size: var(--font-size-xl);
  font-weight: 800;
}

/* ── Tiles ────────────────────────────────────────────────────────── */

.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  min-height: 160px;
}

.tile-value {
  font-size: var(--font-size-3xl);
  font-weight: 800;
  margin-top: auto;
}

.tile-label {
  font-size: var(--font-size-sm);
  color: var(--muted);
  margin-top: var(--space-xs);
}

/* ── Avatars ──────────────────────────────────────────────────────── */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--font-size-sm);
  flex-shrink: 0;
}

.avatar-sm { width: 28px; height: 28px; font-size: var(--font-size-xs); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--font-size-lg); }

/* ── Empty state ──────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-lg);
  color: var(--muted);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: var(--space-md);
  opacity: .4;
}

.empty-state-text {
  font-size: var(--font-size-md);
}

/* ── Loading spinner ──────────────────────────────────────────────── */

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Utility: hidden ──────────────────────────────────────────────── */

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── FAQ formatted answer ────────────────────────────────────────── */
.fq-answer p { margin: 0 0 6px; }
.fq-answer p:last-child { margin-bottom: 0; }
.fq-answer ol, .fq-answer ul { margin: 6px 0; padding-left: 22px; }
.fq-answer ol li, .fq-answer ul li { margin-bottom: 4px; line-height: 1.5; }
.fq-answer ul { list-style-type: disc; }
.fq-answer strong { color: #e0e8ff; }
.fq-answer br { display: block; content: ''; margin: 4px 0; }

/* ── Link „Vezi cum funcționează" către filmele de lansare ───────── */
.film-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border-radius: 999px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18);
  color: inherit; font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background .2s, border-color .2s;
}
.film-link:hover, .film-link:focus-visible { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.35); }
.film-link-play {
  width: 22px; height: 22px; border-radius: 50%; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: #ff3b52; color: #fff; font-size: 9px; padding-left: 1px;
}
.film-link-row { display: flex; justify-content: flex-end; margin-bottom: 10px; }

