/* global.css — Estilos compartidos por todas las páginas */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f3f4f6;
  color: #111827;
  min-height: 100vh;
}

/* --- Cabecera y Banner --- */
.header-container {
  position: relative;
  width: 100%;
}

.banner {
  width: 100%;
  background-color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #e5e7eb;
  padding: 2% 3% 4.5vw;
}

.banner img {
  display: block;
  width: 45%;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

/* --- Logo circular superpuesto --- */
.logo-container {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 50%);
  z-index: 2;

  width: clamp(110px, 14vw, 160px);
  height: clamp(110px, 14vw, 160px);

  border-radius: 50%;
  overflow: hidden;
  border: 4px solid #ffffff;
  background-color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

  display: flex;
  justify-content: center;
  align-items: center;
}

.logo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
  padding: 8px;
}

/* --- Área de contenido principal --- */
.content {
  width: min(100% - 2rem, 900px);
  margin: clamp(70px, 10vw, 100px) auto 0;
  padding: 0 1rem 2rem;
  text-align: center;
}

.content h1 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  color: #111827;
}

.subtitle {
  margin-top: 0.5rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: #6b7280;
}

/* --- Grid de tarjetas --- */
.cards-section {
  width: min(100% - 2rem, 1100px);
  margin: 2rem auto 4rem;
  padding: 0 1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

/* --- Card box --- */
.card-box {
  position: relative;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;

  min-height: 220px;
  padding: 2rem;
  border-radius: 18px;

  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);

  transition:
    transform 0.35s ease,
    box-shadow 0.35s ease,
    border-color 0.35s ease,
    background-color 0.35s ease;

  cursor: pointer;
}

.card-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 4px;
  background: linear-gradient(90deg, #F2AF32, #a77417);
  transition: width 0.35s ease;
}

.card-box:hover::before {
  width: 100%;
}

.card-box:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.14);
  border-color: #d1d5db;
  background-color: #f9fafb;
}

.card-box h3 {
  margin: 0 0 0.75rem;
  font-size: 1.35rem;
  color: #111827;
}

.card-box p {
  margin: 0;
  font-size: 1rem;
  color: #6b7280;
  line-height: 1.6;
}

/* --- Divisor de sección con texto centrado --- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  width: min(100% - 2rem, 1100px);
  margin: 2.5rem auto 1.25rem;
  padding: 0 1rem;
}

.section-divider::before,
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #d1d5db;
}

.section-divider span {
  font-size: clamp(1.67rem, 3.9vw, 2.47rem); /* 2px menos que el h1 de la página */
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

/* --- Sección Eventos --- */
.eventos-section {
  width: min(100% - 2rem, 1100px);
  margin: 1.5rem auto 4rem;
  padding: 0 1rem;
}

.eventos-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.1rem;
}

.evento-card {
  min-height: 150px !important;
  padding: 1.25rem 1.4rem !important;
}

.evento-card h3.evento-titulo {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  color: #111827;
}

.evento-card p.evento-desc {
  margin: 0;
  font-size: 0.92rem;
  color: #6b7280;
  line-height: 1.55;
}

@media (max-width: 768px) {
  .eventos-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .eventos-grid {
    grid-template-columns: 1fr;
  }
  .evento-card {
    min-height: 120px !important;
  }
}

/* --- Barra superior del sitio público --- */
.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background: #4F3D3F;
  color: #f9fafb;
  padding: 0.5rem 1.5rem;
  font-size: 0.875rem;
  flex-wrap: wrap;
}

.public-topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.public-topbar-role {
  background: #F2AF32;
  color: #1f2937;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
}

.public-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.public-topbar-admin {
  background: #F2AF32;
  color: #1f2937;
  font-weight: 600;
  text-decoration: none;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: background 0.2s;
}

.public-topbar-admin:hover {
  background: #d4981d;
}

.public-topbar-logout {
  background: transparent;
  color: #d1d5db;
  border: 1px solid #4b5563;
  padding: 0.35rem 0.9rem;
  border-radius: 6px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  font-family: inherit;
}

.public-topbar-logout:hover {
  border-color: #9ca3af;
  color: #f9fafb;
}

/* Icono admin: oculto en escritorio (se muestra texto) */
.topbar-admin-icon { display: none; }

/* --- Back bar (bajo el banner, páginas interiores) --- */
.back-bar {
  width: min(100% - 2rem, 1100px);
  margin: clamp(60px, 8vw, 90px) auto 0;
  padding: 0 0.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.btn-back-header {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #6b7280;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  padding: 0.35rem 0.8rem;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #f9fafb;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.btn-back-header:hover {
  color: #111827;
  border-color: #9ca3af;
  background: #f3f4f6;
}

/* --- Botón de volver --- */
.btn-back {
  display: inline-block;
  padding: 12px 24px;
  background-color: #F2AF32;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: background-color 0.3s;
}

.btn-back:hover {
  background-color: #a77417;
}

/* --- Barra de búsqueda --- */
.search-wrapper {
  max-width: 700px;
  margin: 0 auto 20px auto;
  padding: 0 15px;
}

.search-input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

.search-input:focus {
  border-color: #F2AF32;
}

/* --- Topbar público: móvil --- */
@media (max-width: 640px) {
  .public-topbar {
    flex-wrap: nowrap;
    padding: 0.4rem 1rem;
    gap: 0.5rem;
  }

  /* Ocultar badge de rol — solo nombre + icono admin + cerrar sesión */
  .public-topbar-role {
    display: none;
  }

  /* Convertir el enlace de admin en un botón icono compacto */
  .public-topbar-admin {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .topbar-admin-label { display: none; }
  .topbar-admin-icon  { display: block; width: 16px; height: 16px; }

  .public-topbar-user {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }

  .public-topbar-logout {
    white-space: nowrap;
    font-size: 0.78rem;
    padding: 0.3rem 0.7rem;
    flex-shrink: 0;
  }

  .public-topbar-actions {
    flex-shrink: 0;
  }
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .banner {
    padding: 2% 3% 7vw;
  }

  .banner img {
    width: 70%;
  }

  .logo-container {
    width: 120px;
    height: 120px;
    border-width: 3px;
  }

  .logo {
    padding: 6px;
  }

  .content {
    margin-top: 65px;
    padding: 0 1rem 1.5rem;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

  .card-box {
    min-height: 180px;
    padding: 1.5rem;
  }
}

@media (max-width: 480px) {
  .content h1 {
    font-size: 1.7rem;
  }

  .subtitle {
    font-size: 0.95rem;
  }

  .card-box {
    border-radius: 14px;
    padding: 1.25rem;
  }

  .card-box h3 {
    font-size: 1.15rem;
  }

  .card-box p {
    font-size: 0.95rem;
  }
}
