/**
 * Kelles Product Cards and Modals Enhanced Styling
 * 
 * This file contains enhanced styling for product cards and modals
 * designed to work with the Kelles theme.
 */

/* ====== PRODUCT CARDS ====== */

.kelles-product-card {
    border-radius: var(--kelles-border-radius, 0.5rem);
    box-shadow: var(--kelles-shadow, 0 4px 6px rgba(32, 33, 36, 0.1));
    background: #fff;
    transition: var(--kelles-transition, all 0.3s ease);
    position: relative;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.kelles-product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px rgba(32, 33, 36, 0.12);
}

/* Product Image */
.product-image-wrapper {
    position: relative;
    overflow: hidden;
    padding-top: 100%; /* 1:1 Aspect ratio */
}

.kelles-product-card .product-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.kelles-product-card:hover .product-img {
    transform: scale(1.08);
}

/* Product Info */
.kelles-product-card .card-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.kelles-product-card .card-title {
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 1rem;
    line-height: 1.4;
}

.kelles-product-card .card-title a {
    color: var(--kelles-dark, #202124);
    text-decoration: none;
    transition: color 0.3s ease;
}

.kelles-product-card .card-title a:hover {
    color: var(--kelles-primary, #4285f4);
}

/* Product Price */
.kelles-product-card .price-wrapper {
    margin-top: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.kelles-product-card .current-price {
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--kelles-primary, #4285f4);
}

.kelles-product-card .old-price {
    text-decoration: line-through;
    color: #70757a;
    font-size: 0.875rem;
}

/* Discount Badge */
.kelles-product-card .discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--kelles-accent, #ea4335);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--kelles-border-radius, 0.5rem);
    z-index: 2;
}

/* New Product Badge */
.kelles-product-card .new-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: var(--kelles-secondary, #34a853);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: var(--kelles-border-radius, 0.5rem);
    z-index: 2;
}

/* ====== PRODUCT ACTIONS ====== */

/* Wishlist Button */
.wishlist-btn,
.wishlist-toggle,
.btn-wishlist {
    background: none;
    border: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 5px rgba(32, 33, 36, 0.15);
    z-index: 5;
    transition: var(--kelles-transition, all 0.3s ease);
    cursor: pointer;
}

.wishlist-btn:hover,
.wishlist-toggle:hover,
.btn-wishlist:hover {
    transform: scale(1.1);
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(32, 33, 36, 0.2);
}

.wishlist-btn i,
.wishlist-toggle i,
.btn-wishlist i {
    font-size: 18px;
    color: #70757a;
    transition: var(--kelles-transition, all 0.3s ease);
}

.wishlist-btn.in-wishlist i,
.wishlist-toggle.in-wishlist i,
.btn-wishlist.in-wishlist i,
.wishlist-btn i.filled,
.wishlist-toggle i.filled,
.btn-wishlist i.filled {
    color: var(--kelles-accent, #ea4335) !important;
}

/* Actions Overlay */
.product-actions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2;
}

.kelles-product-card:hover .product-actions-overlay {
    opacity: 1;
    visibility: visible;
}

/* Quick View Button */
.quick-view-btn,
.quick-shop-btn,
.btn-quickview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--kelles-primary, #4285f4);
    color: white;
    border: none;
    margin: 0 0.25rem;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
}

.kelles-product-card:hover .quick-view-btn,
.kelles-product-card:hover .quick-shop-btn,
.kelles-product-card:hover .btn-quickview {
    transform: translateY(0);
    opacity: 1;
}

.quick-view-btn:hover,
.quick-shop-btn:hover,
.btn-quickview:hover {
    background-color: var(--kelles-dark, #202124);
    transform: scale(1.1);
}

.kelles-product-card:hover .quick-shop-btn {
    transition-delay: 0.1s;
}

/* Add to Cart Button */
.add-to-cart-btn,
.btn-cart {
    padding: 0.5rem 1rem;
    border-radius: var(--kelles-border-radius, 0.5rem);
    background-color: var(--kelles-primary, #4285f4);
    color: white;
    border: none;
    font-weight: 500;
    transition: var(--kelles-transition, all 0.3s ease);
}

.add-to-cart-btn:hover,
.btn-cart:hover {
    background-color: var(--kelles-dark, #202124);
    transform: translateY(-2px);
}

.add-to-cart-btn.loading,
.btn-cart.loading {
    pointer-events: none;
    opacity: 0.8;
}

/* Mobile Actions */
.product-actions-mobile {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    z-index: 3;
    display: none;
}

@media (max-width: 991.98px) {
    .product-actions-mobile {
        display: block;
    }

    .product-actions-overlay {
        display: none;
    }
}

/* ====== QUICK VIEW MODAL ====== */

.quick-view-modal .modal-content {
    border-radius: var(--kelles-border-radius, 0.5rem);
    overflow: hidden;
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.quick-view-modal .modal-header {
    border-bottom: none;
    padding: 1rem;
}

.quick-view-modal .modal-body {
    padding: 0;
}

.quick-view-modal .btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 1050;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    opacity: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.quick-view-modal .btn-close:hover {
    transform: rotate(90deg);
}

/* Product Gallery */
.quick-view-modal .product-gallery {
    position: relative;
    height: 100%;
}

.quick-view-modal .swiper {
    width: 100%;
    height: 100%;
}

.quick-view-modal .swiper-slide {
    position: relative;
    overflow: hidden;
}

.quick-view-modal .swiper-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quick-view-modal .swiper-pagination-bullet {
    background-color: var(--kelles-primary, #4285f4);
}

.quick-view-modal .swiper-button-next,
.quick-view-modal .swiper-button-prev {
    color: var(--kelles-primary, #4285f4);
}

/* Product Details */
.quick-view-modal .product-details {
    padding: 2rem;
    height: 100%;
    overflow-y: auto;
}

.quick-view-modal .product-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--kelles-dark, #202124);
}

.quick-view-modal .product-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--kelles-primary, #4285f4);
    margin-bottom: 1rem;
}

.quick-view-modal .product-description {
    color: #70757a;
    margin-bottom: 1.5rem;
}

/* Quantity Controls */
.quantity,
.input-step {
    display: flex;
    align-items: center;
    border: 1px solid #dee2e6;
    border-radius: var(--kelles-border-radius, 0.5rem);
    overflow: hidden;
    width: fit-content;
    height: 40px;
}

.quantity input,
.input-step input {
    border: none;
    width: 50px;
    text-align: center;
    font-weight: 500;
    background: transparent;
}

.quantity .minus,
.quantity .plus,
.input-step .minus,
.input-step .plus {
    width: 40px;
    height: 100%;
    background: #f8f9fa;
    border: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.quantity .minus:hover,
.quantity .plus:hover,
.input-step .minus:hover,
.input-step .plus:hover {
    background-color: #e9ecef;
}

/* Loading Animation */
@keyframes spinner {
    to {transform: rotate(360deg);}
}
 
.loading-spinner:before {
    content: '';
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin-top: -10px;
    margin-left: -10px;
    border-radius: 50%;
    border: 2px solid #fff;
    border-top-color: var(--kelles-primary, #4285f4);
    animation: spinner .6s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

.kelles-toast {
    background-color: white;
    border-radius: var(--kelles-border-radius, 0.5rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem;
    margin-bottom: 0.75rem;
    max-width: 350px;
    display: flex;
    align-items: center;
    animation: slide-in-right 0.3s ease;
}

.kelles-toast.success {
    border-left: 4px solid var(--kelles-secondary, #34a853);
}

.kelles-toast.error {
    border-left: 4px solid var(--kelles-accent, #ea4335);
}

.kelles-toast.info {
    border-left: 4px solid var(--kelles-primary, #4285f4);
}

.kelles-toast .icon {
    margin-right: 10px;
    font-size: 20px;
}

.kelles-toast.success .icon {
    color: var(--kelles-secondary, #34a853);
}

.kelles-toast.error .icon {
    color: var(--kelles-accent, #ea4335);
}

.kelles-toast.info .icon {
    color: var(--kelles-primary, #4285f4);
}

.kelles-toast .message {
    flex: 1;
}

.kelles-toast .close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #70757a;
    margin-left: 10px;
    transition: color 0.3s ease;
}

.kelles-toast .close:hover {
    color: var(--kelles-dark, #202124);
}

@keyframes slide-in-right {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Animation Classes */
.animate-heartbeat {
    animation: heartbeat 1.5s ease-in-out;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

.animate-shake {
    animation: shake 0.82s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}

.animate-fade-in {
    animation: fade-in 0.3s ease-in;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade-out {
    animation: fade-out 0.3s ease-out;
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Responsive adjustments */
@media (max-width: 767.98px) {
    .quick-view-modal .product-details {
        padding: 1rem;
    }
    
    .quick-view-modal .product-title {
        font-size: 1.25rem;
    }
    
    .kelles-product-card .card-body {
        padding: 0.75rem;
    }
}
