/* assets/css/pages/featured_products.css */

/* ==========================================
   FEATURED PRODUCTS PAGE
   ========================================== */
.featured-page {
    min-height: 60vh;
}

/* ==========================================
   SEARCH ENGINE
========================================== */
.search {
    margin-top: 25px;
    margin-bottom: 30px;
}

.search-bar {
    display: flex;
    align-items: stretch;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0;
    background: transparent;
    border: none;
}

.search-bar input {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 46px;
    padding: 0 15px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 8px;
    outline: none;
    box-sizing: border-box;
}

.search-bar input:focus {
    border-color: #004d40;
    box-shadow: 0 0 8px rgba(0, 77, 64, 0.5);
}

.search-bar button {
    height: 46px;
    padding: 0 20px;
    background-color: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 16px;
    transition: background-color 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
    box-sizing: border-box;
}

.search-bar button:hover {
    background-color: #5a6268;
}

/* Botón de búsqueda */
#search-button {
    background: #00796b;
}

#search-button:hover {
    background: #004d40;
}

/* ==========================================
   FILTERS
   ========================================== */
.filters {
    background-color: #e0f2f1;
    border-radius: 8px;
    padding: 1.5rem;
    margin: 15px auto 0;
    width: 100%;
    max-width: 1000px;
    box-sizing: border-box;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.05);
}

.filters.hidden {
    display: none;
}

.filters h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #004d40;
    font-size: 1.1rem;
}

.filters-grid {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filters-super h4,
.filters-tags h4,
.filters-sort h4 {
    margin-top: 0;
    margin-bottom: 0.8rem;
    color: #004d40;
    font-size: 1rem;
    font-weight: 600;
}

.filters-super {
    flex: 1 1 320px;
}

.filters-tags {
    flex: 1 1 280px;
}

.filters-sort {
    flex: 1 1 180px;
}

.options-group.super-grid,
.options-group.tags-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
}

.options-group.super-grid label,
.options-group.tags-grid label {
    flex: 1 1 calc(50% - 1rem);
    box-sizing: border-box;
}

.options-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.options-group label {
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #000;
    padding-left: 5px;
    white-space: nowrap;
}

.filters input[type="checkbox"],
.filters input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #00796b;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
}

.btn-filter {
    display: block;
    margin: 1.5rem auto 0;
    background: #00796b;
    color: #fff;
    border: none;
    padding: 0.7rem 1.8rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.3s ease;
}

.btn-filter:hover {
    background: #004d40;
}

.hidden {
    display: none !important;
}

/* =========================================
   BOTÓN VOLVER ARRIBA
========================================= */
#btn-scroll-up {
    display: none;
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #00796b;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.8rem;
    cursor: pointer;
    z-index: 999;
}

#btn-scroll-up:hover {
    background: #004d40;
}

#btn-scroll-up:active {
    background: #00796b;
}

#btn-scroll-up img {
    display: block;
    width: 28px;
    height: 28px;
    filter: invert(1);
}

/* ==========================================
   PAGE HEADER
   ========================================== */
.featured-products-section {
    margin-top: 35px;
    margin-bottom: 50px;
}

.featured-products-header {
    margin-bottom: 25px;
}

.featured-products-header h1 {
    color: #000000;
    font-size: 1.8rem;
    margin: 0 0 8px;
}

.featured-products-header p {
    color: #555;
    font-size: 1rem;
    margin: 0;
    line-height: 1.5;
}


/* ==========================================
   FEATURED PRODUCTS GRID
   ========================================== */
.featured-products-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
    width: 100%;
}

/*
   The original offer-box is designed for horizontal
   scrolling in index.html. Override its fixed width here.
*/
.featured-products-grid .offer-box {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: initial;
    box-sizing: border-box;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.featured-products-grid .offer-box:hover {
    transform: translateY(-3px);
}

.featured-products-grid .image-container {
    position: relative;
    display: block;
}

.featured-products-grid .offer-box img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    border-radius: 8px;
    margin: 0 auto 10px;
}

.featured-products-grid .box-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.featured-products-grid .box h3 {
    font-size: 1.1rem;
    margin-bottom: 5px;
    color: #222;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 2.8rem;
}

.featured-products-grid .box p {
    margin-bottom: 5px;
    color: #555;
    font-size: 0.95rem;
}

.featured-products-grid .box-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
}

.featured-products-grid .add-to-list {
    margin-top: 10px;
    background: #00796b;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s ease;
}

.featured-products-grid .add-to-list:hover {
    background: #004d40;
}


/* ==========================================
   DISCOUNT BADGES
   ========================================== */
.badge-container {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 10;
}

.price-drop-badge {
    background-color: #16a34a;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.old-price {
    text-decoration: line-through;
    color: #9ca3af;
    font-size: 0.9rem;
    font-weight: 500;
}

.new-price {
    color: #111827;
    font-size: 1rem;
    font-weight: 800;
}


/* ==========================================
   PRODUCT TAGS
   ========================================== */
.card-tags {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 10;
}

.card-tag-icon {
    background-color: rgba(241, 248, 233, 0.95);
    border: 1px solid #c5e1a5;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.card-tag-icon:hover {
    transform: scale(1.1);
}


/* ==========================================
   LOADING AND MESSAGES
   ========================================== */
.spinner-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    color: #004d40;
    padding: 35px 0;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #00796b;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

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

.featured-message {
    text-align: center;
    color: #555;
    padding: 25px 10px;
    font-size: 1rem;
}


/* ==========================================
   RESPONSIVE DESIGN
   ========================================== */
@media (max-width: 1100px) {
    .featured-products-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .search-bar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .search-bar input {
        flex: 0 0 100%;
        order: 1;
    }

    .btn-return {
        order: 0;
        flex: 1;
    }

    #search-button {
        order: 2;
        flex: 1;
    }

    #toggle-filters {
        order: 3;
        flex: 1;
    }

    .filters-grid {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .filters-super,
    .filters-tags,
    .filters-sort {
        flex: none;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .options-group,
    .options-group.super-grid,
    .options-group.tags-grid {
        gap: 0.3rem;
        margin-bottom: 0.5rem;
    }

    .featured-products-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 15px;
    }

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

    .featured-products-grid .offer-box {
        padding: 0.8rem;
    }

    .featured-products-grid .offer-box img {
        height: 130px;
    }

    .featured-products-grid .box h3 {
        font-size: 1rem;
    }

    .featured-products-grid .box p {
        font-size: 0.85rem;
    }
}

@media (max-width: 420px) {
    .featured-products-grid {
        gap: 10px;
    }

    .featured-products-grid .offer-box {
        padding: 0.6rem;
    }

    .featured-products-grid .offer-box img {
        height: 110px;
    }

    .featured-products-grid .add-to-list {
        padding: 7px 12px;
        font-size: 0.8rem;
    }
}