:root {
  --color-primary: #ec5f8c;
  --color-primary-dark: #d1437a;
  --color-accent: #6c63d1;
  --color-bg: #fff8f5;
  --color-surface: #ffffff;
  --color-text: #33262b;
  --color-muted: #7a6b70;
  --color-border: #f0dfe3;
  --radius: 14px;
  --shadow: 0 4px 16px rgba(51, 38, 43, 0.08);
  --max-width: 1080px;
  --font-heading: "Baloo 2", "Segoe UI", Roboto, sans-serif;
  --font-body: "Nunito", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --color-hero-dark: #2b2026;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-primary-dark);
}

h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 0.5em;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* Header / Nav */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--max-width);
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
  color: var(--color-text);
}

.brand-emoji {
  font-size: 1.4rem;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--color-text);
}

.nav-links {
  display: flex;
  gap: 22px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
}

.nav-links a.active,
.nav-links a:hover {
  color: var(--color-primary-dark);
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    flex-direction: column;
    padding: 12px 20px 20px;
    display: none;
    border-bottom: 1px solid var(--color-border);
  }
  .nav-links.open {
    display: flex;
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  font-family: var(--font-heading);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  font-size: 0.95rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary-dark);
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.85);
  color: #fff;
  backdrop-filter: blur(2px);
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.22);
}

.btn-secondary {
  background: var(--color-accent);
  color: #fff;
}

/* Hero: foto de portada con overlay y texto encima.
   La franja de foto (.hero-bg) tiene alto fijo, recortado de forma
   segura para no mostrar el flyer original de donde sale la imagen.
   El contenido de texto fluye libre debajo/encima, así que si necesita
   más alto (por ejemplo en mobile con varios botones) nunca "estira"
   ni cambia el recorte de la foto. */
.hero {
  position: relative;
  padding: 120px 0 56px;
  background: var(--color-hero-dark);
  color: #fff;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1600px;
  height: 620px;
  background-image: linear-gradient(180deg, rgba(51, 38, 43, 0.35), var(--color-hero-dark)), url("../img/flopi-hero.jpg");
  background-size: cover;
  background-position: 50% 54%;
  background-repeat: no-repeat;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: left;
  max-width: 620px;
}

.hero h1 {
  color: #fff;
  font-size: clamp(1.9rem, 4.4vw, 2.8rem);
}

.hero p.lead {
  color: rgba(255, 255, 255, 0.92);
  margin: 0 0 28px;
  font-size: 1.08rem;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.2);
}

.hero-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-social {
  margin-top: 18px;
}

.hero-social a {
  color: rgba(255, 255, 255, 0.92);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2);
}

.hero-social a:hover {
  color: #fff;
  text-decoration: underline;
}

@media (max-width: 720px) {
  .hero {
    padding: 84px 0 40px;
  }

  .hero-bg {
    height: 300px;
    background-position: 50% 100%;
  }

  .hero-content {
    text-align: center;
    margin: 0 auto;
  }

  .hero-actions {
    justify-content: center;
  }
}

/* Sections */
.section {
  padding: 48px 0;
}

.section-title {
  text-align: center;
  margin-bottom: 32px;
}

.section-title h2 {
  font-size: 1.7rem;
}

.section-title p {
  color: var(--color-muted);
}

/* Cards grid */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

.card h3 {
  margin-top: 0;
}

/* Event card */
.event-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
}

.event-card:hover {
  border-color: var(--color-primary);
}

.event-date-badge {
  display: inline-block;
  font-weight: 700;
  color: var(--color-primary-dark);
  font-size: 0.85rem;
}

.category-tag {
  display: inline-block;
  background: #f3eefc;
  color: var(--color-accent);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  align-self: flex-start;
}

.empty-state {
  text-align: center;
  color: var(--color-muted);
  padding: 32px 16px;
  background: var(--color-surface);
  border-radius: var(--radius);
  border: 1px dashed var(--color-border);
}

/* Calendar */
.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-nav button {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 1rem;
}

.calendar-month-label {
  font-weight: 700;
  font-size: 1.15rem;
  min-width: 160px;
  text-align: center;
}

.calendar-filter select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.calendar-weekday {
  text-align: center;
  font-weight: 700;
  color: var(--color-muted);
  font-size: 0.8rem;
  padding-bottom: 6px;
  text-transform: uppercase;
}

.calendar-day {
  background: var(--color-surface);
  border-radius: 10px;
  min-height: 92px;
  padding: 6px;
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}

.calendar-day.is-outside {
  background: transparent;
  border-color: transparent;
}

.calendar-day.is-today {
  border-color: var(--color-primary);
}

.calendar-day-number {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-muted);
}

.calendar-day.is-today .calendar-day-number {
  color: var(--color-primary-dark);
}

.calendar-event-pill {
  background: var(--color-primary);
  color: #fff;
  border-radius: 6px;
  font-size: 0.7rem;
  padding: 2px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.calendar-event-pill:hover {
  background: var(--color-primary-dark);
}

.calendar-more {
  font-size: 0.7rem;
  color: var(--color-accent);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

@media (max-width: 640px) {
  .calendar-day {
    min-height: 70px;
  }
  .calendar-weekday {
    font-size: 0.65rem;
  }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(51, 38, 43, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--color-muted);
}

.modal-field {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.modal-field strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--color-muted);
  margin-bottom: 2px;
}

/* Forms */
.form {
  max-width: 560px;
  margin: 0 auto;
  background: var(--color-surface);
  padding: 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.form-row {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 560px) {
  .form-row-group {
    grid-template-columns: 1fr;
  }
}

label {
  font-weight: 600;
  font-size: 0.88rem;
}

input, textarea, select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  font-size: 0.95rem;
  font-family: inherit;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.form-help {
  font-size: 0.78rem;
  color: var(--color-muted);
}

.form-message {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.form-message.success {
  background: #e9f7ef;
  color: #1e7a44;
}

.form-message.error {
  background: #fbe9ec;
  color: #b3273f;
}

.form-message[hidden] {
  display: none;
}

/* Donations */
.donation-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.donation-details {
  font-family: monospace;
  background: var(--color-bg);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

/* Admin */
.admin-nav-bar {
  flex-wrap: wrap;
  gap: 20px;
  row-gap: 10px;
}

.admin-nav-links {
  flex-wrap: wrap;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.admin-user-email {
  font-size: 0.82rem;
  color: var(--color-muted);
}

.admin-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 10px;
}

.admin-tab {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-muted);
}

.admin-tab.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.admin-row {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.admin-row-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 220px;
  flex: 1;
}

.admin-row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-row-actions .btn {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.status-badge {
  display: inline-block;
  align-self: flex-start;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.status-pending {
  background: #fff4e0;
  color: #a56a00;
}

.status-approved {
  background: #e9f7ef;
  color: #1e7a44;
}

.status-rejected {
  background: #fbe9ec;
  color: #b3273f;
}

.historia-photo {
  display: block;
  width: 280px;
  aspect-ratio: 4 / 3;
  margin: 0 auto 24px;
  border-radius: 24px;
  object-fit: cover;
  object-position: 50% 100%;
  box-shadow: var(--shadow);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 60px;
  padding: 32px 0;
  color: var(--color-muted);
  font-size: 0.9rem;
  text-align: center;
}

.site-footer a {
  color: var(--color-muted);
}

.site-footer .footer-links {
  margin-top: 8px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Utility */
.text-center {
  text-align: center;
}

.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
