/* ─── Avisos de Ocasión - Estilos ─────────────────────────────────────────── */

/* Layout principal */
.avisos-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.avisos-header {
  text-align: center;
  margin-bottom: 2rem;
}

.avisos-header h1 {
  font-size: 2rem;
  color: var(--text, #1a1a2e);
  margin-bottom: 0.5rem;
}

.avisos-header p {
  color: var(--text-light, #666);
  font-size: 1.1rem;
}

/* Barra de búsqueda y filtros */
.avisos-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  align-items: center;
}

.avisos-filters .search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.avisos-filters .search-box input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 2.5rem;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 12px;
  font-size: 1rem;
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  transition: border-color 0.2s;
}

.avisos-filters .search-box input:focus {
  outline: none;
  border-color: #e63946;
}

.avisos-filters .search-box .search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.2rem;
  color: var(--text-light, #999);
}

.avisos-filters select {
  padding: 0.75rem 1rem;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 12px;
  font-size: 0.95rem;
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  cursor: pointer;
  min-width: 160px;
}

.avisos-filters select:focus {
  outline: none;
  border-color: #e63946;
}

/* Pills de tipo de aviso */
.aviso-type-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.aviso-type-pill {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  border: 2px solid var(--border, #e0e0e0);
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.aviso-type-pill:hover {
  border-color: #e63946;
  background: #fff5f5;
}

.aviso-type-pill.active {
  background: #e63946;
  color: white;
  border-color: #e63946;
}

/* Grid de tarjetas */
.avisos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.aviso-card {
  background: var(--bg-card, #fff);
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 16px;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}

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

.aviso-card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #f0f0f0;
}

.aviso-card-image-placeholder {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.aviso-card-body {
  padding: 1rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.aviso-card-badges {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.aviso-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.aviso-badge-tipo {
  background: #e63946;
  color: white;
}

.aviso-badge-categoria {
  background: var(--border, #e0e0e0);
  color: var(--text, #1a1a2e);
}

.aviso-badge-destacado {
  background: #ffd700;
  color: #1a1a2e;
}

.aviso-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text, #1a1a2e);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

.aviso-card-desc {
  font-size: 0.9rem;
  color: var(--text-light, #666);
  line-height: 1.5;
  margin-bottom: 0.75rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.aviso-card-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: #e63946;
  margin-bottom: 0.5rem;
}

.aviso-card-price .a-convenir {
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--text-light, #666);
  font-style: italic;
}

.aviso-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-light, #888);
  margin-bottom: 0.75rem;
}

.aviso-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.aviso-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.btn-contactar-wa {
  flex: 1;
  padding: 0.7rem;
  background: #25D366;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn-contactar-wa:hover {
  background: #1da851;
}

.btn-ver-detalle {
  padding: 0.7rem 1rem;
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.btn-ver-detalle:hover {
  border-color: #e63946;
  color: #e63946;
}

/* Paginación */
.avisos-pagination {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.avisos-pagination button {
  padding: 0.5rem 1rem;
  border: 2px solid var(--border, #e0e0e0);
  border-radius: 8px;
  background: var(--bg-card, #fff);
  color: var(--text, #1a1a2e);
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.avisos-pagination button:hover {
  border-color: #e63946;
  color: #e63946;
}

.avisos-pagination button.active {
  background: #e63946;
  color: white;
  border-color: #e63946;
}

.avisos-pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Estado vacío */
.avisos-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light, #888);
}

.avisos-empty .empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.avisos-empty h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  color: var(--text, #1a1a2e);
}

/* Loading */
.avisos-loading {
  text-align: center;
  padding: 3rem;
}

.avisos-loading .spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border, #e0e0e0);
  border-top-color: #e63946;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Modal de detalle */
.aviso-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.aviso-modal {
  background: var(--bg-card, #fff);
  border-radius: 20px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  position: relative;
}

.aviso-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text, #1a1a2e);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.aviso-modal-close:hover {
  background: var(--border, #e0e0e0);
}

.aviso-modal-image {
  width: 100%;
  max-height: 300px;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 1rem;
}

.aviso-modal-body h2 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text, #1a1a2e);
}

.aviso-modal-body .descripcion {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-light, #555);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

.aviso-modal-body .info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.aviso-modal-body .info-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.aviso-modal-body .info-item label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-light, #888);
  font-weight: 600;
}

.aviso-modal-body .info-item span {
  font-size: 0.95rem;
  color: var(--text, #1a1a2e);
}

/* Responsive */
@media (max-width: 768px) {
  .avisos-grid {
    grid-template-columns: 1fr;
  }

  .avisos-filters {
    flex-direction: column;
  }

  .avisos-filters .search-box {
    min-width: 100%;
  }

  .avisos-filters select {
    min-width: 100%;
  }

  .aviso-modal-body .info-grid {
    grid-template-columns: 1fr;
  }

  .avisos-header h1 {
    font-size: 1.5rem;
  }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  .aviso-card { background: #16213e; border-color: #2a2a4a; }
  .aviso-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.3); }
  .aviso-card-image-placeholder { background: linear-gradient(135deg, #1a1a3e 0%, #2a1a4a 100%); }
  .aviso-badge-categoria { background: #2a2a4a; color: #ccc; }
  .btn-ver-detalle { background: #16213e; border-color: #2a2a4a; }
  .avisos-filters .search-box input { background: #16213e; border-color: #2a2a4a; }
  .avisos-filters select { background: #16213e; border-color: #2a2a4a; }
  .aviso-type-pill { background: #16213e; border-color: #2a2a4a; }
  .aviso-type-pill:hover { background: #1a1a3e; }
  .aviso-modal { background: #16213e; }
  .avisos-pagination button { background: #16213e; border-color: #2a2a4a; }
}
