/* Cartelería — base styles */

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

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #2563eb;
  --body-bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --radius: 8px;
}

body { font-family: system-ui, -apple-system, sans-serif; font-size: 14px; color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Admin layout ── */

.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--body-bg);
}

.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-brand {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-icon { font-size: 20px; }
.brand-name { color: #fff; font-weight: 700; font-size: 16px; }

.sidebar-nav { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-nav li { padding: 0; }

.nav-link {
  display: block;
  padding: 10px 20px;
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: var(--sidebar-active); color: #fff; }

.sidebar-footer { padding: 12px 0; border-top: 1px solid rgba(255,255,255,.08); }

.main-content { margin-left: 220px; flex: 1; padding: 28px 32px; min-height: 100vh; }

/* ── Flash ── */

.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 14px; }
.flash-notice { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.flash-alert  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* ── Page header ── */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.page-title { font-size: 22px; font-weight: 700; }

/* ── Stat cards ── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.stat-value { font-size: 32px; font-weight: 700; margin-top: 4px; }
.stat-online  { color: var(--success); }
.stat-offline { color: var(--danger); }
.stat-total   { color: var(--text); }

/* ── Cards ── */

.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title { font-weight: 600; font-size: 15px; }
.card-body { padding: 20px; }

/* ── Tables ── */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; background: #f8fafc; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges ── */

.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 11px; font-weight: 600; }
.badge-online  { background: #dcfce7; color: #15803d; }
.badge-offline { background: #fee2e2; color: #b91c1c; }
.badge-image   { background: #dbeafe; color: #1d4ed8; }
.badge-video   { background: #ede9fe; color: #6d28d9; }

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  transition: background .15s;
}

.btn:hover { text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f8fafc; }
.btn-danger   { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Forms ── */

.form-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; max-width: 600px; }
.form-group { margin-bottom: 18px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }

input[type="text"],
input[type="email"],
input[type="number"],
input[type="datetime-local"],
input[type="file"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

input[readonly] { background: #f8fafc; color: var(--text-muted); cursor: default; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 24px; }

/* ── Detail grid ── */

.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; }
.detail-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.detail-value { font-size: 14px; margin-top: 2px; }

.token-box {
  font-family: monospace;
  font-size: 13px;
  background: #f1f5f9;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  word-break: break-all;
}

/* ── Playlist items ── */

.playlist-items { list-style: none; }

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

.playlist-item:last-child { border-bottom: none; }
.playlist-item-pos { width: 24px; text-align: center; font-weight: 700; color: var(--text-muted); font-size: 12px; }
.playlist-item-title { flex: 1; font-weight: 500; }
.playlist-item-dur { color: var(--text-muted); font-size: 13px; min-width: 80px; }
.playlist-item-actions { display: flex; gap: 6px; }

/* ── Media preview ── */

.media-preview { max-width: 100%; max-height: 300px; border-radius: var(--radius); border: 1px solid var(--border); display: block; margin-bottom: 16px; }

/* ── Player ── */

.player-body { background: #000; margin: 0; padding: 0; overflow: hidden; width: 100vw; height: 100vh; }

#player { width: 100%; height: 100%; position: relative; background: #000; }

.media-item {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  display: none;
}

.media-item.active { display: block; }

.player-collage {
  width: 100%;
  height: 100%;
  display: grid;
  background: #000;
}

.collage-cell { position: relative; overflow: hidden; min-width: 0; min-height: 0; }

.collage-media { width: 100%; height: 100%; object-fit: cover; display: block; }

.collage-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
}

.player-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: #555;
  font-size: 18px;
  background: #111;
}

/* ── Devise ── */

.devise-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--body-bg);
}

.devise-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px;
  width: 360px;
}

.devise-title { font-size: 20px; font-weight: 700; margin-bottom: 24px; text-align: center; }

.devise-card p { font-size: 13px; text-align: center; margin-top: 12px; }
