/**
 * Product Page Styles
 * File: /p/styles.css
 * Version: 3.2
 * Description: Separated styles for product page
 */

/* Gallery Carousel Styles */
.gallery-carousel {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.gallery-main-image {
    position: relative;
    width: 100%;
    aspect-ratio: 5/2; /* Desktop: 5/2 ratio */
    background: #f3f4f6;
    border-radius: 23px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12), 0 4px 6px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.3s ease;
    cursor: pointer;
}

.gallery-main-image:hover {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15), 0 5px 10px rgba(0, 0, 0, 0.1);
}

.gallery-slider {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    transition: transform 0.4s ease;
}

.gallery-slide {
    min-width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Arrow Navigation */
.gallery-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 10;
    font-size: 18px;
    color: white;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.gallery-arrow:hover {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.gallery-arrow.prev {
    left: 20px;
}

.gallery-arrow.next {
    right: 20px;
}

.gallery-arrow.show {
    opacity: 1;
    visibility: visible;
}

/* Dark overlay for better contrast */
.gallery-arrow::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

/* Carousel Indicators */
.carousel-indicators {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot:hover {
    background: #94a3b8;
}

.carousel-dot.active {
    width: 24px;
    border-radius: 4px;
    background: #3b82f6;
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    cursor: default;
}

.lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 40px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

/* Quantity Selector Styles - Light Mode Default */
.quantity-selector {
    display: flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    width: fit-content;
}

.quantity-selector button {
    width: 44px;
    height: 44px;
    border: none;
    background: #f9fafb;
    color: #6b7280;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-selector button:hover:not(:disabled) {
    background: #3b82f6;
    color: white;
}

.quantity-selector button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.quantity-selector input {
    width: 80px;
    height: 44px;
    border: none;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    background: white;
}

.quantity-selector input:focus {
    outline: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    .gallery-main-image {
        aspect-ratio: 3/2; /* Mobile: 3/2 ratio */
        border-radius: 16px;
    }
    
    .gallery-arrow {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .gallery-arrow.prev {
        left: 12px;
    }
    
    .gallery-arrow.next {
        right: 12px;
    }
    
    /* Trust badges stacked for mobile */
    .trust-badges-mobile {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        padding-top: 1rem;
        border-top: 1px solid #e5e7eb;
    }
    
    .trust-badges-mobile .trust-badge {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
    }
    
    .trust-badges-desktop {
        display: none;
    }
    
    /* Security badges stacked for mobile */
    .security-badges-mobile {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
        margin-top: 1rem;
    }
    
    .security-badges-mobile .security-badge {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 0.875rem;
    }
    
    .security-badges-desktop {
        display: none;
    }
}

/* Desktop styles */
@media (min-width: 769px) {
    .trust-badges-mobile {
        display: none;
    }
    
    .trust-badges-desktop {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
    }
    
    .security-badges-mobile {
        display: none;
    }
    
    .security-badges-desktop {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
    }
}

/* Related Products Styles */
@media (min-width: 768px) {
    .grid.md\:grid-cols-4 {
        max-width: 100%;
    }
    
    .grid.md\:grid-cols-4 .aspect-square {
        max-height: 150px;
    }
}

@media (min-width: 1024px) {
    .grid.md\:grid-cols-4 .aspect-square {
        max-height: 140px;
    }
}

@media (min-width: 1280px) {
    .grid.md\:grid-cols-4 {
        gap: 1rem;
    }
    
    .grid.md\:grid-cols-4 .aspect-square {
        max-height: 130px;
    }
}

@media (max-width: 767px) {
    .grid.grid-cols-2 > a {
        padding: 0.75rem;
    }
    
    .grid.grid-cols-2 .aspect-square {
        margin-bottom: 0.5rem;
    }
}

.grid > a {
    display: flex;
    flex-direction: column;
}

.grid > a > div:last-child {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

/* Dark mode adjustments - Only applies when user has dark mode preference */
@media (prefers-color-scheme: dark) {
    .dark .quantity-selector {
        background: #1f2937;
        border-color: #374151;
    }
    
    .dark .quantity-selector button {
        background: #374151;
        color: #9ca3af;
    }
    
    .dark .quantity-selector button:hover:not(:disabled) {
        background: #3b82f6;
        color: white;
    }
    
    .dark .quantity-selector input {
        background: #1f2937;
        color: #f3f4f6;
    }
}

/* Line clamp utility for related products */
.line-clamp-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: .5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Spin animation for loading */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Stock status indicators */
.stock-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all 0.2s;
}

.stock-status.in-stock {
    background-color: #10b981;
    color: white;
}

.stock-status.limited {
    background-color: #f59e0b;
    color: white;
}

.stock-status.low {
    background-color: #ef4444;
    color: white;
}

.stock-status.out-of-stock {
    background-color: #6b7280;
    color: white;
}

/* Urgency message styles */
.urgency-message {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #f59e0b;
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    animation: slideDown 0.3s ease;
}

.urgency-message.warning {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: #ef4444;
    color: #991b1b;
}

.urgency-message.info {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border-color: #3b82f6;
    color: #1e3a8a;
}

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

/* Loading overlay for AJAX requests */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Toast notification styles */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 250px;
    max-width: 400px;
    pointer-events: auto;
    animation: slideInRight 0.3s ease;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.warning {
    border-left: 4px solid #f59e0b;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Payment processing button states */
.btn-processing {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn-processing::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

/* Real-time stock update animation */
.stock-update {
    animation: stockPulse 0.5s ease;
}

@keyframes stockPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
        background-color: rgba(59, 130, 246, 0.1);
    }
}

/* Payment method selection enhancement */
.payment-method-card {
    position: relative;
    transition: all 0.2s;
}

.payment-method-card.selected {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.payment-method-card.selected::after {
    content: '✓';
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    background: #10b981;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    animation: checkmarkPop 0.3s ease;
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

/* Smooth transitions */
* {
    transition-property: none;
}

button,
a,
.gallery-arrow,
.carousel-dot,
.lightbox-close {
    transition-property: all;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 200ms;
}