/* Base Styles */
html { 
    scroll-behavior: smooth; 
}

body {
    font-family: 'Poppins', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

.font-serif-elegant { 
    font-family: 'Cormorant Garamond', serif; 
}

/* Page Transitions */
.page {
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, opacity;
}

.page.hidden {
    opacity: 0;
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    transform: translateY(15px);
}

/* Cart Flyout */
#cart-flyout {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
}

#cart-flyout.open { 
    transform: translateX(0); 
}

#cart-overlay {
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Animations */
@keyframes fadeIn { 
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

.fade-in-item { 
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards; 
    opacity: 0; 
}

.collection-card, 
.product-card, 
.pagination-btn, 
.size-option, 
.color-option, 
button, 
a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.collection-card:hover, 
.product-card:hover { 
    transform: translateY(-6px); 
    box-shadow: 0 18px 35px rgba(0,0,0,0.08); 
}

.collection-card img, 
.product-card img { 
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1); 
}

.collection-card:hover img, 
.product-card:hover img { 
    transform: scale(1.03); 
}

/* Selection States */
.size-option.selected { 
    border-color: #1f2937; 
    background-color: #f3f4f6; 
    transform: scale(1.05); 
}

.color-option.selected { 
    box-shadow: 0 0 0 2px white, 0 0 0 4px #1f2937; 
    transform: scale(1.1); 
}

/* Image Carousel */
.image-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.7);
    color: #1f2937;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background-color 0.2s, transform 0.2s;
    z-index: 10;
}

.image-carousel-btn:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-50%) scale(1.05);
}

.image-carousel-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.image-carousel-btn.prev { 
    left: 0.5rem; 
}

.image-carousel-btn.next { 
    right: 0.5rem; 
}

/* Toast Notification */
#toast {
    position: fixed; 
    bottom: -100px; 
    left: 50%;
    transform: translateX(-50%);
    transition: bottom 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    z-index: 100;
}

#toast.show { 
    bottom: 30px; 
}

/* Form Elements */
.form-input, 
.filter-select {
    width: 100%; 
    border: 1px solid #d1d5db; 
    border-radius: 0.375rem; 
    padding: 0.75rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus, 
textarea:focus, 
.filter-select:focus { 
    outline: none; 
    border-color: #1f2937; 
    box-shadow: 0 0 0 2px rgba(31, 41, 55, 0.2); 
}

/* Loader */
.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
}

/* Global Loading Screen */
#global-loader {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#global-loader.active {
    opacity: 1;
    pointer-events: all;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #1f2937;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    margin-top: 1rem;
    color: #6b7280;
    font-weight: 500;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* Welcome Modal */
#welcome-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

#welcome-modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: white;
    border-radius: 1rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#welcome-modal.show .modal-content {
    transform: scale(1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-feature {
    animation: slideInUp 0.5s ease forwards;
    opacity: 0;
}

.welcome-feature:nth-child(1) { 
    animation-delay: 0.1s; 
}

.welcome-feature:nth-child(2) { 
    animation-delay: 0.2s; 
}

.welcome-feature:nth-child(3) { 
    animation-delay: 0.3s; 
}

/* Skeleton Loading States */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

@keyframes shimmer {
    0% { 
        background-position: 200% 0; 
    }
    100% { 
        background-position: -200% 0; 
    }
}

.product-skeleton {
    aspect-ratio: 4/5;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.75rem;
}
