/* =========================
   RESET BÁSICO
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Arial", sans-serif;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #f8f8f8;
  color: #000;
}

main {
  flex: 1;
}

/* =========================
   HEADER
========================= */
header {
  background-color: #333;
  color: #fff;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  border-bottom: 2px solid #555;
}

header .logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

header .logo img {
  width: 35px;
  height: 35px;
}

header h1 {
  font-size: 1.2rem;
  color: #c4c4c4;
}

.navbar ul {
  list-style: none;
  display: flex;
  gap: 1rem;
  margin-left: 2rem;
}

.navbar a {
  color: #fff;
  text-decoration: none;
  font-weight: bold;
  transition: 0.3s;
}
.navbar a:hover {
  text-decoration: underline;
}

/* =========================
   MODAL
========================= */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}
.modal-content {
  background: #fff;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  max-width: 500px;
  width: 90%;
  text-align: center;
  animation: aparecer 0.25s ease;
}
.modal-content h2 {
  color: #003366;
  margin-bottom: 1rem;
  font-size: 1.4rem;
}
.modal-content p {
  color: #333;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}
.modal-content button {
  background: #003366;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.6rem 1.4rem;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s;
}
.modal-content button:hover {
  background: #0055aa;
}

.no-scroll {
  overflow: hidden;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* =========================
   FORMULARIO PUBLICAR
========================= */
.publicar {
  max-width: 700px;
  margin: 2rem auto;
  background: #fff;
  padding: 1.5rem 2rem 2rem;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.publicar .form-group {
  display: flex;
  flex-direction: column;
}

.publicar input[type="text"],
.publicar textarea,
.publicar select,
.publicar input[type="file"] {
  padding: 0.8rem 1rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: 0.2s;
  width: 100%;
}
.publicar input[type="text"]:focus,
.publicar textarea:focus,
.publicar select:focus {
  border-color: #003366;
  box-shadow: 0 0 6px rgba(0, 51, 102, 0.3);
}
.publicar textarea {
  min-height: 100px;
  resize: vertical;
}

/* Categoría + Imagen */
.archivo-categoria-box {
  background: #f9f9f9;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.archivo-categoria {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
}
.categoria-container,
.imagen-container {
  display: flex;
  flex-direction: column;
  min-width: 230px;
}
.categoria-container label,
.imagen-container label {
  font-size: 0.9rem;
  color: #333;
  margin-bottom: 0.3rem;
}
.categoria-container select,
.imagen-container input[type="file"] {
  padding: 0.6rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: #fff;
}

/* Botón Publicar */
.btn-publicar {
  align-self: flex-end;
  padding: 0.6rem 1.5rem;
  margin-top: 0.5rem;
  background: #003366;
  color: #fff;
  font-weight: bold;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: background-color 0.2s, transform 0.2s;
}
.btn-publicar:hover {
  background: #0055aa;
  transform: translateY(-2px);
}

/* =========================
   POSTS
========================= */
.posts-container {
  max-width: 900px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 0 1rem;
}
.post {
  display: flex;
  flex-direction: row;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  padding: 1rem 1.5rem;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
}
.post:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12);
}

/* Grid del contenido */
.post-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
  align-items: flex-start;
}
.post-body.has-image {
  grid-template-columns: 1fr 150px;
}

.post-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.post-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #555;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.post-content p {
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.post-buttons {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.ver-mas-btn {
  background: none;
  border: 0;
  color: #003366;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  transition: color 0.2s;
}
.ver-mas-btn:hover {
  color: #0055aa;
}

.btn-borrar {
  background: #c0392b;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-left: 0;
}
.btn-borrar:hover {
  background: #a93226;
}

/* Contenedor de imagen (grid item) */
.post-image-container {
  display: flex; /* <-- asegura que se vea y centre */
  justify-content: center;
  align-items: center;
  justify-self: end;
  align-self: start;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
  margin-left: 1rem;
}

.post-image-container img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

/* Filtro de categorías */
.filtro-categorias {
  width: fit-content;
  margin: 1rem 0 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: #fff;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  gap: 0.6rem;
}
.filtro-categorias label {
  font-size: 0.95rem;
  color: #333;
}
.filtro-categorias select {
  padding: 0.5rem 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 0.9rem;
  background: #f9f9f9;
  cursor: pointer;
  width: 180px;
}

/* Post detalle */
.post-detalle {
  max-width: 800px;
  margin: 2rem auto;
  background: #fff;
  border: 1px solid #ccc;
  border-radius: 10px;
  padding: 1.5rem 2rem;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.post-detalle img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 10px;
}
.post-detalle .post-header {
  font-size: 0.9rem;
  color: #444;
}
.post-detalle p {
  font-size: 1rem;
  line-height: 1.6;
}

.btn-volver {
  align-self: flex-start;
  background: #003366;
  color: #fff;
  padding: 0.6rem 1.3rem;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.2s;
}
.btn-volver:hover {
  background: #0055aa;
}

/* =========================
   INFORMACIÓN Y DONACIONES
========================= */
.italic {
  font-style: italic;
}
.info-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.info-container > h2 {
  width: 100%;
  text-align: center;
}

.info-section h2,
.donation-section h2 {
  color: #003366;
  margin-bottom: 1rem;
}
.info-box,
.donation-box {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.1);
}
.info-box h1 {
  margin-bottom: 0.8rem;
  text-align: center;
}
.info-box p {
  line-height: 1.6;
  text-align: center;
}

.info-box > h2 {
  width: 100%;
  text-align: center;
}

.donation-box iframe {
  max-width: 450px;
  min-width: 250px;
  width: 100%;
}

/* Botones de donación y utilidades */
.btn-donar {
  display: inline-block;
  margin: 0.4rem 0.4rem 0 0;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
}
.btn-donar:hover {
  background: #f6f6f6;
}
.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
}

.copy-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f8f8f8;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  width: 100%;
  max-width: 420px;
  overflow: auto;
}
.copy-line code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;
  font-size: 0.95rem;
  white-space: nowrap;
}

/* =========================
   FOOTER
========================= */
footer {
  text-align: center;
  padding: 1rem 1.5rem;
  font-size: 0.85rem;
  color: #777;
  border-top: 1px solid #ccc;
  background: #f0f0f0;
  margin-top: auto;
}
footer p {
  margin: 0;
  line-height: 1.5;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 900px) {
  .post-body,
  .post-body.has-image {
    grid-template-columns: 1fr;
  }
  .post-content {
    width: 100%;
  }
  .post-image-container {
    justify-self: start;
    width: 100%;
    height: auto;
    margin-top: 0.5rem;
  }
  .post-image-container img {
    width: 100%;
    height: auto;
    max-height: 300px;
  }
  .post-buttons {
    justify-content: flex-start;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .post-buttons .btn-borrar {
    margin-left: auto;
  }
}

@media (max-width: 600px) {
  .publicar {
    padding: 1rem;
    margin: 1rem;
  }
  .archivo-categoria {
    flex-direction: column;
    align-items: stretch;
    gap: 0.8rem;
  }
  .categoria-container,
  .imagen-container {
    width: 100%;
  }
  .imagen-container input[type="file"] {
    width: 100%;
  }
  .post-content p {
    word-break: break-word;
    white-space: pre-wrap;
  }
  .post-buttons .btn-borrar {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
  }
  .info-container {
    padding: 0.5rem;
    margin: 1rem auto;
  }
  .info-box,
  .donation-box {
    padding: 1rem;
  }
  .info-box h1 {
    font-size: 1.2rem;
  }
  .info-section h2,
  .donation-section h2 {
    font-size: 1.1rem;
  }
  footer {
    font-size: 0.8rem;
    padding: 0.8rem 1rem;
  }
}

/* =========================
   BOTÓN BONITO (Stripe)
========================= */
:root {
  --btn-start: #1b3a6b; /* azul oscuro */
  --btn-end: #0057ff; /* azul vivo */
  --btn-text: #ffffff;
  --btn-ring: #7aa2ff;
}

/* Tamaño seguro para el icono del botón */
.btn-icon,
.btn-donar img.btn-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  flex: 0 0 18px; /* en flex evita que crezca */
  display: block;
}

.btn-donar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  border: 0;
  border-radius: 14px;
  padding: 0.8rem 1.2rem;
  color: var(--btn-text);
  background: #111; /* fallback */
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.2s ease,
    background 0.2s ease;
  will-change: transform, box-shadow, filter;
}

.btn-primary {
  background: linear-gradient(135deg, var(--btn-start), var(--btn-end));
  box-shadow: 0 6px 16px rgba(0, 87, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.btn-primary:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 10px 24px rgba(0, 46, 139, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.btn-primary:active {
  transform: translateY(0);
  filter: brightness(0.98);
  box-shadow: 0 4px 10px rgba(0, 87, 255, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.btn-primary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--btn-ring), 0 8px 20px rgba(0, 48, 143, 0.32);
}

.btn-lg {
  font-size: 1rem;
  padding: 0.9rem 1.25rem;
}
.btn-full {
  width: 100%;
  max-width: 460px;
}
.btn-icon {
  display: block;
  flex: 0 0 auto;
}

/* Respeta preferencias de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
  .btn-donar,
  .btn-primary {
    transition: none;
  }
}

/* =========================
   PÁGINAS LEGALES
========================= */

.legal-container {
  max-width: 850px;
  margin: 2.5rem auto;
  padding: 0 1rem;
}

.legal-box {
  background: #ffffff;
  padding: 2rem 2.2rem;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.legal-box h1 {
  text-align: center;
  color: #003366;
  margin-bottom: 1rem;
}

.legal-box h2 {
  color: #003366;
  margin-top: 1.2rem;
  font-size: 1.1rem;
}

.info-section h2,
.donation-section h2 {
  text-align: center;   /* ← ESTA es la que lo centra */
}

.info-box h2 {
  text-align: center;
}


.legal-box p {
  line-height: 1.7;
  color: #333;
  font-size: 0.95rem;
}

.legal-box a {
  color: #003366;
  text-decoration: none;
  font-weight: bold;
}

.legal-box a:hover {
  text-decoration: underline;
}

/* Responsive legal */
@media (max-width: 600px) {
  .legal-box {
    padding: 1.2rem 1.3rem;
  }
  .legal-box h1 {
    font-size: 1.25rem;
  }
  .legal-box p {
    font-size: 0.9rem;
  }
}
