/* ==================== GLASSMORPHISM UI - BASE STYLES ==================== */

:root {
    /* ==================== PRIMARY COLOR PALETTE ==================== */
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --primary-dark: #2563eb;
    --primary-glow: rgba(59, 130, 246, 0.4);

    --secondary: #06b6d4;
    --secondary-light: #22d3ee;
    --secondary-dark: #0891b2;
    --secondary-glow: rgba(6, 182, 212, 0.4);

    /* ==================== BACKGROUND COLORS ==================== */
    --bg-dark: #0f0f1a;
    --bg-gradient-1: #1a1a2e;
    --bg-gradient-2: #16213e;
    --bg-gradient-3: #0f3460;

    /* ==================== GLASS EFFECT COLORS ==================== */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(255, 255, 255, 0.15);
    --glass-highlight: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glass-blur: 10px;

    /* ==================== TEXT COLORS ==================== */
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-dim: #475569;
    --text-light: #f1f5f9;

    /* ==================== SEMANTIC COLORS ==================== */
    --success: #22c55e;
    --success-light: #4ade80;
    --warning: #f59e0b;
    --warning-light: #fbbf24;
    --danger: #ef4444;
    --danger-light: #f87171;

    /* ==================== TYPE COLORS (MTG Card Types) ==================== */
    --type-creature: #22c55e;
    --type-sorcery: #ef4444;
    --type-instant: #3b82f6;
    --type-artifact: #a8a29e;
    --type-enchantment: #a855f7;
    --type-planeswalker: #f59e0b;
    --type-battle: #ec4899;
    --type-land: #78716c;

    /* ==================== UI COLORS ==================== */
    --input-bg: rgba(0, 0, 0, 0.3);
    --overlay-bg: rgba(0, 0, 0, 0.5);
    --panel-bg-alt: rgba(0, 0, 0, 0.2);

    /* ==================== SPACING ==================== */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 20px;
    --spacing-2xl: 24px;
    --spacing-3xl: 32px;

    /* ==================== BORDER RADIUS ==================== */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* ==================== TRANSITIONS ==================== */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    --transition-bounce: 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    /* ==================== FONTS ==================== */
    --font-display: 'Cinzel', serif;
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* ==================== Z-INDEX LAYERS ==================== */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal: 1000;
    --z-toast: 2000;

    /* ==================== THEME VARIABLES (set by body class) ==================== */
    --accent: var(--primary);
    --accent-light: var(--primary-light);
    --accent-glow: var(--primary-glow);
    --theme-tint: rgba(59, 130, 246, 0.1);
}

/* ==================== CALCULATOR ACCENT THEMES ==================== */

body.theme-portent {
    --accent: #8b5cf6;
    --accent-light: #a78bfa;
    --accent-glow: rgba(139, 92, 246, 0.4);
    --theme-tint: rgba(139, 92, 246, 0.08);
}

body.theme-surge {
    --accent: #22c55e;
    --accent-light: #4ade80;
    --accent-glow: rgba(34, 197, 94, 0.4);
    --theme-tint: rgba(34, 197, 94, 0.08);
}

body.theme-wave {
    --accent: #0ea5e9;
    --accent-light: #38bdf8;
    --accent-glow: rgba(14, 165, 233, 0.4);
    --theme-tint: rgba(14, 165, 233, 0.08);
}

body.theme-vow {
    --accent: #10b981;
    --accent-light: #34d399;
    --accent-glow: rgba(16, 185, 129, 0.4);
    --theme-tint: rgba(16, 185, 129, 0.08);
}

body.theme-vortex {
    --accent: #f97316;
    --accent-light: #fb923c;
    --accent-glow: rgba(249, 115, 22, 0.4);
    --theme-tint: rgba(249, 115, 22, 0.08);
}

body.theme-lands {
    --accent: #84cc16;
    --accent-light: #a3e635;
    --accent-glow: rgba(132, 204, 22, 0.4);
    --theme-tint: rgba(132, 204, 22, 0.08);
}

body.theme-mulligan {
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --theme-tint: rgba(59, 130, 246, 0.08);
}

body.theme-rashmi {
    --accent: #06b6d4;
    --accent-light: #22d3ee;
    --accent-glow: rgba(6, 182, 212, 0.4);
    --theme-tint: rgba(6, 182, 212, 0.08);
}

body.theme-lumra {
    --accent: #65a30d;
    --accent-light: #84cc16;
    --accent-glow: rgba(101, 163, 13, 0.4);
    --theme-tint: rgba(101, 163, 13, 0.08);
}

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

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}

/* ==================== ANIMATED BACKGROUND ==================== */

@keyframes gradientShift {
    0%, 100% {
        background-position: 0% 50%;
    }
    25% {
        background-position: 50% 100%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 0%;
    }
}

body {
    font-family: var(--font-body);
    min-height: 100vh;
    color: var(--text-primary);
    padding: var(--spacing-lg);
    overflow-x: hidden;

    /* Animated gradient background */
    background: linear-gradient(
        -45deg,
        var(--bg-dark),
        var(--bg-gradient-1),
        var(--bg-gradient-2),
        var(--bg-gradient-1),
        var(--bg-dark)
    );
    background-size: 400% 400%;
    animation: gradientShift 25s ease infinite;

    /* Fallback for reduced motion */
    background-attachment: fixed;
}

/* Performance: Reduce animation on battery saver or reduced motion */
@media (prefers-reduced-motion: reduce) {
    body {
        animation: none;
        background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-gradient-1) 50%, var(--bg-gradient-2) 100%);
        background-size: 100% 100%;
    }
}

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

h1 {
    font-family: var(--font-display);
    text-align: center;
    margin-bottom: var(--spacing-sm);
    font-size: clamp(1.5rem, 4vw, 2rem);
    letter-spacing: 2px;
    color: var(--accent-light);
    text-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-glow);
    transition: color var(--transition-slow), text-shadow var(--transition-slow);
}

h2 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    letter-spacing: 1px;
    color: var(--accent);
    border-bottom: 1px solid var(--glass-border);
    transition: color var(--transition-slow), border-color var(--transition-slow);
}

h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-light);
    margin-bottom: var(--spacing-md);
}

p {
    line-height: 1.6;
    color: var(--text-secondary);
}

.card-text {
    text-align: center;
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: var(--spacing-2xl);
    font-size: 0.95rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== LAYOUT ==================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    overflow-x: hidden;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-2xl);
    width: 100%;
}

.main-grid.single-column {
    grid-template-columns: 1fr;
    max-width: 100%;
}

/* ==================== TAB CONTENT ==================== */

.tab-content {
    display: none;
    animation: fadeSlideIn var(--transition-normal) ease-out;
}

.tab-content.active {
    display: block;
}

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

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

.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 styles for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Loading state */
.loading {
    opacity: 0.6;
    pointer-events: none;
    cursor: wait;
}

/* ==================== SCROLLBAR STYLING ==================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--glass-bg);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--glass-border-hover);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border-hover) var(--glass-bg);
}

/* ==================== SELECTION ==================== */

::selection {
    background: var(--accent);
    color: var(--bg-dark);
}

::-moz-selection {
    background: var(--accent);
    color: var(--bg-dark);
}
