/* =========================================================
   concurso-votar.css
   /actividades/concurso-votar.php
   - 2 modos: grid | gallery (body[data-view="grid|gallery"])
   - Lightbox pro (modal con overlay y navegación)
   Requiere tokens: --brand, --brand-dark, --hdr-h, --text-dark
   ========================================================= */

:root{
  --cv-text: var(--text-dark, #1f1f24);
  --cv-muted: rgba(0,0,0,.70);
  --cv-border: rgba(0,0,0,.10);
  --cv-soft: rgba(75,42,136,.06);
  --cv-shadow: 0 14px 36px rgba(0,0,0,.10);
  --cv-shadow-2: 0 22px 70px rgba(0,0,0,.45);
  --cv-focus: 0 0 0 4px rgba(75,42,136,.12);
}

.page-concurso,
.page-concurso *{ box-sizing: border-box; }

body.page-concurso{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--cv-text);
  background: #fff;
}

/* Main container */
.pagina-interna.concurso-page{
  width: min(1180px, 92vw);
  margin: 0 auto;
  padding: calc(var(--hdr-h, 0px) + 18px) 0 56px;
}

/* Título sección (mismo lenguaje visual) */
.titulo-seccion{ margin: 0 0 18px; }
.titulo-seccion h1{
  margin: 0;
  font-size: clamp(1.8rem, 2.7vw, 2.6rem);
  line-height: 1.08;
  font-weight: 950;
  letter-spacing: -0.03em;
  color: rgba(0,0,0,.88);
  position: relative;
  padding-left: 14px;
}
.titulo-seccion h1::before{
  content:"";
  position:absolute;
  left:0;
  top:.12em;
  width: 4px;
  height: .95em;
  background: var(--brand, #4B2A88);
}

/* Flash (igual que la otra página) */
.concurso-flash{
  border: 1px solid rgba(0,0,0,.08);
  background: rgba(0,0,0,.02);
  padding: 12px 14px 12px 16px;
  margin: 0 0 12px;
  font-weight: 850;
  color: rgba(0,0,0,.84);
  position: relative;
  overflow: hidden;
  
}
.concurso-flash::before{
  content:"";
  position:absolute;
  left:0; top:0; bottom:0;
  width: 4px;
  background: var(--brand, #4B2A88);
}
.concurso-flash.ok::before{ background: #2e8b57; }
.concurso-flash.err::before{ background: #b00020; }

/* Card base */
.concurso-card{
  background: #fff;
  border: 1px solid var(--cv-border);
  box-shadow: var(--cv-shadow);
  padding: 18px;
  
  margin: 0 0 18px;
}

/* Cabecera card */
.concurso-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.concurso-card h2{
  margin: 0;
  font-size: 1.42rem;
  font-weight: 950;
  letter-spacing: -0.02em;
  color: rgba(0,0,0,.86);
  position: relative;
  padding-left: 14px;
}
.concurso-card h2::before{
  content:"";
  position:absolute;
  left:0;
  top:.18em;
  width: 4px;
  height: .95em;
  background: var(--brand, #4B2A88);
}

/* Badge activo */
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .82rem;
  font-weight: 950;
  letter-spacing: .10em;
  border: 1px solid rgba(75,42,136,.30);
  background: var(--brand, #4B2A88);
  color: #fff;
  user-select:none;
  white-space: nowrap;
  box-shadow: 0 14px 30px rgba(75,42,136,.20);
}

/* Hint */
.hint{
  margin: 8px 0 12px;
  color: var(--cv-muted);
  line-height: 1.6;
  max-width: 75ch;
}

/* =========================================================
   TOOLBAR (modo grid/galería + búsqueda opcional)
   ========================================================= */

.votar-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin: 12px 0 14px;
  flex-wrap: wrap;
}

.view-toggle{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-sec{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 9px 12px;
  
  font-weight: 950;
  border: 1px solid rgba(75,42,136,.20);
  background: rgba(75,42,136,.06);
  color: var(--brand, #4B2A88);
  cursor:pointer;
  text-decoration:none;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}
.btn-sec:hover{
  background: var(--brand, #4B2A88);
  color:#fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(0,0,0,.14);
}
.btn-sec:active{ transform: translateY(0); box-shadow:none; }
.btn-sec.is-active{
  background: var(--brand, #4B2A88);
  color:#fff;
  border-color: var(--brand, #4B2A88);
}

.searchbox{
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(0,0,0,.02);
}
.searchbox input{
  border: 0;
  outline: none;
  background: transparent;
  min-width: 220px;
  font-weight: 800;
  color: rgba(0,0,0,.80);
}
.searchbox input::placeholder{ color: rgba(0,0,0,.45); }

/* =========================================================
   GRID entries (default)
   ========================================================= */

.concurso-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

/* Tarjeta foto */
.concurso-entry{
  border: 1px solid rgba(0,0,0,.10);
  overflow:hidden;
  background: #fff;
  box-shadow: 0 10px 22px rgba(0,0,0,.08);
  display:flex;
  flex-direction: column;
  min-height: 100%;
}

.concurso-entry a{
  display:block;
  position: relative;
}

.concurso-entry img{
  width: 100%;
  height: 240px;
  object-fit: cover;
  display:block;
  transform: scale(1.01);
  transition: transform .18s ease, filter .18s ease;
}

.concurso-entry:hover img{
  transform: scale(1.04);
  filter: saturate(1.03) contrast(1.02);
}

/* Meta */
.concurso-entry-meta{
  padding: 12px 14px 14px;
  display:grid;
  gap: 8px;
}

.concurso-entry-meta .t{
  font-weight: 950;
  color: rgba(0,0,0,.86);
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.concurso-entry-meta .m{
  font-weight: 900;
  color: var(--brand, #4B2A88);
}

.votes{
  color: rgba(0,0,0,.70);
  font-weight: 850;
}

/* Botón votar/anular */
.concurso-entry-meta form{ margin: 0; }
.concurso-entry-meta button.btn-sec{
  width: 100%;
  
  padding: 11px 12px;
}

/* Estado “ya votado” (si lo marcas con data- attr o clase) */
.concurso-entry.is-voted{
  border-color: rgba(75,42,136,.25);
  box-shadow: 0 12px 28px rgba(75,42,136,.12);
}
.concurso-entry.is-voted .btn-sec{
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.12);
  color: rgba(0,0,0,.78);
}
.concurso-entry.is-voted .btn-sec:hover{
  background: rgba(75,42,136,.10);
  color: var(--brand, #4B2A88);
}

/* Disabled */
.btn-sec[disabled]{
  opacity: .55;
  cursor:not-allowed;
  transform:none !important;
  box-shadow:none !important;
}

/* =========================================================
   MODO GALERÍA GRANDE
   - activa con body[data-view="gallery"]
   ========================================================= */

body[data-view="gallery"] .concurso-grid{
  grid-template-columns: 1fr;
}

body[data-view="gallery"] .concurso-entry{
  display:grid;
  grid-template-columns: minmax(280px, 1.2fr) 1fr;
  gap: 0;
  align-items: stretch;
}

body[data-view="gallery"] .concurso-entry a{
  height: 100%;
}

body[data-view="gallery"] .concurso-entry img{
  height: 360px;
}

body[data-view="gallery"] .concurso-entry-meta{
  padding: 18px;
  align-content: start;
  gap: 10px;
  background: linear-gradient(180deg, rgba(75,42,136,.035), rgba(0,0,0,.00));
}

/* En galería, título más grande */
body[data-view="gallery"] .concurso-entry-meta .t{
  font-size: 1.25rem;
}

/* Responsive galería */
@media (max-width: 900px){
  body[data-view="gallery"] .concurso-entry{
    grid-template-columns: 1fr;
  }
  body[data-view="gallery"] .concurso-entry img{
    height: 300px;
  }
}

/* =========================================================
   LIGHTBOX (click en foto → modal navegable)
   ========================================================= */

.lightbox{ display:none; }
.lightbox.is-open{ display:block; }

.lightbox__backdrop{
  position: fixed;
  inset: 0;
  background: rgba(10,10,14,.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9998;
}

.lightbox__panel{
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.98);
  width: min(1200px, 94vw);
  max-height: 92vh;
  z-index: 9999;

  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: var(--cv-shadow-2);
  overflow:hidden;

  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
  
}
.lightbox.is-open .lightbox__panel{
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.lightbox__body{
  position: relative;
  padding: 12px 14px 14px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.lightbox__frame{
  width: 100%;
  max-width: 1040px;
  max-height: 74vh;
  background: #0e0e12;
  overflow:hidden;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  display:flex;
  align-items:center;
  justify-content:center;
  position: relative;
}

.lightbox__img{
  width: 100%;
  height: 74vh;
  max-height: 74vh;
  object-fit: contain;
  display:block;
}

/* Overlay inferior (título + autor + contador) */
.lightbox__top{
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;

  padding: 18px 18px 14px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;

  background: linear-gradient(
    0deg,
    rgba(0,0,0,.80),
    rgba(95,37,149,.78) 65%,
    rgba(0,0,0,0)
  );
  color: #fff;
  pointer-events: none;
}
.lightbox__top-left{ pointer-events: auto; }

.lightbox__title{
  color: #fff;
  font-weight: 950;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  text-shadow: 0 2px 14px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.lightbox__meta{
  color: rgba(255,255,255,.90);
  font-weight: 850;
  font-size: .98rem;
  text-shadow: 0 2px 14px rgba(0,0,0,.45);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}

.lightbox__count{
  justify-self: end;
  align-self: start;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,.38);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.92);
  font-weight: 900;
  font-size: .92rem;
  text-shadow: 0 2px 12px rgba(0,0,0,.45);
  pointer-events: auto;
}

/* Close */
.lightbox__close{
  position:absolute;
  top: 12px;
  right: 12px;
  z-index: 7;
  width: 42px;
  height: 42px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.20);
  background: rgba(0,0,0,.40);
  color: #fff;
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
  font-size: 18px;
  font-weight: 950;
  cursor:pointer;
}
.lightbox__close:hover{ background: rgba(0,0,0,.58); }

/* Flechas */
.lightbox__nav{
  position:absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 0;
  cursor:pointer;

  color:#fff;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 32px;
  font-weight: 950;

  box-shadow: 0 14px 30px rgba(0,0,0,.25);
  transition: transform .12s ease, background .12s ease;
  z-index: 7;
}
.lightbox__nav:hover{ background: rgba(0,0,0,.55); }
.lightbox__nav:active{ transform: translateY(-50%) scale(.98); }
.lightbox__nav.prev{ left: 18px; }
.lightbox__nav.next{ right: 18px; }

@media (max-width: 720px){
  .concurso-card{ padding: 16px; }
  .concurso-entry img{ height: 220px; }

  .lightbox__panel{ width: 96vw; }
  .lightbox__nav.prev{ left: 10px; }
  .lightbox__nav.next{ right: 10px; }

  .lightbox__top{ padding: 14px 14px 12px; }
  .lightbox__title{ font-size: 1.02rem; }
  .lightbox__meta{ font-size: .92rem; }
}

/* Acciones inferiores */
.actions{ margin-top: 10px; }

/* Focus */
.page-concurso a:focus,
.page-concurso button:focus{
  outline: none;
  box-shadow: var(--cv-focus);
  
}
