/* ==========================================================================
   PRODUCT PAGE — Estilos de la página dedicada de producto
   ========================================================================== */


/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.product-page-breadcrumbs {
    padding: 0 24px;
    margin-top: calc(var(--header-height) + 16px);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.breadcrumbs-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;

    padding: 12px 0;

    font-size: 0.82rem;
    color: var(--text-muted);
}

.breadcrumb-link {
    color: var(--text-muted);
    text-decoration: none;

    transition: color 0.25s ease;
}

.breadcrumb-link:hover {
    color: var(--sapphire);
}

.breadcrumb-link i {
    font-size: 0.75rem;
    margin-right: 4px;
}

.breadcrumb-separator {
    font-size: 0.6rem;
    color: var(--gray-200);
}

.breadcrumb-current {
    color: var(--royal-blue);
    font-weight: 600;
}


/* ==========================================================================
   PRODUCT PAGE MAIN
   ========================================================================== */

.product-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 24px 80px;
    min-height: 60vh;
}


/* ==========================================================================
   GRID LAYOUT
   ========================================================================== */

.product-page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
}


/* ==========================================================================
   IMAGE
   ========================================================================== */

.product-page-image-container {
    position: sticky;
    top: calc(var(--header-height) + 24px);

    background-color: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);

    overflow: hidden;

    aspect-ratio: 3 / 4;

    display: flex;
    align-items: center;
    justify-content: center;

    box-shadow: var(--shadow-md);
}

.product-page-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 32px;

    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-page-image:hover {
    transform: scale(1.03);
}


/* ==========================================================================
   INFO
   ========================================================================== */

.product-page-info {
    display: flex;
    flex-direction: column;
}

.product-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: .75rem;
    margin-bottom: .55rem;
}

.product-title-row .product-page-title {
    margin: 0;
    overflow-wrap: anywhere;
}

.product-page-title {
    font-family: var(--font-heading);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 700;
    color: var(--royal-blue);
    margin-bottom: 12px;
    line-height: 1.2;
}

.product-page-info .modal-category {
    margin-bottom: 12px;
}

.product-page-info .modal-price {
    font-size: 1.6rem;
    margin-bottom: 24px;
}

.product-page-info .modal-description {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 32px;
}


/* ==========================================================================
   ACCIONES DE COMPRA
   ========================================================================== */

.product-page-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
}

.product-page-actions .btn {
    min-height: 52px;
    padding-inline: 18px;
}

.product-page-add-button {
    background-color: var(--white);
    border: 1px solid var(--royal-blue);
    color: var(--royal-blue);
}

.product-page-add-button:hover {
    background-color: var(--gray-100);
    border-color: var(--sapphire);
    color: var(--sapphire);
    transform: translateY(-2px);
}

.product-page-checkout-button {
    box-shadow: 0 8px 18px rgba(17, 34, 80, 0.16);
}

.product-page-actions .btn:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}


/* ==========================================================================
   EXTRAS / FEATURES
   ========================================================================== */

.product-page-extras {
    margin-top: 32px;
    padding-top: 28px;
    border-top: 1px solid var(--gray-200);

    display: flex;
    flex-direction: column;
    gap: 16px;
}

.product-page-feature {
    display: flex;
    align-items: center;
    gap: 14px;

    font-size: 0.88rem;
    color: var(--text-muted);
}

.product-page-feature i {
    width: 36px;
    height: 36px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 8px;

    background-color: var(--gray-100);
    color: var(--sapphire);

    font-size: 0.85rem;

    flex-shrink: 0;
}


/* ==========================================================================
   LOADING STATE
   ========================================================================== */

.product-page-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    min-height: 50vh;
    color: var(--text-muted);
    font-size: 0.95rem;
}

.product-page-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--sapphire);
    border-radius: 50%;
    animation: productPageSpin 0.8s linear infinite;
}

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


/* ==========================================================================
   ERROR STATE
   ========================================================================== */

.product-page-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 50vh;
    text-align: center;
    color: var(--text-muted);
}

.product-page-error i {
    font-size: 3rem;
    color: var(--shellstone);
}

.product-page-error h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--royal-blue);
}

.product-page-error p {
    font-size: 0.95rem;
    margin-bottom: 12px;
}


/* ==========================================================================
   ANIMACIÓN DE ENTRADA
   ========================================================================== */

.product-page-loading[hidden] { display: none; }
.product-page-content[data-prerendered] :is(.product-page-actions, .quantity-group) { visibility: hidden; }

.product-page-content {
    animation: productPageFadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes productPageFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 900px) {
    .product-page-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .product-page-image-container {
        position: static;
        max-height: 500px;
    }
}

@media (max-width: 600px) {

    .product-page {
        padding: 16px 16px 64px;
    }

    .product-page-breadcrumbs {
        padding: 0 16px;
    }

    .product-page-image-container {
        border-radius: 4px;
    }

    .product-page-image {
        padding: 20px;
    }

    .product-page-extras {
        margin-top: 24px;
        padding-top: 20px;
    }

    .product-page-actions {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================================
   RELATED PRODUCTS
   ========================================================================== */

.related-products-section {
    margin-top: 64px;
    padding-top: 48px;
    border-top: 1px solid var(--gray-200);
}

.related-products-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--royal-blue);
    margin-bottom: 24px;
}

.related-products-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.related-card {
    background-color: var(--white);
    border-radius: 8px;
    border: 1px solid var(--gray-200);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.related-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.related-card-img-link {
    display: block;
    aspect-ratio: 1;
    overflow: hidden;
    background-color: var(--light-bg);
}

.related-card-img-link img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 16px;
    transition: transform 0.4s ease;
}

.related-card:hover .related-card-img-link img {
    transform: scale(1.05);
}

.related-card-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-grow: 1;
}

.related-card-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--royal-blue);
    text-decoration: none;
    line-height: 1.3;
}

.related-card-title:hover {
    color: var(--sapphire);
}

.related-card-price {
    font-size: 1rem;
    font-weight: 700;
    color: var(--sapphire);
}

@media (max-width: 900px) {
    .related-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .related-products-grid {
        grid-template-columns: 1fr;
    }
}

.product-page-media { min-width: 0; position: sticky; top: calc(var(--header-height) + 24px); }
.product-page-media .product-page-image-container { position: relative; top: auto; }
.product-variant-gallery {
    display: flex;
    gap: 8px;
    padding: 10px 1px 2px;
    overflow-x: auto;
}
.product-variant-gallery[hidden], .product-page-breadcrumbs [hidden] { display: none; }
.product-variant-gallery button {
    flex: 0 0 60px;
    overflow: hidden;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    background: var(--white);
}
.product-variant-gallery img { width: 60px; height: 60px; object-fit: contain; }
.product-variant-gallery button:focus-visible { outline: 2px solid var(--royal-blue); outline-offset: -2px; }
@media (max-width: 768px) {
    .product-page-media { position: static; }
}
