/* ========================================
   AWESOME HOME PRODUCT MODAL
   Beautiful, Modern Design for Both Mobile & Desktop
   ======================================== */

/* Modal Backdrop Enhancement */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Modal Dialog */
#productModal .modal-dialog {
    max-width: 900px;
    margin: 2rem auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#productModal.show .modal-dialog {
    transform: scale(1) translateY(0);
}

#productModal .modal-dialog {
    transform: scale(0.9) translateY(-50px);
}

/* Modal Content */
#productModal .modal-content {
    border: none;
    border-radius: 20px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.25),
        0 10px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    position: relative;
}

#productModal .modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
    z-index: 1;
}

/* Modal Header (Custom) */
.product-modal-header {
    position: relative;
    padding: 0;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    overflow: hidden;
}

.product-modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.product-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 2;
}

.product-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.product-modal-close i {
    font-size: 1.1rem;
}

/* Modal Body */
#productModal .modal-body {
    padding: 0;
    position: relative;
}

/* Product Content */
.product-modal-content {
    padding: 2rem;
}

/* Product Image Section */
.product-image-section {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 2rem;
    border-radius: 0 0 20px 20px;
    margin: 0 -2rem 2rem -2rem;
}

.product-image-container {
    position: relative;
    text-align: center;
}

.product-main-image {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease;
}

.product-main-image:hover {
    transform: scale(1.05);
}

/* Image Gallery */
.product-image-gallery {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.product-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.product-thumbnail:hover,
.product-thumbnail.active {
    border-color: #28a745;
    opacity: 1;
    transform: scale(1.1);
}

/* Product Info */
.product-info {
    position: relative;
}

.product-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: 0.5rem;
}

.product-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #28a745, #20c997);
    border-radius: 2px;
}

.product-category {
    display: inline-block;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    color: #28a745;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    border: 2px solid rgba(40, 167, 69, 0.2);
}

.product-description {
    font-size: 1rem;
    line-height: 1.6;
    color: #6c757d;
    margin-bottom: 1.5rem;
}

/* Best Seller Badge */
.bestseller-badge {
    position: absolute;
    top: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ffc107 0%, #ff8f00 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Loading State */
.product-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    text-align: center;
}

.product-loading .spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
    margin-bottom: 1rem;
}

.product-loading-text {
    color: #6c757d;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Error State */
.product-error {
    text-align: center;
    padding: 3rem 2rem;
    color: #6c757d;
}

.product-error i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #dc3545;
}

.product-error h5 {
    margin-bottom: 0.5rem;
    color: #495057;
}

/* Modal Footer Enhancement */
#productModal .modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 0 0 20px 20px;
}

#productModal .modal-footer .btn {
    border-radius: 25px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

#productModal .modal-footer .btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#productModal .modal-footer .btn:hover::before {
    width: 300px;
    height: 300px;
}

#productModal .modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

/* Carousel Enhancement */
.product-carousel {
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.product-carousel .carousel-item img {
    width: 100%;
    height: 300px;
    object-fit: contain;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.product-carousel .carousel-control-prev,
.product-carousel .carousel-control-next {
    width: 50px;
    height: 50px;
    background: rgba(40, 167, 69, 0.8);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.8;
    transition: all 0.3s ease;
}

.product-carousel .carousel-control-prev {
    left: 15px;
}

.product-carousel .carousel-control-next {
    right: 15px;
}

.product-carousel .carousel-control-prev:hover,
.product-carousel .carousel-control-next:hover {
    opacity: 1;
    transform: translateY(-50%) scale(1.1);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    #productModal .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    #productModal .modal-content {
        border-radius: 15px;
    }
    
    .product-modal-content {
        padding: 1.5rem;
    }
    
    .product-image-section {
        padding: 1.5rem;
        margin: 0 -1.5rem 1.5rem -1.5rem;
        border-radius: 0 0 15px 15px;
    }
    
    .product-main-image {
        max-height: 250px;
    }
    
    .product-title {
        font-size: 1.5rem;
    }
    
    .product-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .product-image-gallery {
        gap: 0.5rem;
    }
    
    #productModal .modal-footer {
        padding: 1rem 1.5rem;
    }
    
    #productModal .modal-footer .btn {
        padding: 0.625rem 1.5rem;
        font-size: 0.9rem;
    }
    
    .bestseller-badge {
        top: -5px;
        right: -5px;
        padding: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .product-carousel .carousel-control-prev,
    .product-carousel .carousel-control-next {
        width: 40px;
        height: 40px;
    }
}

/* Small Mobile */
@media (max-width: 480px) {
    #productModal .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .product-modal-content {
        padding: 1rem;
    }
    
    .product-image-section {
        padding: 1rem;
        margin: 0 -1rem 1rem -1rem;
    }
    
    .product-main-image {
        max-height: 200px;
    }
    
    .product-title {
        font-size: 1.25rem;
    }
    
    .product-thumbnail {
        width: 45px;
        height: 45px;
    }
}

/* Animation for modal entrance */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-50px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#productModal.show .modal-content {
    animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    #productModal .modal-dialog,
    #productModal .modal-content,
    .product-main-image,
    .product-thumbnail,
    .bestseller-badge {
        animation: none !important;
        transition: none !important;
    }
}

/* Print styles */
@media print {
    #productModal {
        display: none !important;
    }
}