:root {
      --primary: #008751;
      --primary-hover: #006b40;
      --accent-orange: #ff6a00;
      --bg: #f4f6f8;
      --card-bg: #ffffff;
      --footer-bg: #2b2b2b;
      --text: #1a1a1a;
      --text-light: #ffffff;
      --subtext: #666666;
      --subtext-footer: #bbbbbb;
      --border: #e0e0e0;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    }

    body {
      background-color: var(--bg);
      color: var(--text);
      display: flex;
      flex-direction: column;
      min-height: 100vh;
    }

    /* Contenedor principal del header */
header {
  width: 100%;
  background-color: #ffffff; /* Cambia el color de fondo si lo deseas */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  padding: 10px 20px;
  box-sizing: border-box;
}

/* Navbar con Flexbox */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  gap: 15px;
}

/* El logo se adapta al contenedor */
.logo img {
  display: block;
  max-width: 80%;
  height: auto; /* Permite que mantenga la proporción */
}

/* Contenedor de los botones */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Estilos básicos para los botones */
.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  border-radius: 4px;
  white-space: nowrap; /* Evita que el texto del botón se rompa en dos líneas */
}

/* --- Adaptación para Pantallas Móviles --- */
@media (max-width: 600px) {
  .navbar {
    flex-direction: column; /* Cambia a diseño vertical en móviles */
    gap: 12px;
    text-align: center;
  }

  .nav-actions {
    width: 100%;
    justify-content: center; /* Centra los botones en pantallas chicas */
  }
}

    .logo {
      font-size: 1.4rem;
      font-weight: 800;
      color: var(--primary);
      text-decoration: none;
      letter-spacing: -0.5px;
      white-space: nowrap;
    }

    .nav-actions {
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 16px 16px;
      border-radius: 8px;
      font-weight: 700;
      font-size: 1.1rem;
      text-decoration: none;
      transition: background-color 0.15s ease, transform 0.1s ease;
      cursor: pointer;
      text-align: center;
    }
    .btn_1 {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 5px 5px;
      border-radius: 4px;
      font-weight: 700;
      font-size: 1.1rem;
      text-decoration: none;
      transition: background-color 0.15s ease, transform 0.1s ease;
      cursor: pointer;
      text-align: center;
    }

    .btn:active {
      transform: scale(0.97);
    }
    .btn_1:active {
      transform: scale(0.97);
    }
    .btn-key {
      background-color: transparent;
      color: var(--primary);
      font-size:8px;
      color:#F77F00;
      padding:2px !important;
      border: 1px solid var(--primary);  
    }
    .btn-secondary {
      background-color: transparent;
      color: var(--primary);
      border: 1px solid var(--primary);
    }

    .btn-secondary, .btn-key:hover {
      background-color: #e6f3ed;
    }

    .btn-publish {
      background-color: var(--accent-orange);
      color: var(--text-light);
      border: none;
    }

    .btn-publish:hover {
      background-color: #e05d00;
    }

    /* Search Bar Section */
    .search-section {
      background-color: var(--bg);
      border-bottom: 1px solid var(--border);
      padding: 12px 16px;
    }

    .search-container {
      max-width: 800px;
      margin: 0 auto;
    }

    .search-form {
      display: flex;
      gap: 8px;
    }

    .search-input-wrapper {
      position: relative;
      flex: 1;
      display: flex;
      align-items: center;
    }

    .search-icon {
      position: absolute;
      left: 12px;
      font-size: 1rem;
      pointer-events: none;
    }

    .search-input {
      width: 100%;
      padding: 12px 12px 12px 38px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-size: 0.95rem;
      outline: none;
      background-color: var(--card-bg);
      transition: border-color 0.15s ease, background-color 0.15s ease;
    }

    .search-input:focus {
      border-color: var(--primary);
      background-color: #ffffff;
    }

    .btn-search {
      background-color: #009A44;
      color: var(--text-light);
      border: none;
      padding: 0 20px;
      font-weight: 700;
      border-radius: 8px;
      cursor: pointer;
      white-space: nowrap;
    }

    .btn-search:hover {
      background-color: var(--primary-hover);
    }

    /* Main Container */
    .container {
      max-width: 1200px;
      margin: 0 auto;
      padding: 24px 16px;
      width: 100%;
      flex: 1;
    }

    .hero-title {
      text-align: center;
      font-size: 1.4rem;
      font-weight: 800;
      margin-bottom: 6px;
    }

    .hero-subtitle {
      text-align: center;
      font-size: 0.95rem;
      color: var(--subtext);
      margin-bottom: 24px;
    }

    /* Categories Grid */
    .categories-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 12px;
      margin-bottom: 28px;
    }

    @media (min-width: 600px) {
      .categories-grid {
        grid-template-columns: repeat(3, 1fr);
      }
    }

    .category-card {
      background-color: var(--card-bg);
      border: 1px solid var(--border);
      border-radius: 12px;
      padding: 20px 12px;
      text-decoration: none;
      color: var(--text);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      transition: border-color 0.15s ease;
      -webkit-tap-highlight-color: transparent;
    }

    .category-card:active {
      transform: scale(0.97);
      background-color: #f0f0f0;
    }

    .category-card:hover {
      border-color: var(--primary);
    }

    .category-icon {
      font-size: 2.2rem;
      margin-bottom: 8px;
    }

    .category-title {
      font-size: 1rem;
      font-weight: 600;
    }

    .global-action {
      text-align: center;
    }

    .btn-all-ads {
      width: 100%;
      max-width: 400px;
      padding: 14px 20px;
      background-color: var(--primary);
      color: var(--text-light);
      font-size: 1rem;
    }

    .btn-all-ads:hover {
      background-color: var(--primary-hover);
    }

    /* Footer Structure */
    footer {
      background-color: var(--footer-bg);
      color: var(--text-light);
      margin-top: auto;
      font-size: 0.85rem;
    }

    .footer-top {
      max-width: 1000px;
      margin: 0 auto;
      padding: 32px 16px;
      display: grid;
      grid-template-columns: 1fr;
      gap: 28px;
    }

    @media (min-width: 768px) {
      .footer-top {
        grid-template-columns: 1.2fr 1fr 1fr;
      }
    }

    .footer-col h3 {
      font-size: 0.95rem;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      margin-bottom: 14px;
      color: #ffffff;
    }

    .footer-col p, .footer-col a {
      color: var(--subtext-footer);
      text-decoration: none;
      line-height: 1.6;
      display: block;
      margin-bottom: 8px;
    }

    .footer-col a:hover {
      color: #ffffff;
    }

    .contact-item {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      margin-bottom: 10px;
    }

    .promo-box {
      border: 2px solid var(--accent-orange);
      border-radius: 8px;
      padding: 16px;
      text-align: center;
      background-color: #202020;
    }

    .promo-title {
      color: var(--accent-orange);
      font-weight: 800;
      font-size: 1.1rem;
      margin-bottom: 4px;
    }

    .promo-subtitle {
      font-size: 1.2rem;
      font-weight: 700;
      color: #ffffff;
      margin-bottom: 8px;
    }

    .btn-promo {
      background-color: var(--primary);
      color: #ffffff;
      padding: 8px 16px;
      border-radius: 6px;
      text-decoration: none;
      font-weight: 700;
      display: inline-block;
      margin-top: 8px;
    }

    .footer-bottom {
      background-color: #1a1a1a;
      text-align: center;
      padding: 16px;
      color: var(--subtext-footer);
      border-top: 1px solid #333333;
      font-size: 0.8rem;
    }

    .footer-bottom a {
      color: var(--accent-orange);
      text-decoration: none;
    }
    /* ==========================================
   SECCIÓN ÚLTIMOS ANUNCIOS
   ========================================== */

section {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 24px;
  border-left: 4px solid #e65100; /* Color de acento */
  padding-left: 12px;
}

/* Grilla Responsiva */
#latestAds {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

/* Tarjeta de Anuncio */
.card {
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #eef2f5;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Enlace contenedor */
.card-link {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Contenedor de la Imagen */
.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 190px;
  background-color: #f4f6f8;
  overflow: hidden;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-image-wrapper img {
  transform: scale(1.04);
}

/* Contenido de la Tarjeta */
.card-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 10px 0;
  line-height: 1.4;
  /* Truncado a 2 líneas si es muy largo */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  height: 2.7em;
}

/* Precio */
.price {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2e7d32; /* Verde precio */
  margin: 0 0 8px 0;
}

/* Ubicación */
.location {
  font-size: 0.82rem;
  color: #7f8c8d;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================
   ESTADOS DE CARGA Y MENSAJES
   ========================================== */

.loading-text, .no-ads {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px 20px;
  color: #666;
  font-size: 1rem;
}

.error-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background-color: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  color: #c53030;
}

.btn-retry {
  margin-top: 12px;
  padding: 8px 18px;
  background-color: #e53e3e;
  color: white;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
}

.btn-retry:hover {
  background-color: #c53030;
}
.ivh-bar{
    width:100%;
    background:#000;
    border-top:3px solid #F77F00;
    border-bottom:3px solid #009E60;
    padding:10px 15px;
    box-sizing:border-box;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:15px;
    flex-wrap:wrap;
    text-align:center;
    font-family:Arial,sans-serif;
}

.ivh-bar-text{
    color:#fff;
    font-size:16px;
    line-height:1.4;
}

.ivh-bar-text strong{
    color:#F77F00;
}

.ivh-bar-btn{
    background:#009E60;
    color:#fff;
    padding:8px 18px;
    border-radius:20px;
    text-decoration:none;
    font-weight:bold;
    white-space:nowrap;
}

@media (max-width:768px){

    .ivh-bar{
        flex-direction:column;
        gap:10px;
        padding:12px;
    }

    .ivh-bar-text{
        font-size:14px;
    }

    .ivh-bar-btn{
        width:100%;
        max-width:280px;
        box-sizing:border-box;
    }
}
/* ==========================================
   EFECTO SKELETON LOADING
   ========================================== */

/* Estructura de la tarjeta esqueleto */
.skeleton-card {
  pointer-events: none;
  border-color: #eee;
}

/* Animaci  n de destello shimmer */
.skeleton {
  background: #e2e8f0;
  background: linear-gradient(
    90deg,
    #e2e8f0 0%,
    #f8fafc 50%,
    #e2e8f0 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* Tama 0 9os de las l  neas placeholder */
.skeleton-title {
  height: 16px;
  margin-bottom: 8px;
  width: 90%;
}

.skeleton-title.short {
  width: 60%;
  margin-bottom: 16px;
}

.skeleton-price {
  height: 20px;
  width: 50%;
  margin-bottom: 12px;
}

.skeleton-location {
  height: 14px;
  width: 40%;
  margin-top: auto;
}
 /* ---------- SECTION : deux colonnes ---------- */
    .section {
      max-width: 1200px;
      width: 100%;
      background: var(--bg);
      border-radius: 10px;
      box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.12);
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      overflow: hidden;
      transition: all 0.2s ease;
    }

    /* COLONNE GAUCHE : texte + boutons */
    .section-content {
      flex: 1 1 55%;
      padding: 2.8rem 2.5rem 2.8rem 2.8rem;
      min-width: 280px;
    }

    .section-content .badge {
      display: inline-block;
      background: #e8edfb;
      color: #2563eb;
      font-weight: 600;
      font-size: 0.85rem;
      letter-spacing: 0.5px;
      padding: 0.3rem 1rem;
      border-radius: 40px;
      margin-bottom: 1rem;
      text-transform: uppercase;
    }

    .section-content h2 {
      font-size: 2.4rem;
      font-weight: 700;
      color: #0b1a33;
      line-height: 1.2;
      margin-bottom: 0.6rem;
    }

    .section-content h2 .highlight-blue {
      color: #2563eb;
    }

    .section-content .sub-text {
      font-size: 1.1rem;
      color: #334155;
      margin-bottom: 1.6rem;
      line-height: 1.5;
      font-weight: 400;
    }

    .section-content .sub-text strong {
      color: #0b1a33;
      font-weight: 600;
    }

    .section-content .sub-text .gratuit-badge-inline {
      display: inline-block;
      background: #dbeafe;
      padding: 0.1rem 0.9rem;
      border-radius: 30px;
      font-weight: 600;
      color: #1d4ed8;
      margin: 0 0.15rem;
    }

    .section-content .sub-text .arrow-icon {
      display: inline-block;
      margin: 0 0.2rem;
      color: #2563eb;
    }

    /* BOUTONS */
    .actions {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 1rem;
      margin: 1.8rem 0 0.2rem;
    }

    .btn_2 {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.6rem;
      font-size: 1.1rem;
      font-weight: 600;
      padding: 0.8rem 2.2rem;
      border-radius: 10px;
      border: none;
      background: white;
      color: #0b1a33;
      transition: all 0.2s ease;
      cursor: default;
      text-decoration: none;
      border: 1px solid #d9e0eb;
      min-width: 160px;
    }

    .btn_2-primary {
      background: #2563eb;
      border: 1px solid #2563eb;
      color: white;
      box-shadow: 0 8px 18px -6px #2563eb60;
    }

    .btn_2-primary .btn-icon {
      color: white;
    }

    .btn_2-outline {
      background: white;
      border: 1px solid #cdd8e8;
      color: #1e293b;
    }

    .btn_2-outline .btn-icon {
      color: #2563eb;
    }

    .btn_2 .btn_2-icon {
      font-size: 1.1rem;
      line-height: 1;
    }

    .btn_2-primary:hover {
      background: #1d4ed8;
      transform: scale(1.02);
      box-shadow: 0 10px 22px -8px #2563eb90;
    }

    .btn_2-outline:hover {
      background: #f2f6fe;
      border-color: #2563eb;
      transform: scale(1.02);
    }

    /* petit texte 100% gratuit */
    .free-tag {
      margin-top: 1.2rem;
      font-size: 0.9rem;
      color: #4b5b6e;
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .free-tag .check-icon {
      color: #16a34a;
      font-size: 1.1rem;
    }

    /* ---------- COLONNE DROITE : IMAGE ---------- */
    .section-image {
      flex: 1 1 45%;
      min-height: 280px;
      background: var(--bg);
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1.5rem;
      /* On simule une image avec un dégradé + icône + texte */
      background: var(--bg);
      min-height: 320px;
      position: relative;
    }

    /* contenu visuel de l'image (simule une photo/illustration) */
    .image-placeholder {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      color: #1e3a6b;
      width: 100%;
      height: 100%;
    }

    .image-placeholder .big-icon {
      font-size: 5rem;
      line-height: 1;
      margin-bottom: 0.5rem;
      opacity: 0.9;
    }

    .image-placeholder .img-label {
      font-size: 1rem;
      font-weight: 500;
      background: var(--bg);
      backdrop-filter: blur(4px);
      padding: 0.4rem 1.8rem;
      border-radius: 60px;
      color: #0b1a33;
      letter-spacing: 0.3px;
      border: 1px solid rgba(255, 255, 255, 0.5);
    }

    /* On peut aussi mettre une vraie image si on veut :
       .section-image img { width:100%; height:100%; object-fit:cover; }
       mais ici on garde un style épuré sans ressource externe */

    /* ----- RESPONSIVE ----- */
    @media (max-width: 820px) {
      .section-content {
        padding: 2rem 1.8rem;
        flex: 1 1 100%;
      }

      .section-image {
        flex: 1 1 100%;
        min-height: 220px;
        padding: 1.5rem;
        border-radius: 0 0 2.5rem 2.5rem;
      }

      .section-content h2 {
        font-size: 2rem;
      }

      .section {
        border-radius: 2rem;
      }
    }

    @media (max-width: 480px) {
      body {
        padding: 1rem;
      }

      .section-content {
        padding: 1.5rem 1.2rem;
      }

      .section-content h2 {
        font-size: 1.6rem;
      }

      .section-content .sub-text {
        font-size: 1rem;
      }

      .actions {
        flex-direction: column;
        width: 100%;
      }

      .btn {
        width: 100%;
        min-width: unset;
        padding: 0.8rem 1rem;
        font-size: 1rem;
      }

      .section-image {
        min-height: 180px;
        border-radius: 0 0 1.8rem 1.8rem;
      }

      .image-placeholder .big-icon {
        font-size: 3.6rem;
      }
    }

    @media (max-width: 380px) {
      .section-content h2 {
        font-size: 1.4rem;
      }
    }