/* Custom animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Hide number input spin buttons */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none !important;
    margin: 0 !important;
    display: none !important;
}

input[type="number"] {
    -moz-appearance: textfield !important;
    appearance: textfield !important;
}

/* Product card hover effects */
.product-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* NEW Badge styling */
.new-badge {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: pulseGreen 2s infinite;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.new-badge:hover {
    box-shadow: 0 4px 8px rgba(34, 197, 94, 0.4);
}

@keyframes pulseGreen {
    0% {
        box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(34, 197, 94, 0.5);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 2px 4px rgba(34, 197, 94, 0.3);
    }
}

/* SALE Badge styling */
.sale-badge {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    font-weight: 700;
    letter-spacing: 0.05em;
    animation: pulseRed 2s infinite;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sale-badge:hover {
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.4);
}

@keyframes pulseRed {
    0% {
        box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 2px 4px rgba(239, 68, 68, 0.3);
    }
}

/* Cart modal animation */
#cartModal {
    transition: opacity 0.3s ease-in-out;
}

#cartModal.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Notification animation */
.notification {
    animation: fadeIn 0.3s ease-in-out;
    min-width: 200px;
    max-width: 400px;
}

.notification.fade-out {
    animation: fadeOut 0.3s ease-in-out forwards;
}

/* Close button hover effect */
.notification button:hover {
    opacity: 0.8;
}

.notification button:active {
    transform: scale(0.95);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Quantity control styles */
.quantity-btn {
    transition: all 0.2s ease;
}

.quantity-btn:hover {
    background-color: #e5e7eb;
}

.quantity-btn:active {
    transform: scale(0.95);
}

/* Disable text selection on buttons */
.quantity-btn i {
    user-select: none;
}

/* Disabled button styles */
button[disabled],
button[aria-disabled="true"] {
    cursor: not-allowed !important;
    pointer-events: none !important;
    opacity: 0.5 !important;
}

/* Loading state */
#checkoutItems.opacity-50,
#cartItems.opacity-50 {
    transition: opacity 0.2s ease;
}

.pointer-events-none {
    pointer-events: none;
}

/* Item layout */
#checkoutItems > div {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

/* Price and controls container */
.flex-col.items-end {
    min-width: 120px;
}

/* Product card images - make them square */
.product-card img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Search result images - make them square */
#searchResults img {
    aspect-ratio: 1 / 1;
    object-fit: cover;
}

/* Main product image on product detail page - make it square */
#productImage {
    aspect-ratio: 1 / 1;
    object-fit: cover;
    width: 100%;
    height: auto;
}

/* Product image consistency */
.bg-gray-200.rounded.overflow-hidden {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    border: none;
}

/* Match cart modal image styling */
#checkoutItems .bg-gray-200.rounded.overflow-hidden {
    width: 3.6rem;  /* Matches the original template size */
    height: 3.6rem;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
}

.bg-gray-200.rounded.overflow-hidden img {
    object-fit: contain;
    width: 100%;
    height: 100%;
    padding: 0;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .product-card {
        margin-bottom: 1rem;
    }
    
    #cartModal > div {
        margin: 1rem;
    }
}

/* Product thumbnail gallery */
.product-thumbnail {
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.product-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.product-thumbnail img {
    transition: all 0.2s ease;
}

.product-thumbnail:hover img {
    opacity: 0.9;
}

/* Image modal styling */
#imageModal {
    transition: opacity 0.3s ease;
}

#imageModal.hidden {
    opacity: 0;
    pointer-events: none;
}

#modalImage {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-height: calc(100vh - 140px); /* Adjusted to account for thumbnails */
    max-width: calc(100vw - 40px);
    object-fit: contain;
}

/* Zoom control buttons */
.zoom-control {
    transition: all 0.2s ease;
    position: relative;
    z-index: 30; /* Higher than navigation buttons */
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: rgba(31, 41, 55, 0.8);
    color: white;
    border: none;
}

.zoom-control:hover {
    transform: scale(1.1);
    background-color: rgba(55, 65, 81, 0.9);
}

.zoom-control:active {
    transform: scale(0.95);
}

/* Navigation arrows */
#prevImageBtn, #nextImageBtn {
    transition: opacity 0.2s ease, background-color 0.2s ease;
    opacity: 0.7;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(31, 41, 55, 0.8);
    color: white;
    z-index: 20; /* Lower than zoom controls */
    border: none;
    outline: none;
    /* Disable all transforms on hover/active to prevent position issues */
    transform-origin: center;
}

#prevImageBtn:focus, #nextImageBtn:focus {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    outline: none;
}

#prevImageBtn {
    left: 16px;
}

#nextImageBtn {
    right: 16px;
}

#prevImageBtn:hover, #nextImageBtn:hover {
    opacity: 1;
    background-color: rgba(55, 65, 81, 0.9);
}

/* Use pseudo-element for the scale effect instead of transforming the button itself */
#prevImageBtn::after, #nextImageBtn::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    transition: transform 0.2s ease;
    transform: scale(1);
    background-color: transparent;
    z-index: -1;
}

#prevImageBtn:hover::after, #nextImageBtn:hover::after {
    transform: scale(1.1);
}

#prevImageBtn:active::after, #nextImageBtn:active::after {
    transform: scale(0.95);
}

/* Mobile optimization for zoom controls */
@media (max-width: 768px) {
    .zoom-control {
        width: 36px;
        height: 36px;
    }
    
    /* Position zoom controls higher on mobile */
    #imageModal .absolute.top-4.left-1\/2 {
        top: 16px;
    }
}

/* Modal thumbnails */
#imageModal .absolute.bottom-4.left-1\/2 {
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    padding: 8px 12px;
    border-radius: 8px;
    background-color: rgba(31, 41, 55, 0.8);
    transform: translateX(-50%);
    max-width: calc(100vw - 80px);
    overflow-x: auto;
    scrollbar-width: thin;
}

#imageModal .absolute.bottom-4.left-1\/2 button {
    transition: all 0.2s ease;
    overflow: hidden;
}

#imageModal .absolute.bottom-4.left-1\/2 button:hover {
    transform: scale(1.1);
}

#imageModal .absolute.bottom-4.left-1\/2 button img {
    transition: all 0.2s ease;
}

#imageModal .absolute.bottom-4.left-1\/2 button:hover img {
    opacity: 0.8;
}

/* Zoom cursor for product images */
.cursor-pointer {
    cursor: pointer;
}

/* Zoom effect on product image hover */
#productImage {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#productImage:hover {
    transform: scale(1.01);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Mobile optimization for navigation buttons */
@media (max-width: 768px) {
    .nav-button {
        width: 40px !important;
        height: 40px !important;
        position: fixed !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
    
    #prevImageBtn {
        left: 10px !important;
    }
    
    #nextImageBtn {
        right: 10px !important;
    }
    
    /* Ensure button touch areas are large enough */
    .nav-button i {
        pointer-events: none;
    }
    
    /* Fix for iOS touch handling */
    .nav-button:active {
        opacity: 1 !important;
    }
}

/* Invoice section styling */
#invoiceSection {
    background-color: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
    transition: all 0.3s ease;
}

#invoiceSection.hidden {
    display: none !important;
}

#separateBillingSection.hidden {
    display: none !important;
}

#separateBillingSection {
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    margin-top: 1rem;
}

/* Invoice checkbox styling */
#needInvoice {
    width: 1.125rem;
    height: 1.125rem;
    accent-color: #1e3a8a;
}

/* Invoice section animation */
#invoiceSection:not(.hidden) {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
        max-height: 0;
    }
    to {
        opacity: 1;
        transform: translateY(0);
        max-height: 1000px;
    }
}

/* Team member photo styles */
.team-member-photo {
    object-fit: cover;
    object-position: center;
    height: 350px;
    width: 100%;
    transition: transform 0.3s ease;
}

.team-member-photo:hover {
    transform: scale(1.05);
} 