:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #1a1f2b;
  --text-muted: #5b6472;
  --border: #e2e6ee;
  --radius: 12px;
}

* { box-sizing: border-box; }

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

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.site-header-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: .9rem;
  flex-shrink: 0;
}
.site-header-title { font-size: 1.15rem; font-weight: 700; }
.site-header-subtitle { font-size: .85rem; color: var(--text-muted); }

.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 60px;
}

.intro {
  color: var(--text-muted);
  font-size: .95rem;
  margin: 0 0 24px;
  max-width: 65ch;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

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

.card-video {
  aspect-ratio: 16 / 9;
  background: #0b0f19;
}
.card-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.card-video-error {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #cbd2e0;
  padding: 16px;
  font-size: .85rem;
}
.card-video-error-detalle {
  color: #8891a3;
  font-size: .75rem;
  margin-top: 6px;
}

.card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.card-nombre { margin: 0; font-size: 1.05rem; font-weight: 700; }
.card-titulo { margin: 0; font-size: .88rem; color: var(--primary); font-weight: 600; }
.card-descripcion { margin: 4px 0 0; font-size: .85rem; color: var(--text-muted); flex: 1; }
.card-link {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.card-link:hover { color: var(--primary-dark); text-decoration: underline; }

.vacio { color: var(--text-muted); text-align: center; padding: 60px 0; }

.site-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: .78rem;
  border-top: 1px solid var(--border);
}
.site-footer a { color: var(--text-muted); }

/* Mensajes flash (confirmaciones y errores de /admin) */
.flash {
  background: #eef4ff;
  border: 1px solid #c7dbff;
  color: var(--primary-dark);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 20px;
  font-size: .88rem;
}
.flash p { margin: 0; }
.flash p + p { margin-top: 4px; }

/* Admin: login y formulario de carga */
.admin-title { font-size: 1.3rem; margin: 0 0 18px; }
.admin-subtitle { font-size: 1.05rem; margin: 32px 0 12px; }
.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.admin-logout { font-size: .82rem; color: var(--text-muted); }

.admin-login { max-width: 320px; margin: 40px auto; }

.admin-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 480px;
}
.admin-form-narrow { max-width: none; }
.admin-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.admin-form input, .admin-form textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 400;
}
.admin-form input:focus, .admin-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.admin-form textarea { resize: vertical; }

.btn {
  align-self: flex-start;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { background: var(--primary-dark); }

.btn-danger {
  background: none;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: .78rem;
  cursor: pointer;
}
.btn-danger:hover { background: #fef2f2; }

.admin-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.admin-table th { text-align: left; background: #f8f9fc; padding: 10px 14px; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px 14px; font-size: .88rem; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-ok { color: #16a34a; font-size: .82rem; }
.admin-warn { color: #d97706; font-size: .82rem; }
.table-wrapper { overflow-x: auto; }
