/* ===== RESET Y ESTILOS GENERALES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body {
  background: #f0f2f5;
  color: #1e2a3a;
  line-height: 1.6;
}

/* ===== HEADER Y MENÚ ===== */
header {
  background: linear-gradient(135deg, #0b2a4a, #1b4a7a);
  color: white;
  padding: 0.8rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
header h1 {
  font-size: 1.6rem;
  letter-spacing: 1px;
}
.menu-toggle {
  display: none;
  font-size: 1.8rem;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 0.2rem 0.5rem;
}
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
nav a {
  color: white;
  text-decoration: none;
  padding: 0.4rem 0.8rem;
  border-radius: 20px;
  transition: background 0.3s;
  font-weight: 500;
  font-size: 0.95rem;
  white-space: nowrap;
}
nav a:hover,
nav a.active {
  background: rgba(255, 255, 255, 0.2);
}
#adminLink {
  background: #ffb347;
  color: #1e2a3a;
}
#adminLink:hover {
  background: #ffa01c;
}
#logoutBtn {
  background: #c0392b;
}
#logoutBtn:hover {
  background: #a93226;
}
.hidden {
  display: none !important;
}

/* ===== CONTENEDOR PRINCIPAL ===== */
.container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ===== SECCIONES ===== */
.section {
  display: none;
  animation: fade 0.3s ease;
}
.section.active {
  display: block;
}
@keyframes fade {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-size: 2rem;
  border-bottom: 3px solid #1b4a7a;
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
  color: #0b2a4a;
}

/* ===== FEED ===== */
.feed { display: flex; flex-direction: column; gap: 1.8rem; margin-top: 0.5rem; }
.post {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}
.post:hover { transform: translateY(-3px); }
.post-header {
  padding: 1rem 1.2rem 0.3rem 1.2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.post-header h3 { font-size: 1.2rem; color: #0b2a4a; }
.post-header .type-badge {
  font-size: 0.75rem;
  background: #e0e7ef;
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  color: #1b4a7a;
  font-weight: 600;
}
.post-media {
  width: 100%;
  max-height: 500px;
  object-fit: contain;
  background: #fafafa;
  display: block;
}
.post-media iframe {
  width: 100%;
  height: 400px;
  border: 0;
}
.post-body {
  padding: 0.8rem 1.2rem 1.2rem 1.2rem;
}
.post-body p { color: #333; margin-bottom: 0.3rem; }
.post-body .date {
  font-size: 0.8rem;
  color: #888;
  margin-top: 0.4rem;
}

/* ===== GALERÍA ===== */
.post-gallery {
  display: grid;
  gap: 3px;
  background: #fafafa;
  cursor: pointer;
}
.post-gallery.count-1 { grid-template-columns: 1fr; }
.post-gallery.count-2 { grid-template-columns: 1fr 1fr; }
.post-gallery.count-3 { grid-template-columns: 2fr 1fr; }
.post-gallery.count-3 .g-item:first-child { grid-row: span 2; }
.post-gallery.count-4 { grid-template-columns: 1fr 1fr; }
.post-gallery.count-many { grid-template-columns: 1fr 1fr 1fr; }
.g-item {
  position: relative;
  overflow: hidden;
  max-height: 420px;
}
.post-gallery.count-1 .g-item { max-height: 500px; }
.g-item img {
  width: 100%;
  height: 100%;
  min-height: 140px;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}
.g-item:hover img { transform: scale(1.03); }
.g-item .more-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: 700;
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.lightbox.show { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 6px;
}
.lightbox-close {
  position: absolute;
  top: 1.2rem;
  right: 1.5rem;
  color: white;
  font-size: 2.2rem;
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
}
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.15);
  color: white;
  border: none;
  font-size: 2rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  border-radius: 50%;
}
.lightbox-nav:hover { background: rgba(255,255,255,0.3); }
.lightbox-prev { left: 1rem; }
.lightbox-next { right: 1rem; }
.lightbox-counter {
  position: absolute;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-size: 0.9rem;
  background: rgba(0,0,0,0.4);
  padding: 0.3rem 0.9rem;
  border-radius: 20px;
}

/* ===== PREVIEW IMÁGENES ===== */
.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}
.file-preview .fp-item {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ddd;
}
.file-preview .fp-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-preview .fp-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.file-hint {
  font-size: 0.8rem;
  color: #777;
  margin-top: 0.3rem;
}

/* ===== MAPA ===== */
.map-container {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.map-container iframe {
  width: 100%;
  height: 400px;
  border: 0;
}

/* ===== FORMULARIOS ===== */
form {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  max-width: 600px;
  margin: 0 auto;
}
.form-group { margin-bottom: 1.2rem; }
label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
input, textarea, select {
  width: 100%;
  padding: 0.8rem;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 1rem;
}
textarea { resize: vertical; min-height: 100px; }
button {
  background: #1b4a7a;
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: 30px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s;
}
button:hover { background: #0b2a4a; }
button:disabled { opacity: 0.6; cursor: not-allowed; }

/* ===== ADMIN ===== */
.admin-panel {
  background: #eef3f9;
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1.5rem;
}
.admin-panel h3 { margin-bottom: 1rem; color: #0b2a4a; }
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}
.login-box {
  max-width: 400px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  text-align: center;
}
.login-box input { margin-bottom: 1rem; }

/* ===== PROGRESS ===== */
.progress-bar {
  width: 100%;
  height: 8px;
  background: #ddd;
  border-radius: 4px;
  margin-top: 0.5rem;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: #27ae60;
  width: 0%;
  transition: width 0.3s;
}
.status-msg {
  font-size: 0.9rem;
  color: #555;
  margin-top: 0.3rem;
}

/* ===== REPORTES ===== */
.report-list {
  background: white;
  padding: 1rem;
  border-radius: 12px;
  margin-top: 1rem;
}
.report-item {
  border-bottom: 1px solid #eee;
  padding: 0.8rem 0;
}
.report-item:last-child { border: 0; }
.report-item strong { color: #0b2a4a; }

/* ===== GESTIÓN DE REPORTES ===== */
.gestion-panel {
  background: #eef3f9;
  padding: 1.5rem;
  border-radius: 12px;
  margin-top: 1.5rem;
}
.gestion-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 1rem;
}
.gestion-toolbar select { width: auto; }
.report-card {
  background: white;
  border-radius: 10px;
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  border-left: 5px solid #ccc;
}
.report-card.estado-pendiente { border-left-color: #e67e22; }
.report-card.estado-revisado { border-left-color: #2980b9; }
.report-card.estado-resuelto { border-left-color: #27ae60; }
.report-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.report-card-top .who { color: #0b2a4a; }
.estado-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  color: white;
  white-space: nowrap;
}
.estado-badge.estado-pendiente { background: #e67e22; }
.estado-badge.estado-revisado { background: #2980b9; }
.estado-badge.estado-resuelto { background: #27ae60; }
.report-card .mensaje { margin: 0.6rem 0; color: #333; }
.report-card .origen-admin {
  font-size: 0.75rem;
  color: #8a5a00;
  background: #fff3cd;
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
}
.report-card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.6rem;
}
.report-card-controls select {
  width: auto;
  padding: 0.4rem 0.6rem;
}
.report-card textarea.nota-admin {
  width: 100%;
  min-height: 60px;
  margin-top: 0.6rem;
  font-size: 0.9rem;
}
.btn-small {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.85rem;
}
.btn-danger { background: #c0392b; }
.btn-danger:hover { background: #a93226; }
.btn-secondary { background: #7f8c8d; }
.btn-secondary:hover { background: #626e6f; }
.add-report-box {
  background: white;
  border-radius: 10px;
  padding: 1.2rem;
  margin-top: 1rem;
  border: 1px dashed #aac;
}

/* ===== GESTIONAR CONTENIDO ===== */
.cm-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.cm-tab {
  background: #dce6f0;
  color: #0b2a4a;
  border: none;
  padding: 0.5rem 1.1rem;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
}
.cm-tab:hover { background: #c9d9e8; }
.cm-tab.active { background: #1b4a7a; color: white; }
.cm-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-height: 480px;
  overflow-y: auto;
}
.cm-item {
  background: white;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.cm-thumb {
  width: 50px;
  height: 50px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: #eee;
}
.cm-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.cm-info { flex: 1; min-width: 0; }
.cm-info strong {
  display: block;
  color: #0b2a4a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cm-badge {
  font-size: 0.7rem;
  background: #e0e7ef;
  color: #1b4a7a;
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  margin-left: 0.4rem;
}
.cm-item .btn-small { flex-shrink: 0; }
.empty-msg {
  color: #888;
  font-style: italic;
  padding: 1rem 0;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: #1b4a7a;
  color: white;
  padding: 1rem 2rem;
  border-radius: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.4s;
  z-index: 999;
  max-width: 90%;
}
.toast.show { opacity: 1; }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 2rem 0;
  color: #666;
  margin-top: 2rem;
  border-top: 1px solid #ddd;
}

/* ===== INTERACCIONES (Likes, Dislikes, Enterado) ===== */
.interacciones {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.8rem;
  flex-wrap: wrap;
  align-items: center;
}
.btn-like, .btn-dislike, .btn-enterado {
  background: none;
  border: none;
  font-size: 1rem;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: #f0f2f5;
  color: #1e2a3a;
  transition: background 0.2s, transform 0.1s;
  font-weight: 500;
}
.btn-like:hover, .btn-dislike:hover, .btn-enterado:hover:not(:disabled) {
  background: #e0e4ea;
  transform: scale(1.03);
}
.btn-like.active-like {
  background: #d4edda;
  color: #155724;
}
.btn-dislike.active-dislike {
  background: #f8d7da;
  color: #721c24;
}
.btn-enterado.active-enterado {
  background: #cce5ff;
  color: #004085;
}
.btn-enterado:disabled {
  opacity: 0.6;
  cursor: default;
}
.like-count, .dislike-count, .enterado-count {
  font-weight: bold;
  margin-left: 0.2rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 700px) {
  .menu-toggle { display: block; }
  nav {
    display: none;
    flex-direction: column;
    width: 100%;
    background: #0b2a4a;
    padding: 0.5rem 0;
    border-radius: 0 0 12px 12px;
    margin-top: 0.5rem;
  }
  nav.open { display: flex; }
  nav a {
    padding: 0.6rem 1.2rem;
    width: 100%;
    text-align: center;
    border-radius: 0;
  }
  nav a:hover { background: rgba(255,255,255,0.15); }
  #adminLink {
    background: #ffb347;
    color: #1e2a3a;
  }
  #adminLink:hover { background: #ffa01c; }
  header { flex-wrap: wrap; }
  .admin-grid { grid-template-columns: 1fr; }
  .post-media { max-height: 300px; }
  .post-media iframe { height: 250px; }
  h2 { font-size: 1.6rem; }
}
@media (max-width: 480px) {
  header h1 { font-size: 1.3rem; }
  .container { padding: 0 0.5rem; }
  form { padding: 1.2rem; }
}