@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg: #0d0d0f;
  --surface: #18181b;
  --surface2: #1f1f24;
  --border: #2a2a32;
  --accent: #e8490f;
  --accent-dim: rgba(232,73,15,0.15);
  --accent-hover: #f05a24;
  --green: #22c55e;
  --green-dim: rgba(34,197,94,0.12);
  --yellow: #f59e0b;
  --yellow-dim: rgba(245,158,11,0.12);
  --red: #ef4444;
  --red-dim: rgba(239,68,68,0.12);
  --blue: #3b82f6;
  --blue-dim: rgba(59,130,246,0.12);
  --text: #f4f4f5;
  --muted: #71717a;
  --muted2: #52525b;
  --white: #ffffff;
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

html, body { height: 100%; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }

/* ── LAYOUT ── */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar-logo {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: #fff;
  flex-shrink: 0;
}

.sidebar-logo .logo-text { font-size: 15px; font-weight: 700; line-height: 1.2; }
.sidebar-logo .logo-sub { font-size: 11px; color: var(--muted); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }

.nav-label {
  font-size: 10px; font-weight: 600; color: var(--muted2);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 12px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px; font-weight: 500;
  text-decoration: none; transition: all var(--transition); cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
}

.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--accent-dim); color: var(--accent); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}

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

.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--accent); font-weight: 500; }

.btn-logout {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; border-radius: 6px;
  transition: color var(--transition);
}
.btn-logout:hover { color: var(--red); }
.btn-logout svg { width: 18px; height: 18px; display: block; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
}

.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.page-content { padding: 32px; flex: 1; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color var(--transition);
}

.stat-card:hover { border-color: var(--accent); }

.stat-icon {
  width: 48px; height: 48px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; flex-shrink: 0;
}

.stat-icon.orange { background: var(--accent-dim); }
.stat-icon.green { background: var(--green-dim); }
.stat-icon.blue { background: var(--blue-dim); }
.stat-icon.yellow { background: var(--yellow-dim); }

.stat-info .stat-value { font-size: 28px; font-weight: 800; line-height: 1; }
.stat-info .stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── SECTION HEADERS ── */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

.section-title { font-size: 16px; font-weight: 700; }
.section-subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all var(--transition); text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--red-dim); color: var(--red); border: 1px solid rgba(239,68,68,0.2); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn svg { width: 16px; height: 16px; }

/* ── TABLE ── */
.table-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}

.table-search {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}

.search-input-wrap { position: relative; flex: 1; max-width: 320px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search-input {
  width: 100%; padding: 9px 12px 9px 36px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-size: 13px;
  outline: none; transition: border-color var(--transition);
}
.search-input:focus { border-color: var(--accent); }

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead { background: var(--surface2); }
th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.movie-thumb {
  width: 40px; height: 56px; border-radius: 6px;
  object-fit: cover; background: var(--surface2); flex-shrink: 0;
  border: 1px solid var(--border);
}

.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.cell-flex { display: flex; align-items: center; gap: 12px; }

.actions-cell { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.icon-btn {
  width: 32px; height: 32px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--surface2);
  cursor: pointer; color: var(--muted); transition: all var(--transition);
}
.icon-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.icon-btn.danger:hover { background: var(--red-dim); color: var(--red); border-color: var(--red); }
.icon-btn svg { width: 15px; height: 15px; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge-active { background: var(--green-dim); color: var(--green); }
.badge-soon { background: var(--yellow-dim); color: var(--yellow); }
.badge-expired { background: rgba(113,113,122,0.15); color: var(--muted); }
.badge-admin { background: var(--accent-dim); color: var(--accent); }
.badge-user { background: var(--blue-dim); color: var(--blue); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none;
  transition: opacity var(--transition); padding: 20px;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%; max-width: 620px;
  max-height: 90vh; overflow-y: auto;
  transform: translateY(20px); transition: transform var(--transition);
  box-shadow: var(--shadow);
}
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 780px; }

.modal-header {
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 4px; border-radius: 6px; transition: color var(--transition);
}
.modal-close-btn:hover { color: var(--text); }
.modal-close-btn svg { width: 20px; height: 20px; display: block; }

.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: var(--surface);
}

/* ── FORM ── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid.full { grid-template-columns: 1fr; }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.form-input, .form-select, .form-textarea {
  padding: 10px 14px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; font-family: inherit;
  outline: none; transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-select { cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%2371717a' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 20px; padding-right: 34px; }
.form-textarea { min-height: 80px; resize: vertical; }

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

/* Cinema manager */
.cinemas-manager { display: flex; flex-direction: column; gap: 10px; }
.cinema-row {
  display: grid; grid-template-columns: 1fr 1fr 1fr auto;
  gap: 8px; align-items: start;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 12px;
}
.cinema-row .cinema-col { display: flex; flex-direction: column; gap: 4px; }
.cinema-col-label { font-size: 10px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.btn-remove-cinema { color: var(--muted); background: none; border: none; cursor: pointer; padding: 4px; margin-top: 16px; }
.btn-remove-cinema:hover { color: var(--red); }
.btn-remove-cinema svg { width: 16px; height: 16px; }
.btn-add-cinema { align-self: flex-start; }

/* Pricing manager */
.prices-manager { display: flex; flex-direction: column; gap: 8px; }
.price-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: center; }
.btn-remove-price { background: none; border: none; cursor: pointer; color: var(--muted); padding: 4px; }
.btn-remove-price:hover { color: var(--red); }
.btn-remove-price svg { width: 16px; height: 16px; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 20px;
  cursor: pointer; transition: background var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-label { font-size: 13px; font-weight: 500; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px;
}

.login-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 40px; width: 100%; max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-icon {
  width: 56px; height: 56px; background: var(--accent); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 800; }
.login-logo p { font-size: 13px; color: var(--muted); margin-top: 4px; }

.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-divider {
  text-align: center; position: relative; color: var(--muted); font-size: 12px; margin: 4px 0;
}
.login-divider::before, .login-divider::after {
  content: ''; position: absolute; top: 50%; width: 42%; height: 1px; background: var(--border);
}
.login-divider::before { left: 0; } .login-divider::after { right: 0; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 11px; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600;
  color: var(--text); transition: all var(--transition); width: 100%;
}
.btn-google:hover { background: var(--border); }
.btn-google img { width: 18px; height: 18px; }

.login-error {
  background: var(--red-dim); border: 1px solid rgba(239,68,68,0.2);
  color: var(--red); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; display: none;
}
.login-error.visible { display: block; }

/* ── TOAST ── */
.toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow); font-size: 13px; font-weight: 500;
  max-width: 320px; animation: slideIn 0.2s ease;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.info { border-left: 3px solid var(--blue); }
.toast-icon { font-size: 16px; flex-shrink: 0; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* ── CONFIRM MODAL ── */
.confirm-modal { max-width: 420px; }
.confirm-icon { font-size: 36px; text-align: center; margin-bottom: 12px; }
.confirm-text { text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.confirm-title { text-align: center; font-size: 18px; font-weight: 700; margin-bottom: 8px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .cinema-row { grid-template-columns: 1fr; }
  .price-row { grid-template-columns: 1fr 1fr auto; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .table-search { flex-direction: column; align-items: stretch; }
}
