/* =========================
   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-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-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--text);
}

h1 {
    font-size: var(--font-size-4xl);
    font-weight: 700;
    letter-spacing: -0.015em;
    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: 600;
    color: var(--text);
}

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 0%, rgba(0,0,0,0.3) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.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-lg);
    left: var(--space-lg);
    right: var(--space-lg);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.05em;
    line-height: 1.3;
    text-transform: uppercase;
    z-index: 1;
    color: white;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* =========================
   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;
}

