* {
  box-sizing: border-box;
}

body {
  box-sizing: border-box;
  margin: 0;
  padding: 0; 
  --background-color: #F4F7F6;
  --color-textos-grandes: #1ab359;
  --color-textos-pequeños: #2C3E50;
  --hovers: #34495E;
  --fuente-grande: 'Montserrat';
  --fuente-pequeña: 'Open Sans', sans-serif;
  background-color: var(--background-color);
}


/* Contenedor General */
.ad-detail-container {
  padding-bottom: 100px !important; /* Espacio para que el botón sticky no tape el contenido */
  background: white;
  padding: 20px;
}


/* Galería */
.main-image-wrapper {
    position: relative;
}

.ad-gallery .main-image-wrapper img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;  
  border-radius: 15px;
}

#det-descripcion {
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;      /* Respeta los saltos de línea de PHP (nl2br) */
    color: #555;
    line-height: 1.5;
}


/* La etiqueta Premium (usando tu estilo del Main) */
.badge-premium-detalle {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 20;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    pointer-events: none;
}

.badge-premium-detalle span {
    font-size: 15px !important;
    margin-right: 3px;
}

.thumbnails {
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
}

.thumb {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 5px;
  border: 2px solid transparent;
}

.thumb.active { border-color: #2ECC71; }

/* Info Principal */
.ad-main-info { padding: 20px; border-bottom: 1px solid #eee; }

.price-row { display: flex; justify-content: space-between; align-items: center; }

.ad-price { font-size: 1.8rem; color: #2c3e50; margin: 0; }

.btn-wishlist {
    display: flex;
    align-items: center;
    gap: 5px;
    background: #fff0f0;
    border: 1px solid #ffcccc;
    padding: 8px 12px;
    border-radius: 20px;
    color: #e74c3c;
    cursor: pointer;
    transition: 0.3s;
}

.btn-wishlist .text-fav {
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-wishlist.active {
    background: #e74c3c;
    color: white;
}

.ad-title-full { font-size: 1.3rem; margin: 10px 0; color: #333;word-wrap: break-word;      /* Permite que las palabras largas se rompan */
    overflow-wrap: break-word;  /* Estándar moderno */
    word-break: break-word;     /* Para navegadores antiguos */
    line-height: 1.2;           /* Evita que las líneas se encimen */ }

.ad-meta { font-size: 0.85rem; color: #777; }

/* Blindaje extra para el contenedor de info */
.ad-main-info, .ad-description {
    padding: 20px;
    border-bottom: 1px solid #eee;
    max-width: 100%;            /* No permite que crezca más que el padre */
    overflow: hidden;           /* Corta cualquier cosa que intente asomarse */
}

/* Descripción */
.ad-description { padding: 20px; border-bottom: 1px solid #eee; }

/* Seller Card */
.seller-card {
  padding: 20px;
  background: #f9f9f9; 
}

.seller-info { display: flex; align-items: center; gap: 15px; }

.seller-info img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.seller-avatar {
  width: 70px;
  height: 70px;
  background: #2ECC71;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  overflow: hidden;
}

/* BARRA DE ACCIÓN FIJA ABAJO */
.action-bar-mobile {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  display: flex;
  padding: 12px;
  gap: 10px;
  box-shadow: 0 -5px 15px rgba(0,0,0,0.1);
  box-sizing: border-box;
  z-index: 9999;
}

.btn-action {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: bold;
  font-size: 1rem;
  border: none;
  cursor: pointer;
}

.btn-call { background: #f0f0f0; color: #333; }
.btn-whatsapp { background: #25D366; color: white; }
.btn-whatsapp img { width: 20px; }

/* 1. Limitamos el ancho en pantallas grandes para que no "explote" */
.main-wrapper-detail {
    max-width: 1100px;
    margin: 0 auto;
    background: #f4f4f4; /* Un fondo gris suave para resaltar el contenedor blanco */
}

.seller-data {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 4px; /* Espacio pequeño entre nombre, ubicación y teléfono */
}

.seller-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 2px;
    color: var(--color-textos-grandes);
}

/* Estilos que estaban in-line en el nombre del vendedor */
.seller-name a {
    text-decoration: none; 
    color: inherit;
}

.seller-name small {
    font-size: 0.7rem; 
    color: #007bff; 
    display: block;
}

.seller-detail {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: #666;
}

.seller-detail .material-symbols-outlined {
    font-size: 16px; /* Iconos un poco más grandes para que sean claros */
    color: #888;
}

.seller-phone a {
    text-decoration: none;
    color: #007bff; /* Color azul para indicar que es clickeable */
    font-weight: 600;
    cursor: auto;
}

.btn-copy-num {
    background: #f0f0f0;
    border: none;
    border-radius: 6px;
    padding: 2px 6px;
    margin-left: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
    color: #888;
}

.btn-copy-num:hover {
    background: #e0e0e0;
    color: var(--color-textos-grandes);
}

.btn-copy-num .material-symbols-outlined {
    font-size: 16px !important;
}

/* Clase para cuando ya se copió */
.copied {
    background: #d4edda !important;
    color: #155724 !important;
}

.seller-phone a:hover {
    text-decoration: none;
}

/* 2. Ajustes para Tablet y Desktop (desde 768px en adelante) */
@media (min-width: 768px) {
    
    .ad-detail-container {
        display: grid;
        grid-template-columns: 1.2fr 1fr; /* Columna izquierda un poco más ancha */
        gap: 20px;
        padding: 20px;
        background: transparent;
    }

    /* La galería se queda a la izquierda */
    .ad-gallery {
        grid-column: 1;
        grid-row: 1 / 4; /* Ocupa varias filas hacia abajo */
        background: white;
        border-radius: 12px;
        overflow: hidden;
        height: fit-content;
        position: sticky;
        top: 20px; /* Se queda fija mientras haces scroll en la info */
    }

    /* La información, descripción y vendedor a la derecha */
    .ad-main-info, .ad-description, .seller-card {
        grid-column: 2;
        background: white;
        border-radius: 12px;
        margin-bottom: 15px;
        border: 1px solid #eee;
    }

    /* Ajustamos la barra de acción (Llamar/WhatsApp) */
    .action-bar-mobile {
        /*position: static; /* Deja de ser pegajosa abajo */
        box-shadow: none;
        padding: 15px;
        margin-top: 20px;
    }

    .ad-gallery .main-image-wrapper img {
        border-radius: 8px;
    }

}

/* -----------SECCION ARTICULOS RELACIONADOS------------------ */

.related-ads-container {
    padding: 20px 5px;
    background-color: #f9f9f9;
    padding-bottom: 110px; 
}

/* --- CABECERA DE LA SECCIÓN --- */
.related-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px 15px;
}

.related-header h3 {
    font-size: 1.1rem;
    color: #333;
    font-weight: 700;
}

.related-header a {
    font-size: 0.85rem;
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
}

/* --- WRAPPER DEL SCROLL --- */
.related-scroll-wrapper {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 5px 15px 15px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.related-scroll-wrapper::-webkit-scrollbar {
    display: none;
}

/* --- TARJETA INDIVIDUAL --- */
.rel-card-link {
    text-decoration: none;
    color: inherit;
    width: 240px; 
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
}

.rel-card {
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.rel-card:active {
    transform: scale(0.97);
}

/* --- ÁREA DE IMAGEN --- */
.rel-img-box {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.rel-img-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- ETIQUETA PREMIUM (NUEVA) --- */
.rel-premium-badge {
    position: absolute;
    bottom: 8px;
    right: 8px; /* Lado izquierdo */
    z-index: 20;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    color: #000;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 800;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    pointer-events: none;
    line-height: 1;
}

.rel-premium-badge span {
    font-size: 13px !important;
    margin-right: 2px;
}

/* --- ETIQUETA DE PRECIO (AJUSTADA A LA DERECHA) --- */
.rel-tag {
    position: absolute;
    bottom: 8px;
    left: 8px; /* Movida a la derecha para no chocar con Premium */
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    z-index: 10;
}

/* --- CUERPO DE LA TARJETA --- */
.rel-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.rel-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3em;
    height: 2.6em;
    word-break: break-word;
}

.rel-loc {
    font-size: 0.75rem;
    color: #777;
    margin: auto 0 0;
}

/* ------------FOOTER-------------------------------- */

.footer-universal {
  background-color: #2c3e50; /* Color oscuro profesional */
  color: #ecf0f1;
  padding: 50px 20px 20px;
  font-family: 'Inter', sans-serif;
  margin-top: 50px;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  /* En móvil una columna, en tablet 2, en PC 4 */
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 30px;
}

.footer-section h4 {
  color: #2ECC71; /* Tu verde */
  margin-bottom: 20px;
  font-size: 1.1rem;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 10px;
}

.footer-section a {
  color: #bdc3c7;
  text-decoration: none;
  transition: 0.3s;
}

.footer-section a:hover {
  color: white;
  padding-left: 5px; /* Pequeño efecto de movimiento */
}


/* Barra inferior */
.footer-bottom {
  border-top: 1px solid #3e4f5f;
  margin-top: 40px;
  padding-top: 20px;
  text-align: center;
  font-size: 0.8rem;
  color: #95a5a6;
  position: relative;
}

.btn-top {
  position: absolute;
  right: 0;
  top: 15px;
  background-color: #34495e;
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.3s;
}

.btn-top:hover {
  background-color: #2ECC71;
}

.social-link img {
  width: 40px;
  height: 40px;
}

/* ------------FOOTER END---------------------- */