/* Estilos generales del cuerpo de la página */
body {
  margin: 0;
  font-family: Arial, sans-serif;
  background-color: #f0f0f0;
  color: #333;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

/* --- Animación de entrada --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --- SECCIÓN DE SPLASH SCREEN --- */
#splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #f3e9d7;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  animation: fadeOut 1s ease forwards;
  animation-delay: 3s;
}

#splash img {
  max-width: 60%;
  height: auto;
  opacity: 0;
  animation: fadeInZoom 2s ease-out forwards;
}

@keyframes fadeInZoom {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

#main-content {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease-in;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.loaded #main-content {
  opacity: 1;
  visibility: visible;
}

/* Contenedor principal */
.container {
  max-width: 450px;
  width: 100%;
  background-color: #f3e9d7;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  box-sizing: border-box;
  margin-bottom: 20px;
}

body.loaded .container {
    animation: fadeInUp 0.6s ease-out;
}

/* --- Cabecera y Navegación --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

header h1 {
  margin: 0;
  font-size: 28px;
  color: #225a2e;
  font-weight: bold;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background-color: #225a2e;
  padding: 10px;
  border-radius: 12px;
  justify-content: center;
  margin-bottom: 20px;
}

.main-nav a {
  color: white;
  text-decoration: none;
  padding: 8px 15px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 14px;
  transition: background-color 0.3s, transform 0.2s;
}

.main-nav a:hover, .main-nav a.active {
  background-color: #3b8d4f;
  transform: translateY(-2px);
}

nav.category-nav {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 20px;
}

nav.category-nav .item {
  background-color: #225a2e;
  color: #fff;
  text-align: center;
  padding: 20px;
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.2s ease-in-out;
}

nav.category-nav .item i {
  font-size: 28px;
}

nav.category-nav .item.active, nav.category-nav .item:hover {
  background-color: #3b8d4f;
  transform: scale(1.05);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* --- Barra de Búsqueda y Filtros --- */
.search-and-filters {
    margin-bottom: 20px;
}

.search-bar {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.filters {
  display: flex;
}

.filters select {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ddd;
}

/* --- Estilos de Anuncios --- */
.card {
  background-color: #fff;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  border: 2px solid transparent;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.card.destacado {
    border-color: #f0ad4e;
    box-shadow: 0 4px 15px rgba(240, 173, 78, 0.3);
}

.featured-banner {
    position: absolute;
    top: -1px;
    left: -1px;
    background-color: #f0ad4e;
    color: white;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: bold;
    border-top-left-radius: 8px;
    border-bottom-right-radius: 8px;
    z-index: 5;
}

/* Estilo general para CUALQUIER imagen dentro de una tarjeta */
.card img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 10px;
}

.card-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #777;
  margin-bottom: 8px;
}

.card h2 {
  font-size: 18px;
  margin: 0 0 5px;
  font-weight: bold;
}

.card .ubicacion {
  font-size: 13px;
  color: #666;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card .precio {
  font-size: 20px;
  font-weight: bold;
  color: #225a2e;
  margin-top: 5px;
  margin-bottom: 15px;
}

.card a {
  text-decoration: none;
}

.card button {
  background-color: #225a2e;
  color: #fff;
  border: none;
  padding: 12px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  gap: 10px;
}

/* --- Estilos para la Galería de Imágenes --- */
.gallery-container {
  position: relative;
  width: 100%;
  height: 200px;
  overflow: hidden;
  border-radius: 6px;
  margin-bottom: 10px;
  background-color: #e0e0e0;
}

.gallery-track {
  display: flex;
  height: 100%;
  transition: transform 0.5s ease-in-out;
}

.gallery-track img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: cover;
  margin-bottom: 0;
}

.gallery-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  opacity: 0;
  transition: opacity 0.3s;
}

.gallery-container:hover .gallery-btn {
    opacity: 1;
}

.gallery-btn.prev {
  left: 10px;
}

.gallery-btn.next {
  right: 10px;
}

/* --- Estilos de Páginas Comunitarias --- */
.community-card {
  background-color: white;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.community-card h3 {
  margin: 0 0 10px;
  color: #225a2e;
}

.community-card p {
  margin: 5px 0;
}
.community-card .contact-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

/* --- Estilos de Botón Principal --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: #3b8d4f;
  color: white;
  text-decoration: none;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  transition: background-color 0.3s ease, transform 0.2s ease;
}

.btn-primary:hover {
  background-color: #2e6d3c;
  color: white;
  transform: translateY(-2px);
}

/* --- Estilos para el Modal de Confirmación --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background-color: white;
  padding: 25px 30px;
  border-radius: 12px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  text-align: center;
  max-width: 350px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-content p {
  font-size: 18px;
  margin: 0 0 20px 0;
  color: #333;
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.modal-actions button {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}

.modal-actions button:hover {
  opacity: 0.85;
}

.btn-secondary {
  background-color: #6c757d;
  color: white;
}

.btn-danger {
  background-color: #d9534f;
  color: white;
}

/* --- Estilos del Panel de Administración --- */
.admin-section {
    border-top: 2px solid #ccc;
    margin-top: 30px;
    padding-top: 20px;
}

.stats-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-card h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #666;
}

.stat-card p {
    margin: 0;
    font-size: 22px;
    font-weight: bold;
    color: #225a2e;
}

.stat-card .small-text {
    font-size: 12px;
    font-weight: normal;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-form input, .admin-form select, .admin-form textarea {
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ddd;
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
}

.filtros-admin {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.filtros-admin input,
.filtros-admin select {
  flex: 1;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ddd;
  font-size: 14px;
}

.anuncio-item-admin {
  background-color: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 15px;
  position: relative;
}

.anuncio-item-admin.vendido {
    background-color: #f9f9f9;
    opacity: 0.7;
}

.anuncio-item-admin img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.anuncio-item-admin .info {
  flex: 1;
  overflow: hidden;
}

.anuncio-item-admin .info h4 {
  margin: 0 0 5px 0;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.anuncio-item-admin .info p {
  margin: 4px 0;
  font-size: 13px;
  color: #555;
}

.anuncio-item-admin .info .categoria {
  background-color: #e0e0e0;
  color: #333;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  display: inline-block;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-actions button {
    border: none;
    padding: 8px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    min-width: 80px;
    font-weight: bold;
}

.btn-editar { background-color: #f0ad4e; color: white; }
.btn-eliminar { background-color: #d9534f; color: white; }
.btn-marcar-vendido { background-color: #5cb85c; color: white; }

/* --- Estilos para Tarjeta Informativa --- */
.info-card {
    background-color: #e3f2fd; /* Un azul claro y amigable */
    border-left: 5px solid #2196f3; /* Borde de acento azul */
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.info-card i {
    font-size: 28px;
    color: #2196f3;
}

.info-card h4 {
    margin: 0 0 5px 0;
    font-weight: bold;
    color: #1e88e5;
}

.info-card p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}