/* Visual Effects and Animations for Trenta-u */

/* Keyframe Animations */
@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -200%) scale(1.2);
    }
}

@keyframes winGlow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
        border-color: rgba(76, 175, 80, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(76, 175, 80, 1), 0 0 60px rgba(76, 175, 80, 0.5);
        border-color: rgba(76, 175, 80, 1);
    }
}

@keyframes jackpotPulse {
    0%, 100% {
        color: var(--accent-color);
        text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
        transform: scale(1);
    }
    50% {
        color: #FFA500;
        text-shadow: 0 0 20px rgba(255, 215, 0, 1), 0 0 40px rgba(255, 165, 0, 0.5);
        transform: scale(1.1);
    }
}

@keyframes bustShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes screenShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
    20%, 40%, 60%, 80% { transform: translateX(2px); }
}

@keyframes cardFlip {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

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

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

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    0% {
        opacity: 0;
        transform: translateX(-50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    0% {
        opacity: 0;
        transform: translateX(50px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes neonGlow {
    0%, 100% {
        text-shadow: 0 0 5px currentColor, 0 0 10px currentColor, 0 0 15px currentColor;
    }
    50% {
        text-shadow: 0 0 10px currentColor, 0 0 20px currentColor, 0 0 30px currentColor;
    }
}

@keyframes scanlines {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100vh); }
}

/* Effect Classes */
.win-glow {
    animation: winGlow 2s ease-in-out;
    border: 2px solid transparent;
}

.jackpot-pulse {
    animation: jackpotPulse 1s ease-in-out infinite;
}

.bust-shake {
    animation: bustShake 0.6s ease-in-out;
}

.screen-shake {
    animation: screenShake 0.3s ease-in-out;
}

.card-flip {
    animation: cardFlip 0.6s ease-in-out;
}

.chip-bounce {
    animation: chipBounce 0.4s ease-in-out;
}

.dealer-indicator {
    animation: dealerIndicator 2s ease-in-out infinite;
}

.fade-in-up {
    animation: fadeInUp 0.5s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.5s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.sparkle {
    animation: sparkle 1.5s ease-in-out infinite;
}

/* Theme-specific Effects */
.neon-effects {
    --glow-color: #00FFFF;
}

.neon-effects .action-btn {
    text-shadow: 0 0 5px var(--glow-color);
    box-shadow: 0 0 10px var(--glow-color);
    border: 1px solid var(--glow-color);
}

.neon-effects .game-header h1 {
    animation: neonGlow 2s ease-in-out infinite;
    color: var(--glow-color);
}

.scanlines::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--glow-color), transparent);
    animation: scanlines 3s linear infinite;
    z-index: 1000;
    pointer-events: none;
}

.luxury-effects .action-btn {
    background: linear-gradient(45deg, var(--accent-color), #FFE082);
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
    border: 1px solid var(--accent-color);
}

.luxury-effects .player-slot {
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.1);
}

.wood-texture {
    background-image:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3) 0%, transparent 50%);
}

/* Particle Effects Canvas */
#effects-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* Flying Card Animation */
.flying-card {
    width: 60px;
    height: 90px;
    background: linear-gradient(45deg, #1e3c72, #2a5298);
    border-radius: 8px;
    border: 2px solid #fff;
    position: fixed;
    z-index: 999;
    transition: all 0.5s ease-out;
}

/* Achievement Notification */
.achievement-notification {
    position: fixed;
    top: 20px;
    right: -400px;
    width: 350px;
    background: linear-gradient(135deg, var(--accent-color), #FFE082);
    color: var(--primary-color);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    transition: right 0.5s ease-out;
    display: flex;
    align-items: center;
    gap: 15px;
}

.achievement-notification.show {
    right: 20px;
}

.achievement-icon {
    font-size: 2.5rem;
    min-width: 50px;
    text-align: center;
}

.achievement-content {
    flex: 1;
}

.achievement-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-name {
    font-size: 1rem;
    margin-bottom: 3px;
}

.achievement-description {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-bottom: 5px;
}

.achievement-reward {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Floating Text */
.floating-text {
    position: fixed;
    pointer-events: none;
    z-index: 1001;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    animation: floatUp 2s ease-out forwards;
}

/* Card Deal Animation */
.dealing-card {
    transition: all 0.5s ease-out;
    transform-origin: center;
}

.dealing-card.deal-animation {
    transform: translateX(0) translateY(0) rotate(0deg);
}

/* Chip Stack Effects */
.chip-stack {
    position: relative;
    transition: all 0.3s ease;
}

.chip-stack:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

.chip-stack.placing {
    animation: chipBounce 0.4s ease-in-out;
}

/* Betting Area Highlight */
.betting-area.active {
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
    animation: pulse 1s ease-in-out infinite;
}

/* Hand Result Effects */
.hand-result {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 100;
    animation: fadeInUp 0.5s ease-out;
}

.hand-result.win {
    color: #4CAF50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

.hand-result.lose {
    color: #F44336;
    text-shadow: 0 0 10px rgba(244, 67, 54, 0.8);
}

.hand-result.push {
    color: #FF9800;
    text-shadow: 0 0 10px rgba(255, 152, 0, 0.8);
}

/* Button Press Effects */
.action-btn:active {
    transform: scale(0.95);
    transition: transform 0.1s ease;
}

.action-btn.pressed {
    background: linear-gradient(135deg, #0f4c3a, #1a5d4a);
    transform: translateY(2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Panel Slide Effects */
.panel-slide-in {
    animation: slideInRight 0.5s ease-out;
}

.panel-slide-out {
    animation: slideInLeft 0.5s ease-out reverse;
}

/* Loading Spinner */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Effects */
@media (max-width: 768px) {
    .achievement-notification {
        width: 300px;
        right: -320px;
        top: 10px;
        padding: 15px;
    }

    .achievement-notification.show {
        right: 10px;
    }

    .achievement-icon {
        font-size: 2rem;
        min-width: 40px;
    }

    .floating-text {
        font-size: 1.2rem;
    }

    .hand-result {
        font-size: 1.2rem;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .win-glow,
    .jackpot-pulse,
    .bust-shake,
    .screen-shake,
    .card-flip,
    .chip-bounce,
    .dealer-indicator,
    .fade-in-up,
    .slide-in-left,
    .slide-in-right,
    .pulse,
    .sparkle,
    .neon-effects .game-header h1,
    .scanlines::before,
    .floating-text,
    .loading-spinner {
        animation: none !important;
    }

    .achievement-notification,
    .dealing-card,
    .chip-stack,
    .action-btn {
        transition: none !important;
    }
}

/* High Contrast Support */
@media (prefers-contrast: high) {
    .win-glow {
        border-color: #4CAF50;
        background-color: rgba(76, 175, 80, 0.1);
    }

    .floating-text {
        text-shadow: 0 0 5px black, 0 0 10px black;
    }

    .achievement-notification {
        border: 2px solid var(--primary-color);
    }
}