/* Modern Dark Theme CSS for AI Gambling Application */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Root Variables for Color Palette and Animation Settings */
:root {
    /* Dark Theme Color Palette */
    --bg-primary: #0a0a0f;
    --bg-secondary: #151520;
    --bg-tertiary: #1e1e2e;
    --bg-card: rgba(30, 30, 46, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-hover: rgba(255, 255, 255, 0.1);

    /* Accent Colors */
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-success: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    --accent-gold: #fbbf24;

    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;

    /* Gradient Definitions */
    --gradient-primary: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    --gradient-success: linear-gradient(135deg, var(--accent-success), #059669);
    --gradient-danger: linear-gradient(135deg, var(--accent-danger), #dc2626);
    --gradient-gold: linear-gradient(135deg, var(--accent-gold), #d97706);
    --gradient-bg: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
                   radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.1) 0%, transparent 50%),
                   radial-gradient(circle at 40% 80%, rgba(16, 185, 129, 0.05) 0%, transparent 50%);

    /* Shadow Definitions */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 10px 10px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);
    --shadow-glow-success: 0 0 20px rgba(16, 185, 129, 0.3);
    --shadow-glow-danger: 0 0 20px rgba(239, 68, 68, 0.3);

    /* Animation Timing */
    --transition-fast: 0.15s ease-out;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 4px;
    transition: background var(--transition-normal);
}

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

/* Animation Keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes glow {
    0%, 100% {
        box-shadow: var(--shadow-glow);
    }
    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-5px);
    }
}

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

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Body and Base Layout */
body {
    font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    background-image: var(--gradient-bg);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* Animated Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(99, 102, 241, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(16, 185, 129, 0.03) 0%, transparent 50%);
    animation: float 8s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInUp var(--transition-slow) ease-out;
}

header h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
    position: relative;
    display: inline-block;
}

header h1::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
    animation: shimmer 2s ease-in-out infinite;
    background-size: 200% auto;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-weight: 400;
}

/* Balance Display */
.balance {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    box-shadow: var(--shadow-lg);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.balance::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-slow);
}

.balance:hover::before {
    left: 100%;
}

.balance:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

/* Section Headers */
.game-section h2,
.ai-interface h2,
.results-section h2,
.history-section h2 {
    margin-bottom: 1.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    position: relative;
    display: inline-block;
}

.game-section h2::after,
.ai-interface h2::after,
.results-section h2::after,
.history-section h2::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 40px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Games Grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* Game Cards */
.game-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 24px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    animation: fadeInUp var(--transition-slow) ease-out;
    animation-fill-mode: both;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-normal);
    z-index: -1;
}

.game-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: rgba(99, 102, 241, 0.3);
}

.game-card:hover::before {
    opacity: 0.1;
}

.game-card:active {
    transform: translateY(-4px) scale(1.01);
    transition: all var(--transition-fast);
}

.game-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.game-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Game Interface */
.game-interface {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 24px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: slideInLeft var(--transition-slow) ease-out;
}

/* Bet Section */
.bet-section {
    margin: 1.5rem 0;
}

.bet-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bet-section input {
    background: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 0.875rem 1rem;
    border-radius: 12px;
    font-size: 1rem;
    color: var(--text-primary);
    width: 140px;
    transition: all var(--transition-normal);
    font-weight: 500;
}

.bet-section input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    transform: translateY(-1px);
}

/* Game Specific Controls */
.game-specific {
    margin: 1.5rem 0;
}

.choice-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.choice-btn {
    padding: 0.875rem 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transition: left var(--transition-normal);
    z-index: -1;
}

.choice-btn:hover {
    transform: translateY(-2px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.choice-btn:hover::before {
    left: 0;
}

.choice-btn.selected {
    background: var(--gradient-primary);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.choice-btn:active {
    transform: translateY(0);
    transition: all var(--transition-fast);
}

/* Play Button */
#playButton {
    background: var(--gradient-success);
    color: var(--text-primary);
    border: none;
    padding: 1rem 2.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    border-radius: 16px;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#playButton::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left var(--transition-normal);
}

#playButton:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--shadow-xl), var(--shadow-glow-success);
}

#playButton:hover::before {
    left: 100%;
}

#playButton:active {
    transform: translateY(-1px) scale(1.02);
    transition: all var(--transition-fast);
}

#playButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* AI Interface */
.ai-interface {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 24px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp var(--transition-slow) ease-out 0.2s both;
}

.prompt-section label {
    display: block;
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#customPrompt {
    width: 100%;
    min-height: 120px;
    padding: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    font-size: 1rem;
    resize: vertical;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all var(--transition-normal);
    font-family: inherit;
    line-height: 1.5;
}

#customPrompt:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

#customPrompt::placeholder {
    color: var(--text-muted);
}

/* Prompt Examples */
.prompt-examples {
    margin-top: 1rem;
}

.prompt-examples h4 {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prompt-examples button {
    margin: 0.25rem;
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 0.85rem;
    font-weight: 500;
}

.prompt-examples button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: var(--accent-primary);
}

/* Results Section */
.results-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 24px;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp var(--transition-slow) ease-out 0.4s both;
}

.result-display {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 1rem;
    min-height: 80px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.result-display.win {
    border-color: var(--accent-success);
    box-shadow: var(--shadow-glow-success);
    animation: glow 2s ease-in-out infinite;
}

.result-display.loss {
    border-color: var(--accent-danger);
    box-shadow: var(--shadow-glow-danger);
}

.ai-response {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 16px;
    font-style: italic;
    border-left: 4px solid var(--accent-primary);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* History Section */
.history-section {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp var(--transition-slow) ease-out 0.6s both;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.5rem;
}

.history-item {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    margin-bottom: 0.75rem;
    border-radius: 12px;
    border-left: 4px solid;
    transition: all var(--transition-normal);
    animation: slideInLeft var(--transition-normal);
}

.history-item:hover {
    transform: translateX(4px);
    background: var(--bg-tertiary);
}

.history-item.win {
    border-left-color: var(--accent-success);
}

.history-item.loss {
    border-left-color: var(--accent-danger);
}

.history-item .time {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Button Base Styles */
button {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    overflow: hidden;
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left var(--transition-normal);
}

button:hover {
    background: var(--bg-glass-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(0);
    transition: all var(--transition-fast);
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Utility Classes */
.pulse {
    animation: pulse 2s infinite;
}

.fade-in {
    animation: fadeInUp var(--transition-normal) ease-out;
}

.slide-in {
    animation: slideInLeft var(--transition-normal) ease-out;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
    }

    .games-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 1.25rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2.5rem;
    }

    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .game-card {
        padding: 1.5rem;
    }

    .choice-buttons {
        justify-content: center;
        gap: 0.5rem;
    }

    .choice-btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    #playButton {
        padding: 0.875rem 2rem;
        font-size: 1.1rem;
    }

    .game-interface,
    .ai-interface,
    .results-section,
    .history-section {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    header {
        margin-bottom: 2rem;
    }

    .balance {
        padding: 0.75rem 1.5rem;
        font-size: 1.25rem;
    }

    .choice-buttons {
        flex-direction: column;
        align-items: center;
    }

    .choice-btn {
        width: 100%;
        max-width: 200px;
    }
}