/* Garantiza que el atributo hidden siempre oculte, aunque otra regla ponga display:flex */
[hidden] { display: none !important; }

:root {
  --elitv-black: #050b16;
  --elitv-black-surface: #0b1222;
  --elitv-black-card: #131b30;
  --elitv-black-card-hover: #1a2440;
  --elitv-border: #26304d;
  --elitv-red: #8e4bd6;
  --elitv-red-dark: #4933a1;
  --elitv-red-light: #c98bff;
  --elitv-orange: #ff9800;
  --elitv-text-primary: #ffffff;
  --elitv-text-secondary: #a9b1c6;
  --elitv-green: #43a047;
  --elitv-yellow: #fbc02d;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--elitv-black);
  color: var(--elitv-text-primary);
}

.brand { font-size: 28px; font-weight: 800; letter-spacing: 0.5px; }
.brand-eli { color: var(--elitv-text-primary); }
.brand-tv { color: var(--elitv-red); }
.brand-sm { font-size: 22px; margin-bottom: 32px; }

/* ---------------- LOGIN ---------------- */
.view-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #1a0000 0%, #000000 60%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  border-radius: var(--radius);
  text-align: center;
}

.login-subtitle {
  color: var(--elitv-text-secondary);
  margin: 6px 0 28px;
  font-size: 14px;
}

.field-label {
  display: block;
  text-align: left;
  font-size: 12px;
  color: var(--elitv-text-secondary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin: 14px 0 6px;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--elitv-black-surface);
  border: 1px solid var(--elitv-border);
  border-radius: 6px;
  color: var(--elitv-text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus,
input[type="password"]:focus {
  border-color: var(--elitv-red);
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  transition: filter 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: scale(0.98); }
.btn-block { width: 100%; }

.btn-primary { background: var(--elitv-red); color: #fff; }
.btn-primary:disabled { background: #5a1414; cursor: not-allowed; }

.btn-ghost { background: transparent; color: var(--elitv-text-secondary); border: 1px solid var(--elitv-border); }
.btn-ghost:hover { color: #fff; border-color: var(--elitv-red); }

.btn-danger { background: #3a1414; color: #ff6659; }
.btn-danger:hover { background: var(--elitv-red-dark); color: #fff; }

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 4px; }

.error-message {
  color: var(--elitv-red-light);
  font-size: 13px;
  margin-top: 14px;
  text-align: left;
}

/* ---------------- DASHBOARD LAYOUT ---------------- */
.view-dashboard { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--elitv-black-surface);
  border-right: 1px solid var(--elitv-border);
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--elitv-text-secondary);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover { background: var(--elitv-black-card); color: #fff; }
.nav-item.is-active { background: var(--elitv-red); color: #fff; }
.nav-icon { font-size: 16px; }

.sidebar-footer {
  border-top: 1px solid var(--elitv-border);
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.admin-username { font-size: 13px; color: var(--elitv-text-secondary); }

.main-content { flex: 1; padding: 36px 44px; overflow-y: auto; }

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}
.panel-header h1 { margin: 0; font-size: 22px; }
.panel-subtitle { margin: 6px 0 0; color: var(--elitv-text-secondary); font-size: 13px; }

.badge-counter {
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--elitv-text-secondary);
  height: fit-content;
}

/* ---------------- TABLA DISPOSITIVOS ---------------- */
.table-wrapper {
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  padding: 14px 16px;
  color: var(--elitv-text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--elitv-border);
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--elitv-border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--elitv-black-card-hover); }

.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12.5px; color: var(--elitv-text-secondary); }

.uuid-cell { display: flex; align-items: center; gap: 8px; }

.btn-copy {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 5px;
  background: var(--elitv-black-surface);
  border: 1px solid var(--elitv-border);
  color: var(--elitv-text-secondary);
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.btn-copy:hover { color: #fff; border-color: var(--elitv-red); }
.btn-copy.is-copied { color: #66bb6a; border-color: #66bb6a; }

.pin-badge {
  display: inline-block;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--elitv-red-light);
  background: rgba(142, 75, 214, 0.14);
  padding: 3px 9px;
  border-radius: 5px;
}

.status-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.status-active { background: rgba(67, 160, 71, 0.15); color: #66bb6a; }
.status-pending { background: rgba(251, 192, 45, 0.15); color: var(--elitv-yellow); }
.status-paused { background: rgba(255, 152, 0, 0.15); color: var(--elitv-orange); }
.status-revoked { background: rgba(211, 47, 47, 0.18); color: #ff6659; }

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

.empty-state, .loading-row {
  padding: 32px;
  text-align: center;
  color: var(--elitv-text-secondary);
  font-size: 14px;
}
.loading-row { display: none; align-items: center; justify-content: center; gap: 10px; }
.loading-row.is-visible { display: flex; }

/* ---------------- BANNERS GRID ---------------- */
.banner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.banner-slot {
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.banner-slot-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--elitv-black-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.banner-slot-preview img { width: 100%; height: 100%; object-fit: cover; }

.banner-slot-empty-label {
  color: var(--elitv-text-secondary);
  font-size: 13px;
  text-align: center;
  padding: 0 20px;
}

.banner-slot-number {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

.banner-slot-inactive-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 152, 0, 0.9);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
}

.banner-slot-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }

.banner-slot-title-input {
  width: 100%;
  padding: 7px 10px;
  background: var(--elitv-black-surface);
  border: 1px solid var(--elitv-border);
  border-radius: 5px;
  color: #fff;
  font-size: 12.5px;
}

.banner-slot-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.file-input-hidden { display: none; }

/* ---------------- ESTRENOS ---------------- */
.premiere-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.premiere-card {
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.premiere-card-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--elitv-black-surface);
  position: relative;
  overflow: hidden;
}
.premiere-card-preview img { width: 100%; height: 100%; object-fit: cover; }

.premiere-days-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  color: #fff;
}
.premiere-days-badge.days-fresh { background: rgba(67, 160, 71, 0.85); }
.premiere-days-badge.days-soon { background: rgba(255, 152, 0, 0.9); color: #000; }
.premiere-days-badge.days-expired { background: rgba(211, 47, 47, 0.9); }

.premiere-card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.premiere-card-title { font-size: 14px; font-weight: 600; margin: 0; }
.premiere-card-meta { font-size: 11.5px; color: var(--elitv-text-secondary); margin: 0; }
.premiere-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------------- MODAL ---------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 420px;
  background: var(--elitv-black-card);
  border: 1px solid var(--elitv-border);
  border-radius: var(--radius);
  padding: 28px;
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal-hint { color: var(--elitv-text-secondary); font-size: 12.5px; margin: 0 0 6px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* ---------------- SPINNER ---------------- */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 152, 0, 0.25);
  border-top-color: var(--elitv-orange);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
.spinner-btn { margin-left: 4px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- TOASTS ---------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}
.toast {
  padding: 12px 18px;
  border-radius: 6px;
  font-size: 13.5px;
  color: #fff;
  background: var(--elitv-black-card);
  border-left: 4px solid var(--elitv-red);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  animation: slideIn 0.2s ease-out;
  min-width: 240px;
}
.toast.toast-success { border-left-color: var(--elitv-green); }
.toast.toast-error { border-left-color: #d32f2f; }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 760px) {
  .view-dashboard { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; align-items: center; padding: 14px 18px; }
  .brand-sm { margin: 0; }
  .nav { flex-direction: row; }
  .sidebar-footer { flex-direction: row; margin-left: auto; }
  .main-content { padding: 24px; }
}

/* ---- Catálogo / importación ---- */
.import-form { max-width: 640px; margin-bottom: 28px; }
.select-field {
  width: 100%; padding: 10px 12px; margin-bottom: 14px;
  background: var(--elitv-surface, #161616); color: #fff;
  border: 1px solid var(--elitv-border); border-radius: 6px; font-size: 14px;
}
.check-row { display: flex; align-items: center; gap: 8px; margin: 6px 0 16px; color: var(--elitv-text-secondary); font-size: 14px; }

.sync-box { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 18px; }
.sync-box .panel-subtitle { margin: 0; }

/* ---- Cuentas ---- */
.inline-row { display: flex; gap: 8px; align-items: center; }
.inline-row input, .inline-row select { flex: 1; margin-bottom: 0; }
.select-compact { min-width: 190px; margin: 0; padding: 6px 8px; font-size: 13px; }
.data-table small { color: var(--elitv-text-secondary); }

.panel-version { display: block; color: var(--elitv-text-secondary); font-size: 11px; margin: 4px 0 10px; opacity: .7; }

/* ---- Modo del slider ---- */
.slider-mode { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.mode-option {
  display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; cursor: pointer;
  background: var(--elitv-black-card); border: 1px solid var(--elitv-border); border-radius: 10px;
}
.mode-option:has(input:checked) { border-color: var(--elitv-red); background: rgba(142, 75, 214, 0.12); }
.mode-option input { margin-top: 4px; accent-color: var(--elitv-red); }
.mode-option strong { display: block; color: #fff; font-size: 14px; }
.mode-option small { display: block; color: var(--elitv-text-secondary); font-size: 12px; margin-top: 2px; line-height: 1.4; }
.section-title { font-size: 15px; color: #fff; margin: 22px 0 10px; }

/* ---- Multi-DNS ---- */
#accExtraHosts {
  width: 100%; box-sizing: border-box; padding: 10px 12px; margin-bottom: 6px; resize: vertical;
  background: var(--elitv-black-card); color: #fff; border: 1px solid var(--elitv-border);
  border-radius: 6px; font-family: monospace; font-size: 13px;
}
.test-result {
  margin: 4px 0 8px; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; line-height: 1.6;
  background: rgba(142, 75, 214, 0.10); border: 1px solid var(--elitv-border); color: #fff; word-break: break-all;
}
