:root {
  /* Paleta tomada del paisaje real: verdes del bosque, amarillo del campo florecido */
  --primary: #4a6741;
  --primary-light: #6b8e5e;
  --primary-dark: #344b2e;
  --secondary: #d4a373;
  --accent: #e9b80c;
  /* amarillo flor de campo */
  --bg-color: #fefae0;
  --text-color: #283618;
  --text-muted: #606c38;
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-border: rgba(255, 255, 255, 0.35);
  --shadow: 0 8px 32px 0 rgba(40, 54, 24, 0.15);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: 'Outfit', sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
  overflow-x: hidden;
}

/* Páginas interiores (publicar, renovar, login): navbar sólida fija */
body.pagina-interior {
  padding-top: 6rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body.pagina-interior main {
  flex: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ───── Navbar ───── */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1100;
  padding: 1.5rem 0;
  transition: var(--transition);
}

#navbar.scrolled {
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 0.8rem 0;
  box-shadow: var(--shadow);
}

#navbar .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
}

#navbar.scrolled .logo {
  color: var(--primary);
  text-shadow: none;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
}

.nav-links a {
  text-decoration: none;
  color: white;
  font-weight: 600;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
  transition: var(--transition);
}

#navbar.scrolled .nav-links a {
  color: var(--text-color);
  text-shadow: none;
}

.nav-links a:hover {
  color: var(--accent);
}

#navbar.scrolled .nav-links a:hover {
  color: var(--primary);
}

#nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.8rem;
  color: white;
  cursor: pointer;
  line-height: 1;
}

#navbar.scrolled #nav-toggle {
  color: var(--primary);
}

/* ───── Hero ───── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(40, 54, 24, 0.45) 0%, rgba(40, 54, 24, 0.25) 55%, rgba(40, 54, 24, 0.55) 100%),
    url("/images/hero-campo.jpg");
  background-size: cover;
  background-position: center 65%;
  color: white;
  text-align: center;
}

.hero-kicker {
  display: inline-block;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  font-weight: 800;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.hero p {
  font-size: 1.3rem;
  max-width: 620px;
  margin: 0 auto 2.5rem;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
}

.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ───── Botones ───── */
.btn {
  display: inline-block;
  padding: 0.8rem 2rem;
  border-radius: 50px;
  text-decoration: none;
  font-weight: 600;
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(4px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.btn-block {
  width: 100%;
}

/* ───── Secciones ───── */
section {
  padding: 6rem 0;
}

h2 {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 2rem;
  text-align: center;
}

h2.text-left {
  text-align: left;
}

.section-intro {
  text-align: center;
  color: var(--text-muted);
  max-width: 640px;
  margin: -1rem auto 3rem;
}

.section-intro a {
  color: var(--primary);
  font-weight: 600;
}

.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.glass-card:hover {
  transform: translateY(-5px);
}

.glass-card.narrow {
  max-width: 760px;
  margin: 0 auto;
}

/* Historia: fondo con la foto de neblina del territorio */
.historia-section {
  background:
    linear-gradient(rgba(254, 250, 224, 0.55), rgba(254, 250, 224, 0.55)),
    url("/images/historia-neblina.jpg");
  background-size: cover;
  background-position: center;
}

/* Escuela */
.sustainable-section {
  background: linear-gradient(180deg, var(--bg-color), #f3efd3);
}

.escuela-foto {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.escuela-foto img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 280px;
  object-fit: cover;
}

/* ───── Grid ───── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

/* ───── Emprendimientos / Novedades ───── */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin-bottom: 0;
  text-align: left;
}

.view-toggle {
  display: flex;
  background: rgba(0, 0, 0, 0.05);
  padding: 0.3rem;
  border-radius: 50px;
}

.view-toggle .btn {
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  background: transparent;
  color: var(--text-color);
}

.view-toggle .btn.btn-primary {
  background: var(--primary);
  color: white;
}

.card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.card-img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  display: block;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.6rem;
}

.card-body h3 {
  color: var(--primary-dark);
  font-size: 1.2rem;
}

.card-body p {
  color: var(--text-muted);
  font-size: 0.95rem;
  flex: 1;
}

.card-link {
  align-self: flex-start;
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

.card-link:hover {
  text-decoration: underline;
}

/* Botones de redes sociales / contacto en tarjetas y publicación */
.redes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-red {
  display: inline-block;
  color: white;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 50px;
  transition: var(--transition);
}

.btn-red:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  filter: brightness(1.08);
}

.red-whatsapp { background: #25d366; }
.red-instagram { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }
.red-facebook { background: #1877f2; }
.red-tiktok { background: #010101; }

/* Compatibilidad: el botón antiguo .btn-whatsapp mantiene su estilo */
.btn-whatsapp {
  align-self: flex-start;
  display: inline-block;
  background: #25d366;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  padding: 0.45rem 1.2rem;
  border-radius: 50px;
  transition: var(--transition);
}

.card-titulo {
  color: var(--primary-dark);
  text-decoration: none;
}

.card-titulo:hover {
  text-decoration: underline;
}

/* ───── Página de publicación (/p/:slug) ───── */
.post-completo {
  padding: 0;
  overflow: hidden;
}

.post-completo:hover {
  transform: none;
}

.post-foto {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  display: block;
}

.post-cuerpo {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-cuerpo h1 {
  color: var(--primary-dark);
  font-size: 2rem;
  line-height: 1.2;
}

.post-cuerpo p {
  color: var(--text-color);
}

.post-cuerpo #mapa-punto {
  margin-top: 0.5rem;
}

.aviso-vencida {
  background: rgba(233, 184, 12, 0.18);
  border: 1px solid rgba(233, 184, 12, 0.5);
  color: #6d5600;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.9rem 1.4rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

.aviso-vencida a {
  color: var(--primary);
}

.volver-portada {
  margin-top: 1.5rem;
  text-align: center;
}

/* ───── Página imprimible del QR ───── */
.impresion-body {
  background: #f3efd3;
  font-family: 'Outfit', sans-serif;
  color: var(--text-color);
  margin: 0;
  padding: 2rem 1rem;
}

.qr-acciones {
  display: flex;
  gap: 0.8rem;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.qr-tarjeta {
  max-width: 420px;
  margin: 0 auto;
  background: white;
  border-radius: 24px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid var(--primary);
}

.qr-marca {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--primary);
  font-size: 1.1rem;
}

.qr-titulo {
  color: var(--primary-dark);
  font-size: 1.5rem;
  margin: 0.6rem 0 0.2rem;
  line-height: 1.2;
}

.qr-bajada {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

.qr-codigo {
  width: 260px;
  height: 260px;
  margin: 0 auto;
}

.qr-codigo svg {
  width: 100%;
  height: 100%;
  display: block;
}

.qr-url {
  margin-top: 1rem;
  font-weight: 700;
  color: var(--primary);
  word-break: break-all;
}

.qr-pie {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@media print {
  .no-print { display: none !important; }
  .impresion-body { background: white; padding: 0; }
  .qr-tarjeta { box-shadow: none; border: none; }
}

.tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tag {
  font-size: 0.8rem;
  background: rgba(74, 103, 65, 0.12);
  color: var(--primary-dark);
  padding: 0.2rem 0.7rem;
  border-radius: 50px;
  font-weight: 600;
}

.tag-accent {
  background: rgba(233, 184, 12, 0.2);
  color: #8a6d00;
}

.loading,
.error {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 2rem;
}

/* ───── Mapa ───── */
#map {
  height: 520px;
  width: 100%;
  margin: 2rem 0;
  border-radius: 20px;
  box-shadow: var(--shadow);
  z-index: 1;
}

.hidden {
  display: none;
}

/* ───── Contacto ───── */
.contacto-section {
  background:
    linear-gradient(rgba(40, 54, 24, 0.55), rgba(40, 54, 24, 0.65)),
    url("/images/atardecer.jpg");
  background-size: cover;
  background-position: center;
}

.contacto-section h2 {
  color: white;
}

.contact-form {
  max-width: 560px;
  margin: 0 auto;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 1px solid rgba(40, 54, 24, 0.2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.9);
  transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(74, 103, 65, 0.15);
}

/* Honeypot: fuera de pantalla, no display:none (algunos bots lo detectan) */
.hp-field {
  position: absolute;
  left: -9999px;
  top: -9999px;
}

/* ───── Flash y errores ───── */
.flash {
  position: fixed;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1200;
  max-width: min(560px, calc(100vw - 2rem));
  padding: 0.9rem 1.6rem;
  border-radius: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
  background: white;
}

.flash.ok {
  color: var(--primary-dark);
  border: 1px solid var(--primary-light);
}

.flash.fail {
  color: #b3261e;
  border: 1px solid #e3a8a2;
}

.error-campo {
  color: #b3261e;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

.errores {
  margin-bottom: 1.2rem;
}

.campo-codigo {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

.campo-red {
  margin-bottom: 0.6rem;
}

/* ───── Publicar / Renovar ───── */
.publicar-wrap {
  max-width: 760px;
  margin: 0 auto 4rem;
}

#mapa-punto {
  height: 320px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
  z-index: 1;
}

.ayuda {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.ayuda a {
  color: var(--primary);
  font-weight: 600;
}

.quitar-punto {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  margin-top: 0.4rem;
  display: none;
}

.quitar-punto.visible {
  display: inline-block;
}

.mias {
  margin-top: 3rem;
  padding: 0;
}

.mias h2 {
  font-size: 1.6rem;
  text-align: left;
}

.btn-borrar {
  background: #fbe9e7;
  color: #b3261e;
  border: none;
  border-radius: 50px;
  padding: 0.4rem 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-borrar:hover {
  background: #f5cdc7;
}

/* ───── Login ───── */
.login-wrap {
  max-width: 420px;
  margin: 4rem auto;
}

/* ───── Admin ───── */
.admin-body {
  background: var(--bg-color);
  font-family: 'Outfit', sans-serif;
  color: var(--text-color);
  line-height: 1.6;
}

.admin-nav {
  background: var(--primary-dark);
  padding: 0.8rem 0;
}

.admin-nav .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.admin-logo {
  color: white;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.admin-links {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.admin-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  font-weight: 600;
}

.admin-links a:hover {
  color: var(--accent);
}

.btn-salir {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50px;
  padding: 0.3rem 1rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
}

.admin-main {
  padding: 2.5rem 2rem 4rem;
}

.admin-main h1 {
  color: var(--primary);
  margin-bottom: 1.5rem;
}

.admin-card {
  margin-bottom: 2rem;
}

.admin-card:hover {
  transform: none;
}

.admin-h2 {
  font-size: 1.3rem;
  text-align: left;
  margin-bottom: 1rem;
}

.admin-form-inline {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.admin-form-inline input[type="number"] {
  width: 90px;
}

.admin-form-inline input {
  padding: 0.6rem 1rem;
  border: 1px solid rgba(40, 54, 24, 0.2);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
}

.admin-tabla {
  width: 100%;
  border-collapse: collapse;
}

.admin-tabla th,
.admin-tabla td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid rgba(40, 54, 24, 0.1);
  vertical-align: middle;
}

.admin-tabla th {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.fila-vencida {
  opacity: 0.55;
}

.codigo-valor {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 1px;
  background: rgba(74, 103, 65, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
}

.btn-primario-chico {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 0.4rem 1rem;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-primario-chico:hover {
  background: var(--primary-light);
}

.mensaje-row {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(40, 54, 24, 0.1);
}

.mensaje-row:last-child {
  border-bottom: none;
}

.mensaje-leido {
  opacity: 0.6;
}

.mensaje-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mensaje-meta a {
  color: var(--primary);
}

.mensaje-acciones {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

/* ───── Footer ───── */
footer {
  background: var(--primary-dark);
  color: rgba(255, 255, 255, 0.9);
  padding: 3rem 0;
}

.footer-inner {
  text-align: center;
}

.footer-logo {
  color: white;
  margin-bottom: 1rem;
}

.footer-small {
  font-size: 0.85rem;
  margin-top: 1rem;
  color: rgba(255, 255, 255, 0.7);
}

footer a {
  color: var(--accent);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* ───── Responsive ───── */
@media (max-width: 768px) {
  #nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    flex-direction: column;
    gap: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    color: var(--text-color);
    text-shadow: none;
    padding: 1rem 2rem;
    border-bottom: 1px solid rgba(40, 54, 24, 0.08);
  }

  section {
    padding: 4rem 0;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #map {
    height: 380px;
  }

  .mensaje-row {
    flex-direction: column;
  }

  .mensaje-acciones {
    flex-direction: row;
    align-items: center;
  }
}
