/* Product Detail Page Cart Controls - Complete Rewrite */

/* Reset and base styles */
.product-form {
    width: 100%;
    margin: 2rem 0;
    position: relative;
}

.product-form * {
    box-sizing: border-box;
}

/* Size Selection Section */
.size-selection {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.size-selection .form-group {
    margin-bottom: 0;
}

.size-selection label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 16px;
}

.size-selection select.form-control {
    width: 100%;
    padding: 12px 15px;
    font-size: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #333;
    cursor: pointer;
    appearance: auto;
}

.size-selection select.form-control:focus {
    outline: none;
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

/* Dynamic Price Display (created by JS) */
.size-selection .dynamic-price,
.dynamic-price-display {
    margin-top: 15px;
    padding: 10px 0;
    clear: both;
}

.size-selection .dynamic-price .price-label,
.dynamic-price-display .price-label {
    font-weight: 600;
    color: #333;
    margin-right: 5px;
}

.size-selection .dynamic-price .price-amount,
.dynamic-price-display .price-amount {
    font-size: 1.5rem;
    font-weight: 700;
    color: #28a745;
}

/* Quantity Section */
.quantity-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.quantity-selector label {
    font-weight: 600;
    color: #333;
    margin: 0;
    font-size: 16px;
}

.quantity-controls {
    display: flex;
    align-items: center;
    border: 2px solid #ddd;
    border-radius: 6px;
    background: white;
}

.quantity-btn {
    width: 35px;
    height: 40px;
    border: none;
    background: #f8f9fa;
    color: #666;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.quantity-btn:hover {
    background: #e9ecef;
    color: #333;
}

#quantity {
    width: 60px;
    height: 40px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    background: white;
    color: #333;
}

#quantity:focus {
    outline: none;
    background: #f8f9fa;
}

/* Product Actions */
.buttons-features-row {
    margin-top: 1.5rem;
    clear: both;
}

.product-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
}

.product-actions .btn-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.product-actions .btn-row:first-child .btn {
    padding: 10px 18px;
    font-size: 14px;
}

.product-actions .btn-row:last-child .btn {
    padding: 8px 16px;
    font-size: 13px;
}

.add-to-cart-btn,
.buy-now-btn,
.wishlist-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    min-height: 45px;
}

.add-to-cart-btn {
    background: #007bff;
    color: white;
    flex: 1;
    min-width: 130px;
    max-width: 220px;
}

.add-to-cart-btn:hover {
    background: #0056b3;
    color: white;
}

.buy-now-btn {
    background: #28a745;
    color: white;
    flex: 1;
    min-width: 110px;
    max-width: 220px;
}

.buy-now-btn:hover {
    background: #1e7e34;
    color: white;
}

.wishlist-btn {
    background: white;
    color: #6c757d;
    border: 2px solid #6c757d;
    flex: 0 0 auto;
    min-width: 160px;
}

.wishlist-btn:hover {
    background: #6c757d;
    color: white;
}

.notify-btn {
    background: #ffc107;
    color: #212529;
    flex: 0 0 auto;
    min-width: 160px;
}

.notify-btn:hover {
    background: #e0a800;
    color: #212529;
}

/* Responsive Design */
@media (max-width: 768px) {
    .product-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .add-to-cart-btn,
    .buy-now-btn,
    .wishlist-btn {
        max-width: none;
        width: 100%;
    }
    
    .quantity-controls {
        justify-content: center;
    }
}

/* Login and Professional States */
.login-to-purchase {
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 2rem 0;
}

.login-to-purchase .alert {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 6px;
    color: #0c5460;
}

.professional-note {
    background: #fff3cd;
    padding: 1.5rem;
    border-radius: 8px;
    margin: 2rem 0;
    text-align: center;
    border: 1px solid #ffeaa7;
}

.pro-badge {
    display: inline-block;
    background: #dc3545;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    margin-bottom: 1rem;
}

/* ===== ENHANCED PRODUCT IMAGES ===== */

/* Main Product Gallery */
.product-main-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: #f8f9fa;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.product-main-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
}

.product-main-image-large {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.product-main-image-large .main-product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
    border-radius: 8px;
}

.product-main-image-container:hover .main-product-img {
    transform: scale(1.05);
}

/* Product Badges */
.product-badges {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.product-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.product-badge.sale {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

.product-badge.featured {
    background: linear-gradient(135deg, #4834d4, #686de0);
}

.product-badge.bestseller {
    background: linear-gradient(135deg, #ffa502, #ff9f43);
}

/* Related Products Enhancement */
.related-products .product-image-container {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
    transition: all 0.3s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.related-products .product-image-container:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.related-products .product-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 75%; /* 4:3 Aspect Ratio */
    overflow: hidden;
}

.related-products .product-image-large {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
}

.related-products .product-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
}

.related-products .product-image-container:hover .product-img {
    transform: scale(1.08);
}

/* Product Actions */
.related-products .product-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.related-products .product-image-container:hover .product-actions {
    opacity: 1;
}

.related-products .quick-view-btn,
.related-products .add-to-cart-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
}

.related-products .quick-view-btn:hover,
.related-products .add-to-cart-btn:hover {
    background: #2c3e50;
    color: white;
    transform: scale(1.1);
}

/* Thumbnail Gallery */
.product-thumbnails {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.thumbnail-item {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.thumbnail-item:hover,
.thumbnail-item.active {
    border-color: #2c3e50;
    transform: scale(1.05);
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Legacy Support */
.product-main-image {
    /* Fallback for legacy structure */
    position: relative;
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background-color: #f8f9fa;
}

.product-main-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Responsive Design for Images */
@media (max-width: 768px) {
    .product-main-image-wrapper {
        padding-bottom: 85%; /* Slightly taller on mobile */
    }
    
    .product-main-image-large {
        padding: 10px;
    }
    
    .related-products .product-image-wrapper {
        padding-bottom: 85%;
    }
    
    .related-products .product-actions {
        position: static;
        opacity: 1;
        flex-direction: row;
        justify-content: center;
        margin-top: 10px;
        padding: 0 10px;
    }
    
    .thumbnail-item {
        width: 60px;
        height: 60px;
    }
}

@media (max-width: 480px) {
    .product-main-image-wrapper {
        padding-bottom: 90%;
    }
    
    .product-badges {
        top: 10px;
        left: 10px;
    }
    
    .product-badge {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
}