/* =============================================================================
   MERALOOT CORE STYLES - Clean Architecture
   Central CSS file for all MeraLoot components
   
   Architecture:
   1. CSS Variables & Design System
   2. Base Styles & Reset
   3. Component Library
   4. Utility Classes
   ============================================================================= */

/* === 1. DESIGN SYSTEM & CSS VARIABLES === */
:root {
    /* Colors - Brand (Fire Theme) */
    --brand-primary: #ff6b35;
    --brand-secondary: #ff4444;
    --brand-accent: #ffa502;
    
    /* Legacy compatibility */
    --fire-orange: #ff6b35;
    --fire-red: #ff4444;
    --accent-color: #ffa502;
    --primary-color: #ff6b35;
    
    /* Colors - Semantic */
    --color-success: #4CAF50;
    --color-warning: #ffa726;
    --color-error: #f44336;
    --color-info: #2196F3;
    
    /* Colors - Text */
    --text-primary: #2c2c2c;
    --text-secondary: #666;
    --text-muted: #999;
    --text-inverse: #ffffff;
    
    /* Colors - Background */
    --bg-primary: #fafafa;
    --bg-secondary: #f8f9fa;
    --bg-surface: #ffffff;
    --bg-overlay: rgba(0, 0, 0, 0.5);
    
    /* Legacy compatibility */
    --card-bg: #ffffff;
    --main-bg: #fafafa;
    
    /* Colors - Border */
    --border-light: #f0f0f0;
    --border-medium: #e9ecef;
    --border-strong: #dee2e6;
    
    /* Legacy compatibility */
    --border-color: #e9ecef;
    --border: #e9ecef;
    
    /* Shadows - Unified System */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.18);
    
    /* Legacy compatibility */
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-light: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 8px 20px rgba(0, 0, 0, 0.12);
    --shadow-heavy: 0 16px 32px rgba(0, 0, 0, 0.15);
    
    /* Border Radius */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing Scale */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;
    
    /* Typography */
    --font-family-base: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 32px;
    
    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
    
    /* Z-Index Scale - Unified System */
    --z-background: -1;
    --z-base: 0;
    --z-dropdown: 10;
    --z-sticky: 20;
    --z-fixed: 30;
    --z-modal: 40;
    --z-tooltip: 50;
    --z-toast: 60;
    
    /* Legacy compatibility */
    --z-nav: 30;
    --z-mobile-menu: 25;
    --z-particles: -1;
}

/* === 2. BASE STYLES & RESET === */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-base);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === 3. COMPONENT LIBRARY === */

/* === 3.1 Fire Particle Background === */
.fire-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-background);
    overflow: hidden;
}

.fire-particles .particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: radial-gradient(circle, var(--brand-primary), transparent);
    border-radius: 50%;
    animation: float-up 8s infinite linear;
}

.fire-particles .particle:nth-child(1) { left: 20%; animation-delay: 0s; animation-duration: 10s; }
.fire-particles .particle:nth-child(2) { left: 50%; animation-delay: 2s; animation-duration: 12s; }
.fire-particles .particle:nth-child(3) { left: 80%; animation-delay: 4s; animation-duration: 8s; }
.fire-particles .particle:nth-child(4) { left: 10%; animation-delay: 6s; animation-duration: 14s; }
.fire-particles .particle:nth-child(5) { left: 70%; animation-delay: 8s; animation-duration: 9s; }

@keyframes float-up {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100vh) scale(1); opacity: 0; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

/* === 3.2 Navigation Components === */
.meraloot-nav, .structured-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 107, 53, 0.1);
    z-index: var(--z-fixed);
    padding: 0 var(--space-lg);
    transition: var(--transition-base);
}

.nav-container, .nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    max-width: 1400px;
    margin: 0 auto;
}

.nav-logo, .logo {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--brand-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    transition: var(--transition-fast);
}

.nav-logo:hover, .logo:hover {
    color: var(--brand-secondary);
}

/* === 3.3 Card System === */
.card, .category-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}

.card:hover, .category-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
}

/* Support for structured navigation classes */
.category-card-structured {
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-medium);
    border: 2px solid #f5f5f5;
    cursor: pointer;
}

.category-card-structured:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--brand-primary);
}

.card-image, .card-image-structured {
    height: 220px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5rem;
    color: white;
    position: relative;
}

.card-content, .card-content-structured {
    padding: var(--space-xl);
    position: relative;
}

.card-title, .card-title-structured {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.card-description, .card-description-structured {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
}

/* Card Actions Grid */
.card-actions-structured {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
}

/* === 3.4 Button System === */
.btn, .action-btn-structured {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border: 2px solid transparent;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
    text-align: center;
}

.btn-primary, .action-btn-structured.primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    font-weight: 700;
}

.btn-primary:hover, .action-btn-structured.primary:hover {
    background: linear-gradient(135deg, var(--brand-secondary), var(--brand-primary));
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(255, 107, 53, 0.4);
}

.btn-secondary, .action-btn-structured {
    background: #f8f9fa;
    color: var(--text-primary);
    border: 2px solid transparent;
}

.btn-secondary:hover, .action-btn-structured:hover {
    background: var(--brand-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 107, 53, 0.3);
}

.btn-coming-soon, .action-btn-structured.coming-soon {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    color: #e65100;
    border: 2px solid #ffcc02;
    opacity: 0.85;
    position: relative;
}

.btn-coming-soon:hover, .action-btn-structured.coming-soon:hover {
    background: linear-gradient(135deg, #ffe0b2, #ffcc02);
    opacity: 1;
    transform: translateY(-1px);
}

.btn-disabled, .action-btn-structured.disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-disabled:hover, .action-btn-structured.disabled:hover {
    background: #e9ecef;
    color: #adb5bd;
    transform: none;
    box-shadow: none;
}

/* === 3.5 Badge System === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--brand-primary);
    color: white;
    font-size: var(--font-size-xs);
    font-weight: bold;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-coming-soon {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    animation: pulse 2s infinite;
}

.card.coming-soon .card-content::after {
    content: 'Bald';
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    color: white;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 9px;
    font-weight: bold;
    z-index: var(--z-dropdown);
    animation: pulse 2s infinite;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* === 4. UTILITY CLASSES === */
.container, .categories-container { 
    max-width: 1400px; 
    margin: 0 auto; 
    padding: 0 var(--space-lg); 
}

/* Page-specific containers */
.categories-container {
    padding: 100px var(--space-lg) 60px;
}

.categories-title {
    text-align: center;
    font-size: clamp(2.2rem, 5vw, 3rem);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-lg);
    background: linear-gradient(135deg, #ff4444 0%, #ff6b35 50%, #ffa502 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.categories-subtitle {
    text-align: center;
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    margin-bottom: var(--space-3xl);
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.5;
}

/* Category Cards Grid */
.category-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    padding: var(--space-lg) 0;
}
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Spacing Utilities */
.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); }

.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); }

.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

/* Grid System */
.grid { display: grid; gap: var(--space-lg); }
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Responsive Design */
@media (min-width: 768px) {
    .category-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 35px;
    }
    
    .categories-title {
        font-size: clamp(3rem, 6vw, 4rem);
        margin-bottom: 25px;
    }
    
    .categories-subtitle {
        font-size: var(--font-size-xl);
        margin-bottom: var(--space-3xl);
    }
    
    .card-actions-structured {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .category-cards {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .card-image-structured {
        height: 240px;
    }
}

@media (max-width: 768px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .nav-container, .nav-wrapper { padding: 0 var(--space-md); }
    .container, .categories-container { padding: 0 var(--space-md); }
    
    .categories-container {
        padding: 80px var(--space-md) 40px;
    }
}

/* Print Styles */
@media print {
    .fire-particles, .badge { display: none; }
    .card { box-shadow: none; border: 1px solid var(--border-medium); }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .card { border: 2px solid currentColor; }
    .badge { background: #000; color: #fff; border: 1px solid #fff; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}