/* Estilos generales */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 0;
}

.main-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* --- Nuevos estilos para el Header --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
}

.logo {
    height: 120px;
    margin-right: 15px;
}

.header-title {
    font-size: 1.2em;
    color: #555;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.search-box input {
    width: 100%;
    padding: 0.5rem 2rem;
    border-radius: 20px;
    border: none;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    outline: none;
    transition: box-shadow 0.3s;
    border: 1px solid #ccc;
    padding: 8px 25px;
    transition: all 0.3s ease;
}

.search-box input:focus {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.2);
}

.main-nav .nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 20px;
}

.main-nav .nav-list li a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    padding: 5px 10px;
    transition: background-color 0.3s ease, border-radius 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-nav .nav-list li a:hover {
    background-color: var(--light-bg);
    border-radius: 5px;
}

/* Estilos de los íconos */
.menu-icon {
    width: 50px;
    height: 50px;
    display: block;
}

.icon-container {
    display: inline-block;
    transition: transform 0.5s ease-in-out;
}

.icon-container:hover {
    transform: rotateY(360deg);
}

/* --- Responsive Design / Media Queries --- */
@media (max-width: 768px) {
    .header-main {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }
    
    .main-nav {
        width: 110%;
    }

    .main-nav .nav-list {
        justify-content: center;
    }

    .banner-container {
        width: 100%;
        text-align: center;
        order: -1;
        margin-bottom: 10px;
    }

    .banner-image {
        margin: 0 auto;
    }

    .main-nav .nav-list {
        display: ruby;
    }

    .hamburger-menu {
        display: block;
        position: static;
    }
}

/* --- Botón para categorías en móviles --- */
.categorias-toggle {
    display: none;
    width: 100%;
    padding: 12px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    margin-bottom: 15px;
    text-align: center;
}

.categorias-toggle i {
    margin-right: 10px;
}

/* --- Fin de estilos para el Header --- */

/* Estilos de la grilla principal */
.ofertas-grid-container {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
}

/* Sidebar de categorías (para desktop) */
.sidebar-categorias {
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Estilos de la barra lateral de categorías */
.sidebar-categorias h3 {
    margin-top: 0;
    border-bottom: 2px solid #007bff;
    padding-bottom: 10px;
}

.categorias-slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.categoria-item {
    text-decoration: none;
    color: #333;
    padding: 8px 12px;
    border-radius: 5px;
    background-color: #e9ecef;
    transition: all 0.3s ease;
}

.categoria-item:hover, .categoria-item.active-category {
    background-color: #007bff;
    color: #fff;
    transform: translateX(5px);
}

/* --- Media Queries para Móviles --- */
@media (max-width: 768px) {
    .categorias-toggle {
        display: block;
    }

    .ofertas-grid-container {
        display: block;
    }

    .sidebar-categorias {
        display: block;
        position: fixed;
        top: 0;
        left: -250px;
        width: 250px;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        padding: 20px;
        background-color: #f8f9fa;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
    }

    .sidebar-categorias.show {
        left: 0;
    }

    .ofertas-container {
        grid-template-columns: 1fr;
    }

    .oferta-detalle {
        grid-template-columns: 1fr;
    }
}

/* Contenedor de ofertas */
.ofertas-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* Tarjeta de oferta */
.oferta-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.oferta-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.oferta-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.oferta-card-content {
    padding: 15px;
}

.oferta-card h4 {
    margin: 0 0 10px 0;
    font-size: 1.2em;
    color: #333;
}

.negocio-nombre {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: 10px;
}

.oferta-precios {
    display: flex;
    align-items: center;
    gap: 10px;
}

.precio-original {
    text-decoration: line-through;
    color: #dc3545;
    font-size: 0.9em;
}

.precio-descuento {
    color: #28a745;
    font-size: 1.2em;
    font-weight: bold;
}

.porcentaje-descuento {
    color: #17a2b8;
    font-size: 1em;
    font-weight: bold;
}

/* Nuevos estilos para el modal dinámico */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background-color: rgba(0,0,0,0.7);
}

.modal-content {
    background-color: #fff;
    margin: 20px auto;
    padding: 30px;
    border-radius: 10px;
    width: 95%;
    max-width: 900px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: relative;
    animation-name: animatetop;
    animation-duration: 0.4s;
}

@keyframes animatetop {
    from {top: -300px; opacity: 0}
    to {top: 0; opacity: 1}
}

.modal-header {
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
    position: relative;
}

.modal-header .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.modal-header .close-btn:hover {
    color: #000;
}

.modal-header .oferta-titulo {
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.8em;
    color: #333;
}

.modal-header .anunciado-por {
    font-size: 0.9em;
    color: #777;
    margin-bottom: 0;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.oferta-detalle {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
}

/* Nuevos estilos para la galería de imágenes */
.oferta-galeria-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.main-image-viewer {
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    cursor: pointer;
}

.main-image-viewer img {
    width: 100%;
    height: auto;
    display: block;
}

.image-gallery-ribbon {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 5px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f1f1f1;
}

.image-gallery-ribbon::-webkit-scrollbar {
    height: 8px;
}

.image-gallery-ribbon::-webkit-scrollbar-thumb {
    background-color: #ccc;
    border-radius: 4px;
}

.image-gallery-ribbon::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}

.gallery-thumbnail {
    width: 100px;
    height: 70px;
    object-fit: cover;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.3s ease, transform 0.2s ease;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
}

/* Estilos del modal para la imagen a tamaño completo */
.full-image-modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

.full-image-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    object-fit: contain;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.full-image-close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.full-image-close-btn:hover,
.full-image-close-btn:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

.oferta-info {
    padding: 10px;
}

.oferta-info .descripcion {
    line-height: 1.6;
    color: #555;
    margin-bottom: 15px;
}

.oferta-campos p {
    margin-bottom: 8px;
    color: #666;
}

.oferta-campos i {
    margin-right: 5px;
    color: #007bff;
}

.oferta-acciones {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-whatsapp, .btn-ver-oferta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.btn-whatsapp {
    background-color: #25D366;
}

.btn-whatsapp:hover {
    background-color: #128C7E;
}

.btn-ver-oferta {
    background-color: #007bff;
}

.btn-ver-oferta:hover {
    background-color: #0056b3;
}

/* Estilos para ofertas relacionadas en 2 columnas */
.ofertas-relacionadas-container {
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.grid-related-offers {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.related-offer-card {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
}

.related-offer-card:hover {
    transform: translateY(-5px);
}

.related-offer-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.related-card-content {
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.related-card-content h5 {
    font-size: 1em;
    margin: 0 0 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #333;
}

.related-card-content .negocio-nombre {
    font-size: 0.8em;
    color: #777;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-card-content .precio-descuento {
    color: #28a745;
    font-weight: bold;
    margin-top: auto;
}

/* Media Queries para un diseño responsive */
@media (max-width: 768px) {
    .header {
        flex-wrap: wrap;
        justify-content: center;
        text-align: center;
        padding: 10px;
    }
    
    .header-left, .header-right {
        width: 100%;
        justify-content: center;
    }
    
    .header-title {
        display: none;
    }

.search-box {
    order: 3;
    width: 72%;
    margin: 10px auto 0 auto;
    /* La línea de arriba es la que centra el elemento */
}

    .main-nav {
        order: 2;
        width: 100%;
        margin-top: 10px;
        text-align: center;
    }

    .main-nav ul {
        justify-content: center;
        gap: 10px;
    }

    .ofertas-grid-container {
        grid-template-columns: 1fr;
    }

    .sidebar-categorias {
        position: fixed;
        width: 250px;
        height: 100%;
        top: 0;
        left: -290px;
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        padding: 20px;
        background-color: #f8f9fa;
        box-shadow: 2px 0 5px rgba(0,0,0,0.2);
        display: block; /* Se asegura de que el elemento siempre sea un bloque y pueda ser animado */
    }
    
    .categorias-toggle {
        display: block;
    }

    .ofertas-container {
        grid-template-columns: 1fr;
    }

    .oferta-detalle {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        padding: 15px;
    }
}
/* Estilos para el contenedor de la galería en el modal */
.oferta-galeria-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

/* Visor de la imagen principal */
.main-image-viewer {
    position: relative;
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    cursor: pointer;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.main-image-viewer img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

/* Flechas de navegación */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.3s ease;
}

.nav-arrow:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.left-arrow {
    left: 10px;
}

.right-arrow {
    right: 10px;
}

/* Carrusel de miniaturas */
.image-gallery-ribbon {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 10px;
    width: 100%;
    max-width: 600px;
    white-space: nowrap;
    scrollbar-width: thin;
    scrollbar-color: #ddd #f1f1f1;
}

.image-gallery-ribbon::-webkit-scrollbar {
    height: 8px;
}

.image-gallery-ribbon::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.image-gallery-ribbon::-webkit-scrollbar-track {
    background-color: #f1f1f1;
}

.gallery-thumbnail {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: border-color 0.3s, transform 0.3s;
}

.gallery-thumbnail:hover {
    transform: scale(1.05);
}

.image-gallery-ribbon img.active {
    border-color: #007bff;
}

/* Modal de imagen a tamaño completo */
.full-image-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
}

.full-image-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    animation-name: zoom;
    animation-duration: 0.6s;
}

.full-image-close-btn {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.full-image-close-btn:hover,
.full-image-close-btn:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
}

/* Animación de zoom */
@keyframes zoom {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}
/* Sección para compartir en redes sociales dentro del modal */
.oferta-compartir {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
    text-align: center;
}

.oferta-compartir h4 {
    margin-bottom: 15px;
    color: #555;
    font-size: 16px;
}

.social-share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.social-share-buttons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.social-share-buttons a:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.share-whatsapp {
    background-color: #25d366;
}

.share-facebook {
    background-color: #1877f2;
}

.share-instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

/* Estilo para el botón de compartir de Telegram */
.share-telegram {
    background-color: #0088cc;
}

/* Estilos para el icono flotante y arrastrable */
#floating-icon-container {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    cursor: grab;
    width: 60px;
    height: 60px;
}

#floating-icon-container img {
    width: 100%;
    height: auto;
    border-radius: 50%;
    box-shadow: none;
    transition: transform 0.2s;
}

#floating-icon-container img:hover {
    transform: scale(1.1);
}