/* ===================================
   PRODUCT DETAIL PAGE STYLES - COMPACT & RED
   =================================== */

.product-detail-page {
    padding: 1.5rem 0;
    max-width: 1000px;
    margin: 0 auto;
    animation: fadeIn 0.3s ease-out;
    position: relative;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Close Button - TOP RIGHT, ALWAYS VISIBLE */
.btn-close-detail {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #E63946;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(230, 57, 70, 0.3);
}

.btn-close-detail:hover {
    background: #D62839;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.5);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-right: 50px;
    font-size: 0.85rem;
    color: #64748b;
}

.breadcrumb a {
    color: #E63946;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb a:hover {
    color: #D62839;
    text-decoration: underline;
}

.breadcrumb span {
    color: #94a3b8;
}

/* Product Detail Container - COMPACT RECTANGULAR LAYOUT */
.product-detail-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 2rem;
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* Product Image Gallery */
.product-detail-image {
    position: relative;
    max-width: 100%;
}

.image-gallery-container {
    position: relative;
    width: 100%;
    max-width: 100%;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    background: #f8f9fa;
}

.image-gallery {
    display: flex;
    transition: transform 0.3s ease;
    height: 100%;
    width: 100%;
}

.gallery-image {
    min-width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
}

.gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(230, 57, 70, 0.9);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.gallery-nav:hover {
    background: #E63946;
    transform: translateY(-50%) scale(1.1);
}

.gallery-nav.prev {
    left: 10px;
}

.gallery-nav.next {
    right: 10px;
}

.gallery-indicators {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 10;
}

.gallery-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-indicator.active {
    background: #E63946;
    width: 24px;
    border-radius: 4px;
}

.product-detail-image .img-placeholder {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #E63946 0%, #D62839 100%);
    border-radius: 8px;
    font-size: 6rem;
}

/* Product Info */
.product-detail-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.product-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0;
    line-height: 1.3;
}

/* Category and Subcategory */
.product-category-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #64748b;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.product-category-info i {
    font-size: 0.85rem;
}

.product-brand {
    color: #64748b;
    font-size: 0.9rem;
}

.product-brand strong {
    color: #E63946;
}

/* Price */
.product-detail-price {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.product-detail-price .current-price {
    font-size: 2rem;
    font-weight: 700;
    color: #E63946;
}

.product-detail-price .old-price {
    font-size: 1.25rem;
    color: #94a3b8;
    text-decoration: line-through;
}

.product-detail-price .discount-badge {
    background: #E63946;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* Stock Status */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    width: fit-content;
}

.stock-status.in-stock {
    background: #d1fae5;
    color: #065f46;
}

.stock-status.low-stock {
    background: #fff3cd;
    color: #856404;
}

.stock-status.out-of-stock {
    background: #fee2e2;
    color: #991b1b;
}

/* Description */
.product-detail-description {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.product-detail-description h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: #1e293b;
    font-weight: 600;
}

.product-detail-description p {
    color: #64748b;
    line-height: 1.6;
    font-size: 0.9rem;
}

/* Actions */
.product-detail-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
}

.qty-btn {
    background: white;
    border: none;
    padding: 0.75rem 1rem;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.qty-btn:hover {
    background: #f8fafc;
    color: #E63946;
}

.qty-input {
    border: none;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    padding: 0.75rem;
    width: 50px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

.qty-input:focus {
    outline: none;
}

.product-detail-actions .btn-add-cart {
    flex: 1;
    background: #E63946;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.product-detail-actions .btn-add-cart:hover {
    background: #D62839;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(230, 57, 70, 0.3);
}

.product-detail-actions .btn-wishlist {
    background: white;
    border: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
}

.product-detail-actions .btn-wishlist:hover {
    border-color: #E63946;
    color: #E63946;
}

.product-detail-actions .btn-wishlist.active {
    background: #E63946;
    border-color: #E63946;
    color: white;
}

/* Share Buttons */
.product-share {
    border-top: 1px solid #e2e8f0;
    padding-top: 1rem;
}

.product-share h4 {
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    gap: 0.75rem;
}

.share-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.twitter {
    background: #1da1f2;
}

.share-btn.whatsapp {
    background: #25d366;
}

.share-btn.copy-link {
    background: #64748b;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* ===================================
   RESPONSIVE
   =================================== */

@media (max-width: 768px) {
    .product-detail-page {
        padding: 1rem;
        max-width: 100%;
    }
    
    .btn-close-detail {
        top: 0;
        right: 0;
    }
    
    .product-detail-container {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
        max-width: 100%;
    }
    
    /* IMAGEN: Asegurar que no se salga del contenedor */
    .product-detail-image {
        max-width: 100%;
        overflow: hidden;
    }
    
    .image-gallery-container {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 400px;
    }
    
    .image-gallery {
        width: 100%;
        max-width: 100%;
    }
    
    .gallery-image {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: 400px;
        object-fit: contain;
    }
    
    .product-detail-image .img-placeholder {
        max-width: 100%;
        height: auto;
        max-height: 400px;
        font-size: 4rem;
    }
    
    .product-detail-title {
        font-size: 1.25rem;
    }
    
    .product-detail-price .current-price {
        font-size: 1.75rem;
    }
    
    .product-detail-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .quantity-selector {
        width: 100%;
        justify-content: space-between;
    }
    
    .product-detail-actions .btn-add-cart {
        width: 100%;
    }
    
    .product-detail-actions .btn-wishlist {
        width: 100%;
        justify-content: center;
        display: flex;
    }
}

/* ===================================
   REGLAS GLOBALES PARA IMÁGENES EN MÓVIL
   =================================== */

@media (max-width: 768px) {
    /* Evitar que CUALQUIER imagen se salga de su contenedor */
    img {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Contenedores de imágenes */
    .product-detail-page img,
    .product-card img,
    .image-gallery img {
        max-width: 100% !important;
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }
    
    /* Asegurar que los contenedores padre también respeten el límite */
    .product-detail-page,
    .product-detail-container,
    .product-card {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
}

