/* =========================
   OPERULA — MAIN STYLESHEET
   Optimized for Performance
   ========================= */

:root {
    /* Colors - These are defined in themes.css based on data-theme attribute */
    /* Default fallback values (will be overridden by theme CSS) */
    --bg: var(--color-bg, #fafafa);
    --text: var(--color-text, #1a1a1a);
    --muted: var(--color-text-muted, #555);
    --accent: var(--color-accent, #b89b5e);
    --accent-light: var(--color-accent-light, #d4c19a);
    --accent-dark: var(--color-accent-dark, #9a7f4a);
    --border: var(--color-border, #e6e6e6);
    --success: var(--color-success, #28a745);
    --error: var(--color-error, #dc3545);
    --warning: var(--color-warning, #ffc107);
    
    /* Spacing Scale (8px base) */
    --space-xs: 0.5rem;   /* 8px */
    --space-sm: 0.75rem;  /* 12px */
    --space-md: 1rem;     /* 16px */
    --space-lg: 1.5rem;   /* 24px */
    --space-xl: 2rem;     /* 32px */
    --space-2xl: 3rem;    /* 48px */
    --space-3xl: 4rem;    /* 64px */
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 2rem;
    --font-size-4xl: 2.5rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
    --shadow-xl: 0 8px 24px rgba(0,0,0,0.15);
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    --transition-bounce: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
}

/* =========================
   RESET & BASE
   ========================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* =========================
   TYPOGRAPHY
   ========================= */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.15;
    margin-bottom: var(--space-md);
    color: var(--text);
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

h2 {
    font-size: var(--font-size-3xl);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
}

h3 {
    font-size: var(--font-size-2xl);
    font-weight: 500;
    color: var(--text);
}

h4 {
    font-size: var(--font-size-xl);
    font-weight: 500;
}

p {
    margin-bottom: var(--space-md);
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition-base);
}

a:hover {
    color: var(--accent-dark);
}

/* =========================
   UTILITY CLASSES
   ========================= */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-narrow {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.section {
    padding: var(--space-2xl) 0;
}

/* Spacing Utilities */
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Text Utilities */
.text-center { text-align: center; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }

/* =========================
   BUTTONS
   ========================= */

.btn {
    display: inline-block;
    padding: 0.9rem 1.8rem;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--transition-bounce);
    text-decoration: none;
    font-family: var(--font-family);
}

.btn:hover {
    background: #3a3a3a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-secondary:hover {
    background: var(--accent);
    color: #fff;
}

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

.card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-bounce);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-gradient {
    background: linear-gradient(135deg, #fffef5 0%, #ffffff 100%);
}

/* =========================
   CATEGORY CARDS
   ========================= */

.category-card {
    display: block;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, #e8e8e8 0%, #d8d8d8 100%);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text);
    position: relative;
    overflow: hidden;
    transition: all var(--transition-bounce);
    will-change: transform;
}

.category-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, transparent 45%, rgba(0,0,0,0.58) 100%);
    opacity: 1;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.category-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: var(--shadow-xl);
}

.category-card:hover::before {
    opacity: 1;
}

.category-card-text {
    position: absolute;
    bottom: var(--space-md);
    left: var(--space-md);
    right: var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 700;
    letter-spacing: 0.05em;
    line-height: 1.25;
    text-transform: uppercase;
    text-align: center;
    z-index: 1;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0,0,0,0.55);
    word-break: break-word;
}

/* =========================
   SEARCH BAR
   ========================= */

.search-container {
    display: flex;
    align-items: center;
    border: 2px solid var(--accent);
    border-radius: var(--radius-full);
    background: #fff;
    position: relative;
    transition: all var(--transition-base);
}

.search-container:focus-within {
    box-shadow: 0 0 0 3px rgba(184, 155, 94, 0.1);
    border-color: var(--accent-dark);
}

.search-input {
    flex: 1;
    padding: 1.2rem 1.6rem;
    font-size: var(--font-size-base);
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-family);
}

.search-input::placeholder {
    color: var(--muted);
}

.search-icon-btn {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    transition: all 0.2s ease;
    border-radius: 50%;
}

.search-icon-btn:hover {
    background: rgba(184, 155, 94, 0.1);
    transform: scale(1.1);
}

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

.search-button {
    margin: 6px;
    padding: 0.9rem 1.8rem;
    border-radius: var(--radius-full);
    border: none;
    background: var(--accent);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all var(--transition-bounce);
    text-transform: uppercase;
    font-family: var(--font-family);
}

.search-button:hover {
    background: #3a3a3a;
    transform: scale(1.05);
}

/* =========================
   OFFER CARDS
   ========================= */

.offer-card {
    display: block;
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    text-decoration: none;
    color: inherit;
    transition: all var(--transition-bounce);
    will-change: transform;
}

.offer-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.offer-card.featured {
    border: 2px solid var(--accent);
    position: relative;
}

.offer-image {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.offer-badge {
    position: absolute;
    top: -0.75rem;
    right: 1rem;
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xs);
    font-weight: 600;
    animation: pulse 2s infinite;
}

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

.offer-content {
    padding: var(--space-lg);
    position: relative;
}

.discount-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-sm);
}

/* =========================
   BREADCRUMB
   ========================= */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) 0;
    font-size: var(--font-size-sm);
    color: var(--muted);
    flex-wrap: wrap;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.breadcrumb-item:not(:last-child)::after {
    content: '/';
    color: var(--border);
    margin-left: var(--space-sm);
}

.breadcrumb-link {
    color: var(--muted);
    text-decoration: none;
    transition: color var(--transition-base);
}

.breadcrumb-link:hover {
    color: var(--accent);
}

.breadcrumb-current {
    color: var(--text);
    font-weight: 500;
}

/* =========================
   SKELETON LOADERS
   ========================= */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--radius-md);
}

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

.skeleton-text {
    height: 1em;
    margin-bottom: var(--space-sm);
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: var(--space-md);
}

.skeleton-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-md);
}

/* =========================
   ANIMATIONS
   ========================= */

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

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

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

.slide-down {
    animation: slideDown 0.3s ease-out;
}

.stagger > * {
    animation: fadeIn 0.4s ease-out;
    animation-fill-mode: both;
}

.stagger > *:nth-child(1) { animation-delay: 0.05s; }
.stagger > *:nth-child(2) { animation-delay: 0.1s; }
.stagger > *:nth-child(3) { animation-delay: 0.15s; }
.stagger > *:nth-child(4) { animation-delay: 0.2s; }
.stagger > *:nth-child(5) { animation-delay: 0.25s; }
.stagger > *:nth-child(6) { animation-delay: 0.3s; }

/* =========================
   FORMS
   ========================= */

.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-weight: 500;
    margin-bottom: var(--space-sm);
    font-size: var(--font-size-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: var(--font-family);
    transition: all var(--transition-base);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(184, 155, 94, 0.1);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 768px) {
    .container,
    .container-narrow {
        padding: 0 var(--space-md);
    }
    
    .section {
        padding: var(--space-xl) 0;
    }
    
    h1 {
        font-size: var(--font-size-3xl);
    }
    
    h2 {
        font-size: var(--font-size-2xl);
    }
}

/* =========================
   ACCESSIBILITY
   ========================= */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* =========================
   UTILITY: CONTAIN
   ========================= */

.card,
.category-card,
.offer-card {
    contain: layout style paint;
}

/* =========================
   LUXURY PRODUCT PAGE
   ========================= */

.product-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--color-bg-secondary, #fff);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .product-hero { grid-template-columns: 1fr; }
}

.product-gallery {
    position: relative;
    overflow: hidden;
    background: var(--color-bg-tertiary, #f5f5f5);
}

.product-gallery img {
    width: 100%;
    height: 100%;
    min-height: 480px;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0, 0.15, 1);
}

.product-gallery:hover img {
    transform: scale(1.04);
}

.product-gallery-placeholder {
    width: 100%;
    min-height: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-bg-tertiary, #f5f5f5) 0%, var(--color-bg-hover, #e8e8e8) 100%);
    color: var(--muted);
    font-size: var(--font-size-sm);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.product-details {
    padding: var(--space-2xl) var(--space-2xl);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.product-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-3xl);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: var(--space-lg);
    color: var(--text);
}

.product-price {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: var(--space-xl);
    letter-spacing: -0.02em;
}

.product-price .currency {
    font-size: 0.65em;
    font-weight: 400;
    vertical-align: super;
    margin-right: 2px;
}

.product-description {
    color: var(--muted);
    line-height: 1.75;
    margin-bottom: var(--space-xl);
    font-size: var(--font-size-base);
}

.product-specs {
    margin-bottom: var(--space-xl);
    border-top: 1px solid var(--border);
    padding-top: var(--space-lg);
}

.product-specs dt {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: var(--space-xs);
}

.product-specs dd {
    font-size: var(--font-size-base);
    color: var(--text);
    margin-bottom: var(--space-md);
    padding-left: 0;
}

.product-artisan {
    border-top: 1px solid var(--border);
    padding-top: var(--space-lg);
    margin-top: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.product-artisan-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.product-artisan-name {
    font-family: var(--font-heading);
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--text);
}

/* =========================
   LUXURY BUTTONS
   ========================= */

.btn-luxury {
    display: inline-block;
    width: 100%;
    padding: 1rem 2rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0, 0.15, 1);
    text-align: center;
    text-decoration: none;
}

.btn-luxury:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 20px rgba(184, 155, 94, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

.btn-luxury:active {
    transform: translateY(0);
}

.btn-luxury:disabled,
.btn-luxury.disabled {
    background: var(--color-bg-hover, #e0e0e0);
    color: var(--muted);
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-luxury-outline {
    background: transparent;
    border: 2px solid var(--accent);
    color: var(--accent);
}

.btn-luxury-outline:hover {
    background: var(--accent);
    color: #fff;
}

/* =========================
   PRODUCT CARD (luxury)
   ========================= */

.product-card {
    background: var(--color-bg-secondary, #fff);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.35s cubic-bezier(0.25, 0, 0.15, 1);
    text-decoration: none;
    color: inherit;
    display: block;
    position: relative;
}

.product-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
}

.product-card-image {
    position: relative;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    background: var(--color-bg-tertiary, #f5f5f5);
}

.product-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0, 0.15, 1);
}

.product-card:hover .product-card-image img {
    transform: scale(1.06);
}

.product-card-body {
    padding: var(--space-lg);
}

.product-card-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-base);
    font-weight: 500;
    line-height: 1.3;
    margin-bottom: var(--space-sm);
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card-price {
    font-family: var(--font-heading);
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--text);
}

.product-card-artisan {
    font-size: var(--font-size-xs);
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-top: var(--space-xs);
}

/* =========================
   BADGE SYSTEM
   ========================= */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

.badge-gold {
    background: var(--accent);
    color: #fff;
}

.badge-premium {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: #fff;
}

.badge-new {
    background: #059669;
    color: #fff;
}

.badge-limited {
    background: var(--text);
    color: #fff;
}

.badge-verified {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
}

.badge-position {
    position: absolute;
    top: var(--space-md);
    left: var(--space-md);
    z-index: 2;
}

/* =========================
   LUXURY SECTION TITLES
   ========================= */

.section-title {
    font-family: var(--font-heading);
    font-size: var(--font-size-3xl);
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.section-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-2xl);
    max-width: 560px;
    margin-left: auto;
    margin-right: auto;
}

.section-divider {
    width: 48px;
    height: 2px;
    background: var(--accent);
    margin: var(--space-md) auto var(--space-lg);
}

/* =========================
   LUXURY GRID
   ========================= */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-lg);
}

@media (min-width: 1024px) {
    .product-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* =========================
   SCROLL REVEAL ANIMATION
   ========================= */

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

.reveal {
    animation: revealUp 0.6s cubic-bezier(0.25, 0, 0.15, 1) both;
}

.reveal-delay-1 { animation-delay: 0.1s; }
.reveal-delay-2 { animation-delay: 0.2s; }
.reveal-delay-3 { animation-delay: 0.3s; }
.reveal-delay-4 { animation-delay: 0.4s; }

/* =========================
   LUXURY QUANTITY INPUT
   ========================= */

.quantity-input {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    width: fit-content;
}

.quantity-input input {
    width: 3.5rem;
    text-align: center;
    border: none;
    outline: none;
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    padding: 0.6rem 0;
    -moz-appearance: textfield;
}

.quantity-input input::-webkit-inner-spin-button,
.quantity-input input::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

/* =========================
   EARLY ACCESS BOX
   ========================= */

.early-access-box {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.early-access-box h4 {
    font-family: var(--font-heading);
    color: #5b21b6;
    margin-bottom: var(--space-sm);
}

.early-access-box p {
    color: #6d28d9;
    font-size: var(--font-size-sm);
}

