/* ============================================
   Range Lab - Base Styles
   Premium Dark Green Casino Theme
   ============================================ */

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary);
    background: var(--color-bg-primary);
    color: var(--color-text-primary);
    line-height: var(--leading-normal);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before,
body::after {
    content: '';
    position: fixed;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
}

body::before {
    background:
        radial-gradient(circle at 15% 20%, rgba(215, 168, 74, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 80% 25%, rgba(192, 52, 44, 0.12) 0%, transparent 45%),
        radial-gradient(circle at 30% 85%, rgba(215, 168, 74, 0.12) 0%, transparent 50%);
    filter: blur(8px);
}

body::after {
    background:
        radial-gradient(circle at 85% 80%, rgba(215, 168, 74, 0.12), transparent 48%),
        radial-gradient(circle at 10% 75%, rgba(192, 52, 44, 0.1), transparent 46%);
    opacity: 0.45;
}

.light-theme::before {
    background:
        radial-gradient(circle at 20% 20%, rgba(182, 134, 51, 0.16) 0%, transparent 45%),
        radial-gradient(circle at 75% 25%, rgba(192, 52, 44, 0.12) 0%, transparent 45%);
}

.light-theme::after {
    background:
        radial-gradient(circle at 80% 80%, rgba(215, 168, 74, 0.12), transparent 48%),
        radial-gradient(circle at 12% 75%, rgba(192, 52, 44, 0.1), transparent 46%);
    opacity: 0.3;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: -0.03em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

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

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

strong { font-weight: var(--font-semibold); }
code, pre { font-family: var(--font-mono); }

/* Selection */
::selection {
    background: var(--color-primary);
    color: #0b0f1f;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-border-light);
}

/* Focus States */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Container */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--container-narrow);
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(215, 168, 74, 0.2) 0%, transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(192, 52, 44, 0.18) 0%, transparent 50%),
        var(--color-bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-8);
}

.loader-cards {
    display: flex;
    gap: var(--space-3);
    position: relative;
}

.loader-cards::before {
    content: '';
    position: absolute;
    inset: -30px;
    background: radial-gradient(circle, rgba(215, 168, 74, 0.25) 0%, transparent 70%);
    filter: blur(20px);
    animation: loaderGlow 2s ease-in-out infinite;
}

@keyframes loaderGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

.loader-card {
    width: 70px;
    height: 98px;
    background: linear-gradient(145deg, #ffffff 0%, #f3f4ff 100%);
    border: 3px solid rgba(215, 168, 74, 0.6);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-4xl);
    font-weight: var(--font-bold);
    color: #1a1f2e;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.4),
        0 0 30px rgba(215, 168, 74, 0.25),
        inset 0 1px 0 rgba(255,255,255,0.9);
    animation: cardPulse 1.5s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

.loader-card.red {
    color: var(--color-red);
    animation-delay: 0.15s;
}

.loader-text {
    color: var(--color-primary);
    font-size: var(--text-sm);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    font-weight: var(--font-semibold);
    text-shadow: 0 0 20px rgba(215, 168, 74, 0.5);
}

@keyframes cardPulse {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-15px) rotate(5deg); }
}

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-gold { color: var(--color-gold); }
.text-green { color: var(--color-primary); }
.text-red { color: var(--color-red); }
.text-muted { color: var(--color-text-muted); }

.font-mono { font-family: var(--font-mono); }

.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

.hidden { display: none !important; }
.invisible { visibility: hidden; }

/* Reduced Motion - for accessibility and bot optimization */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Bot/crawler optimization class */
.reduce-motion *, .reduce-motion *::before, .reduce-motion *::after {
    animation: none !important;
    transition: none !important;
}

.reduce-motion .loading-screen {
    display: none !important;
}

/* Grid System */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

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

@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Playing Card Small (for hand rankings) */
.playing-card-sm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 44px;
    background: linear-gradient(145deg, #ffffff 0%, #f0f0f0 100%);
    border: 1px solid rgba(0, 212, 106, 0.3);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--font-bold);
    color: var(--color-suit-spade);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.playing-card-sm.red {
    color: var(--color-suit-heart);
}

.playing-card-sm.blue {
    color: var(--color-blue);
}

.playing-card-sm.green {
    color: var(--color-primary);
}
