:root {
  --color-navy: #0d1b3a;
  --color-navy-light: #16295a;
  --color-orange: #f5820a;
  --color-red: #e0392b;
  --color-green: #4caf50;
  --color-green-dark: #388e3c;
  --color-text-light: #ffffff;
  --color-text-muted: #b9c2d6;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, sans-serif; color: #222; background: #fafafa; }

a { color: var(--color-green-dark); }

/* Portada (home): fondo azul sólido continuo de punta a punta — la ilustración de Curicó
   vive únicamente en el footer (.site-footer, más abajo), que se funde hacia arriba con
   este mismo tono. Scoped a body.is-homepage para no afectar el resto del sitio. */
body.is-homepage {
  background-color: var(--color-navy);
  color: var(--color-text-light);
}
body.is-homepage .site-header { background: transparent; border-bottom-color: rgba(255,255,255,0.12); }
body.is-homepage .event-section h2,
body.is-homepage .homepage-section-title { color: var(--color-text-light); }
body.is-homepage .section-subtitle { color: var(--color-text-muted); }
body.is-homepage .panorama-card { background: #12244a; color: var(--color-text-light); border-radius: 10px; overflow: hidden; }
body.is-homepage .panorama-card strong { padding: 0 10px; display: block; margin-top: 8px; }
body.is-homepage .panorama-card span { padding: 0 10px 10px; display: block; color: var(--color-text-muted); }
body.is-homepage .panorama-card:hover, body.is-homepage .panorama-card:focus-visible { box-shadow: 0 10px 24px rgba(0,0,0,0.45); }

.site-header { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; background: var(--color-navy); border-bottom: 1px solid var(--color-navy-light); }
.site-header .logo { font-weight: bold; font-size: 1.4rem; text-decoration: none; display: inline-flex; align-items: center; }
.site-header .logo .logo-img { width: auto; display: block; }
.site-header .logo .logo-img.logo-size-pequeno { max-height: 40px; }
.site-header .logo .logo-img.logo-size-mediano { max-height: 64px; }
.site-header .logo .logo-img.logo-size-grande { max-height: 96px; }
.site-header .logo .logo-vive { color: var(--color-text-light); font-weight: 400; font-style: italic; }
.site-header .logo .logo-curico {
  font-weight: 800;
  background: linear-gradient(90deg, var(--color-orange), var(--color-red) 55%, var(--color-green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.site-header nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; color: var(--color-text-muted); font-weight: 500; }
.site-header nav a:hover { color: var(--color-text-light); }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }

/* 3:4, la misma proporción a la que se recortan las publicaciones/eventos en las tarjetas.
   max-width evita que un banner de un solo aviso, a lo ancho de toda la página, termine
   siendo una imagen gigante y desproporcionada (3:4 es vertical, no un formato panorámico). */
.banner { width: 100%; max-width: 360px; aspect-ratio: 3 / 4; object-fit: cover; display: block; border-radius: 8px; margin-bottom: 16px; margin-left: auto; margin-right: auto; }

.slide { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 20px; }
.slide-item { flex: 0 0 240px; position: relative; border-radius: 8px; overflow: hidden; text-decoration: none; color: #fff; }
.slide-item img, .slide-item video { width: 100%; height: 160px; object-fit: cover; display: block; background: #000; }
.slide-item span { position: absolute; bottom: 0; left: 0; right: 0; padding: 8px; background: rgba(13,27,58,0.75); font-size: 0.9rem; }

.categories { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.categories a { padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--color-green); color: var(--color-green-dark); text-decoration: none; font-weight: 500; }
.categories a:hover { background: var(--color-green); color: #fff; }

.grid, .upcoming { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.panorama-card {
  text-decoration: none; color: inherit; background: #fff; border-radius: 8px; overflow: hidden; border: 1px solid #eee;
  position: relative; transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.panorama-card:hover, .panorama-card:focus-visible {
  transform: scale(1.05);
  box-shadow: 0 10px 24px rgba(0,0,0,0.18);
  z-index: 2;
}
.panorama-card img, .panorama-card video { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; display: block; background: #000; }
.panorama-card strong, .panorama-card span { display: block; padding: 6px 8px 0; }
.panorama-card span { padding-bottom: 8px; font-size: 0.85rem; color: #666; }

.panorama-detail img, .panorama-detail video { width: 100%; max-height: 360px; object-fit: cover; border-radius: 8px; background: #000; }
.panorama-detail .details { list-style: none; padding: 0; }
.ticket-types { list-style: none; padding: 0; max-width: 420px; }
.ticket-types li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid #eee; }
.panorama-detail .details li { padding: 4px 0; }
.btn-tickets { display: inline-block; margin-top: 12px; padding: 10px 20px; background: var(--color-green); color: #fff; text-decoration: none; border-radius: 6px; font-weight: 600; }
.btn-tickets:hover { background: var(--color-green-dark); }

.error { color: var(--color-red); }
.success { color: var(--color-green-dark); }
.hint { font-size: 0.85rem; color: #777; margin-top: -6px; margin-bottom: 12px; }

/* Editor de texto enriquecido (/admin/portada/bloques) */
.rte-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.rte-toolbar button { padding: 6px 10px; font-size: 0.85rem; }
.rte-editor { min-height: 200px; border: 1px solid #ccc; border-radius: 6px; padding: 12px; margin-bottom: 16px; background: #fff; }
.rte-editor img { max-width: 100%; border-radius: 6px; }
.rte-editor:focus { outline: 2px solid var(--color-green); outline-offset: 2px; }

/* Bloques libres de la portada (/admin/portada/bloques) */
.homepage-block-text { margin-bottom: 28px; }
.homepage-block-text img { max-width: 100%; border-radius: 8px; }
.homepage-block-text p:first-child { margin-top: 0; }
.homepage-section { margin-bottom: 28px; padding-top: 8px; border-top: 1px solid var(--color-border, #e5e5e5); }
.homepage-section-title { margin-bottom: 14px; }
.homepage-section .homepage-block-text,
.homepage-section .event-section { margin-bottom: 20px; }
.homepage-section .homepage-block-text:last-child,
.homepage-section .event-section:last-child { margin-bottom: 0; }

/* Grilla de tarjetas (bloque "card_grid" del admin: /admin/portada/bloques) */
.card-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card-grid-item {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 18px;
}
.card-grid-item strong { display: block; font-size: 1.05rem; margin-bottom: 6px; }
.card-grid-item p { margin: 0; color: var(--color-text-muted); line-height: 1.5; }
.card-grid-item-standalone { margin-bottom: 20px; }
body:not(.is-homepage) .card-grid-item { background: #f5f6f8; border-color: #e5e5e5; }
body:not(.is-homepage) .card-grid-item p { color: #666; }

form label { display: block; margin-bottom: 10px; }
form input, form textarea, form select { width: 100%; padding: 8px; margin-top: 4px; border: 1px solid #ccc; border-radius: 4px; }
form input[type="color"] { width: 56px; height: 40px; padding: 3px; margin-top: 4px; cursor: pointer; flex-shrink: 0; }
form input[type="color"]:disabled { cursor: not-allowed; opacity: 0.5; }
/* Igual que type=color arriba: sin esto, checkbox/radio heredan width:100% de la
   regla genérica de formularios y se estiran para llenar todo el ancho disponible
   (muy notorio en un <label style="display:flex"> con poco texto al lado). */
form input[type="checkbox"], form input[type="radio"] { width: auto; height: auto; flex-shrink: 0; margin-top: 0; }
form button { padding: 10px 18px; border: none; border-radius: 4px; background: var(--color-green); color: #fff; cursor: pointer; font-weight: 600; }
form button:hover { background: var(--color-green-dark); }

/* ==========================================================================
   Panel de administración — sidebar de navegación + área de contenido con
   cards, forms y tablas con un look más profesional que el resto del sitio
   (que se mantiene ligero/plano a propósito).
   ========================================================================== */
body.admin { background: #f3f5fa; color: #1c2333; }
body.admin a { color: var(--color-green-dark); }
body.admin .admin-shell { display: flex; flex-direction: column; min-height: 100vh; }

body.admin .admin-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--color-navy);
  padding: 18px 14px;
}
body.admin .admin-nav-brand { padding: 2px 10px 16px; margin-bottom: 6px; border-bottom: 1px solid rgba(255,255,255,0.12); }
body.admin .admin-nav-brand-name { display: block; color: #fff; font-weight: 800; font-size: 1.1rem; }
body.admin .admin-nav-brand-sub { display: block; color: var(--color-text-muted); font-size: 0.78rem; margin-top: 2px; }
body.admin .admin-nav-group { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
body.admin .admin-nav-group-label {
  color: rgba(255,255,255,0.4);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px 2px;
}
body.admin .admin-nav-group a {
  color: var(--color-text-muted);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
body.admin .admin-nav-group a:hover { background: rgba(255,255,255,0.08); color: #fff; }
body.admin .admin-nav-group a.is-active { background: var(--color-green); color: #fff; }
body.admin .admin-nav-logout { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.12); }
body.admin .admin-nav-logout button {
  width: 100%;
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-radius: 8px;
}
body.admin .admin-nav-logout button:hover { background: var(--color-red); }

body.admin main { flex: 1; padding: 20px 16px 40px; max-width: none; margin: 0; }
body.admin h1 { font-size: 1.5rem; margin: 0 0 6px; color: var(--color-navy); }
body.admin .section-subtitle { margin-top: 0; }

body.admin fieldset { background: #fff; border: 1px solid #e3e6ee; border-radius: 12px; padding: 18px 20px; margin: 0 0 20px; }
body.admin legend { font-weight: 700; font-size: 0.95rem; color: var(--color-navy); padding: 0 6px; }
body.admin form label { font-size: 0.86rem; font-weight: 600; color: #3a4257; margin-bottom: 12px; }
body.admin form input, body.admin form select, body.admin form textarea {
  border: 1px solid #d7dbe6;
  border-radius: 8px;
  font-size: 0.95rem;
  background: #fff;
  color: #1c2333;
}
body.admin form input:focus, body.admin form select:focus, body.admin form textarea:focus {
  outline: none;
  border-color: var(--color-green);
  box-shadow: 0 0 0 3px rgba(76,175,80,0.15);
}
body.admin form button { border-radius: 8px; }
body.admin form button:not([type]), body.admin form button[type="submit"] { background: var(--color-green); }

body.admin table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(20,30,60,0.06); }
body.admin table thead th {
  text-align: left;
  background: #f7f8fc;
  padding: 10px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
  border-bottom: 1px solid #e9ebf2;
}
body.admin table td { padding: 12px 14px; border-bottom: 1px solid #eef0f6; }
body.admin table tr:last-child td { border-bottom: none; }

body.admin .pending-list { list-style: none; padding: 0; background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(20,30,60,0.06); overflow: hidden; }
body.admin .pending-list li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid #eef0f6; }
body.admin .pending-list li:last-child { border-bottom: none; }

body.admin .badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; color: #fff; }
body.admin .badge-ok { background: var(--color-green); }
body.admin .badge-error { background: var(--color-red); }

body.admin .success, body.admin .error {
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 500;
  margin-bottom: 16px;
}
body.admin .success { background: #e6f6ea; color: #1e7a34; }
body.admin .error { background: #fbe9e8; color: #b3261e; }

@media (min-width: 900px) {
  body.admin .admin-shell { flex-direction: row; align-items: flex-start; }
  body.admin .admin-nav { width: 240px; flex: 0 0 240px; min-height: 100vh; position: sticky; top: 0; }
  body.admin main { padding: 36px 44px; max-width: 1200px; margin: 0 auto; }
}

.category-layout { display: flex; flex-direction: column; gap: 20px; }
.sidebar-banners { display: flex; flex-direction: column; gap: 12px; }

.about-page img, .simple-page img { max-width: 100%; height: auto; border-radius: 8px; }

/* Footer: la ilustración de Curicó vive acá, bien visible ("le da vida" al sitio), y se
   funde hacia arriba con el color de fondo de la página (var(--color-navy)) mediante un
   degradado que empieza opaco en el mismo tono y se aclara hasta dejar ver la ilustración
   completa antes de llegar al contenido del footer. */
.site-footer {
  background:
    linear-gradient(180deg, var(--color-navy) 0%, rgba(13,27,58,0.75) 12%, rgba(13,27,58,0.25) 30%, rgba(13,27,58,0.55) 65%, rgba(13,27,58,0.85) 100%),
    url('/assets/img/footer-bg.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: var(--color-text-muted);
  margin-top: 0;
  padding: 60px 16px 16px;
}
.footer-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr; gap: 24px; }
.footer-col h3 { color: var(--color-text-light); font-size: 0.95rem; letter-spacing: 0.04em; text-transform: uppercase; margin: 0 0 10px; }
.footer-col p { margin: 0 0 12px; line-height: 1.5; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--color-text-muted); text-decoration: none; }
.footer-col a:hover { color: var(--color-orange); }
.social-icons { display: flex; gap: 8px; margin-bottom: 10px; }
.social-icons a { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 999px; background: var(--color-navy-light); color: var(--color-text-light); font-size: 0.7rem; font-weight: 700; text-decoration: none; }
.social-icons a:hover { background: var(--color-green); }
.footer-email { font-size: 0.9rem; margin-bottom: 12px; }

.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input { flex: 1; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--color-navy-light); background: var(--color-navy-light); color: var(--color-text-light); }
.newsletter-form input::placeholder { color: var(--color-text-muted); }
.newsletter-form button { border-radius: 999px; background: var(--color-green); padding: 8px 16px; }
.newsletter-form button:hover { background: var(--color-green-dark); }
.footer-col p.success, .footer-col p.error { font-size: 0.85rem; }
.footer-bottom { max-width: 1100px; margin: 24px auto 0; padding-top: 16px; border-top: 1px solid var(--color-navy-light); display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 0.85rem; }

/* Banner publicitario sobre el slide (posición "home_top" en /admin/banners) */
.hero-banner-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 12px; }
.hero-banner-strip .banner { margin-bottom: 0; }
.banners-between { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 24px; }
.banners-between .banner { margin-bottom: 0; }

/* Hero carousel: el "slide" de eventos que el admin selecciona y ordena desde /admin/slide.
   Estilo "peek carousel" a ancho completo (como vesti.cl): la sección rompe el ancho del
   <main> (padding + max-width) hasta ocupar el 100vw sobre fondo oscuro, y cada slide se ve
   parcialmente recortado por los costados salvo el activo (centrado, a tamaño completo). */
.hero-carousel-wrap {
  position: relative;
  left: 50%;
  right: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
  margin-bottom: 28px;
  padding: 28px 0 20px;
  background: transparent;
}
.hero-carousel { position: relative; }
.hero-carousel-track {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 12vw;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.hero-carousel-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative;
  flex: 0 0 76%;
  scroll-snap-align: center;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: #000;
  opacity: 0.5;
  transform: scale(0.92);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hero-slide.is-active { opacity: 1; transform: scale(1); }
/* object-fit: cover recorta automáticamente cualquier imagen subida para llenar el espacio sin
   deformarla, sin importar el tamaño o proporción original — no es obligatorio subir una medida
   exacta, pero 1080×1080px (formato cuadrado de Instagram) es la que mejor se ve, ver el hint
   en el formulario de "Nuevo panorama". */
.hero-slide img, .hero-slide video { width: 100%; height: 260px; object-fit: cover; object-position: center; display: block; }
.hero-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px; background: linear-gradient(to top, rgba(0,0,0,0.85), rgba(0,0,0,0.05)); color: #fff; }
.hero-caption strong { display: block; font-size: 1.1rem; }
.hero-caption span { font-size: 0.85rem; opacity: 0.9; }
.hero-nav { position: absolute; top: 50%; transform: translateY(-50%); border: none; width: 36px; height: 36px; border-radius: 999px; background: rgba(0,0,0,0.55); color: #fff; font-size: 1.3rem; cursor: pointer; z-index: 2; }
.hero-prev { left: 8px; }
.hero-next { right: 8px; }
.hero-nav:hover { background: var(--color-green); }
.hero-dots { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 18px; }
.hero-dot { width: 8px; height: 8px; padding: 0; border: none; border-radius: 999px; background: rgba(255,255,255,0.3); cursor: pointer; transition: width 0.25s ease, background 0.25s ease; }
.hero-dot.is-active { width: 24px; background: var(--color-green); }

/* Event sections (Destacados / Esta semana) */
.event-section { margin-bottom: 28px; }
.event-section h2 { margin-bottom: 2px; }
.section-subtitle { color: #777; margin-top: 0; margin-bottom: 14px; }

/* CTA band */
.cta-band { display: flex; flex-direction: column; gap: 16px; align-items: flex-start; background: var(--color-navy); color: var(--color-text-light); border-radius: 12px; padding: 24px; margin-bottom: 24px; }
.cta-band h2 { margin: 0 0 6px; }
.cta-band p { margin: 0; color: var(--color-text-muted); }
.cta-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-outline { background: transparent; border: 1px solid var(--color-text-light); }
.btn-outline:hover { background: var(--color-navy-light); }

@media (min-width: 768px) {
  .site-header { flex-direction: row; justify-content: space-between; align-items: center; }
  .category-layout { flex-direction: row; align-items: flex-start; }
  .category-layout .grid { flex: 1; }
  .sidebar-banners { flex: 0 0 240px; }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
  .hero-carousel-track { padding: 0 18vw; }
  .hero-slide { flex-basis: 60%; }
  .hero-slide img, .hero-slide video { height: 420px; }
  .cta-band { flex-direction: row; align-items: center; justify-content: space-between; }
  .card-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
