/* =============================================
   DETAIL.CSS
   Página de detalle de un producto individual.
   ============================================= */

.detail__back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.15s;
}
.detail__back:hover {
    color: var(--near-dark-green);
}

/* ── Layout principal ── */
.detail {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* ── Galería ── */
.detail__gallery {
    border-radius: 16px;
    overflow: hidden;
    background: var(--fresh-bg);
}
.detail__gallery-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}
.detail__gallery-wrapper img {
    width: 100%;
    max-height: 260px;
    object-fit: contain;
    padding: 1.25rem;
}

/* Badge de oferta/novedad superpuesto en la galería */
.detail__badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.3rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Columna de información ── */
.detail__info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Card principal con todos los datos del producto */
.detail__card {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 1.1rem;
    border-radius: 16px;
    background-color: var(--white);
    border: 1px solid var(--border-soft);
}

.detail__name-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.detail__name {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

.detail__fav-btn {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border-soft);
    border-radius: 50%;
    width: 2.2rem;
    height: 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.detail__fav-btn:hover {
    color: var(--red);
    border-color: var(--red);
    background: #fdedef;
}
.detail__fav-btn--active {
    color: var(--red);
    border-color: var(--red);
}

.detail__producer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.detail__rating {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}
.detail__rating i { color: #f5a623; }
.detail__rating-count { color: var(--text-muted); }

.detail__divider {
    height: 1px;
    background: var(--border-soft);
    margin: 0.25rem 0;
}

.detail__price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--near-dark-green);
    letter-spacing: -0.02em;
    line-height: 1;
}

.detail__expiry {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Botón de login como sustituto del formulario */
.detail__login-btn {
    margin-top: 0.5rem;
}

/* ── Formulario añadir al carrito ── */
.detail__add-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.25rem;
}

/* Selector de cantidad +/- */
.detail__qty {
    display: flex;
    align-items: stretch;
    width: fit-content;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    overflow: hidden;
}
.detail__qty-btn {
    width: 2.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.detail__qty-btn:hover { background: var(--fresh-bg); }
.detail__qty-input {
    width: 3rem;
    text-align: center;
    border: none;
    border-left: 1px solid var(--border-soft);
    border-right: 1px solid var(--border-soft);
    font-size: 1rem;
    font-weight: 600;
    padding: 0.5rem 0;
    color: var(--text-primary);
    background: var(--white);
    -moz-appearance: textfield;
}
.detail__qty-input:focus { outline: none; }
.detail__qty-input::-webkit-inner-spin-button,
.detail__qty-input::-webkit-outer-spin-button { -webkit-appearance: none; }

/* ── Enlace "Ver más de esta categoría" ── */
.detail__more-from {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-radius: 20px;
    background-color: var(--white);
    border: 1px solid var(--border-soft);
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: border-color 0.15s, color 0.15s;
}
.detail__more-from:hover {
    border-color: var(--buy-light-green);
    color: var(--near-dark-green);
}

/* ── Responsive ── */
@media (min-width: 576px) {
    .detail__gallery-wrapper {
        min-height: 280px;
    }
    .detail__gallery-wrapper img {
        max-height: 320px;
        padding: 1.5rem;
    }
    .detail__back {
        margin-bottom: 1.25rem;
    }
}

@media (min-width: 768px) {
    .detail {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    .detail__gallery {
        border-radius: 20px;
    }
    .detail__gallery-wrapper {
        min-height: 360px;
    }
    .detail__gallery-wrapper img {
        max-height: 380px;
        padding: 2rem;
    }
    .detail__card {
        padding: 1.5rem;
        border-radius: 20px;
    }
    .detail__name {
        font-size: 1.5rem;
    }
    .detail__price {
        font-size: 2rem;
    }
    .detail__back {
        margin-bottom: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .detail {
        grid-template-columns: 5fr 4fr;
        gap: 2rem;
    }
    .detail__gallery-wrapper {
        min-height: 460px;
    }
    .detail__gallery-wrapper img {
        max-height: 440px;
    }
}

/* ── Productos similares ── */
.detail__similares {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-soft);
}
.detail__similares-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
}
