/**
 * StreamAlchemy Overlay Styles
 * 
 * Professional CSS for overlay animations and effects.
 * Features:
 * - Rarity-based color schemes
 * - Smooth animations (GPU-accelerated)
 * - Particle effects
 * - Responsive positioning
 * - Discovery popups
 * - Crafting animations
 * - Corner counters
 * 
 * NOTE: Fixed 1920x1080 dimensions are required for OBS Browser Source overlays.
 * OBS uses fixed viewport sizes for consistent positioning across different scenes.
 */

/* ===== GLOBAL STYLES ===== */

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

/* OBS Browser Source requires fixed dimensions for consistent overlay positioning */
body {
    width: 1920px;
    height: 1080px;
    overflow: hidden;
    font-family: 'Arial', 'Helvetica', sans-serif;
    background: transparent;
    color: white;
}

.hidden {
    display: none !important;
}

/* ===== RARITY COLOR VARIABLES ===== */

:root {
    /* Overlay dimensions (configurable for different setups) */
    --overlay-width: 1920px;
    --overlay-height: 1080px;
    
    /* Rarity colors */
    --bronze-color: #CD7F32;
    --bronze-glow: rgba(205, 127, 50, 0.6);
    
    --silver-color: #C0C0C0;
    --silver-glow: rgba(192, 192, 192, 0.8);
    
    --gold-color: #FFD700;
    --gold-glow: rgba(255, 215, 0, 0.9);
    
    --purple-color: #9370DB;
    --purple-glow: rgba(147, 112, 219, 1.0);
}

/* ===== DISCOVERY POPUP ===== */

.discovery-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 700px;
    z-index: 1000;
    pointer-events: none;
}

.discovery-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.discovery-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    z-index: 1;
}

.discovery-image {
    position: relative;
    width: 300px;
    height: 300px;
    object-fit: contain;
    z-index: 10;
    filter: drop-shadow(0 0 30px currentColor);
}

.discovery-title {
    margin-top: 30px;
    font-size: 48px;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 40px currentColor;
    z-index: 10;
}

.discovery-text {
    margin-top: 10px;
    font-size: 24px;
    opacity: 0.9;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
    z-index: 10;
}

.discovery-item-name {
    margin-top: 15px;
    font-size: 42px;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8), 0 0 40px currentColor;
    z-index: 10;
}

.discovery-rarity {
    margin-top: 10px;
    font-size: 28px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 0 15px currentColor;
    z-index: 10;
}

/* ===== RARITY-SPECIFIC STYLES ===== */

.discovery-popup.rarity-common .discovery-glow {
    background: var(--bronze-glow);
}

.discovery-popup.rarity-common .discovery-title,
.discovery-popup.rarity-common .discovery-item-name,
.discovery-popup.rarity-common .discovery-rarity {
    color: var(--bronze-color);
}

.discovery-popup.rarity-rare .discovery-glow {
    background: var(--silver-glow);
}

.discovery-popup.rarity-rare .discovery-title,
.discovery-popup.rarity-rare .discovery-item-name,
.discovery-popup.rarity-rare .discovery-rarity {
    color: var(--silver-color);
}

.discovery-popup.rarity-legendary .discovery-glow {
    background: var(--gold-glow);
}

.discovery-popup.rarity-legendary .discovery-title,
.discovery-popup.rarity-legendary .discovery-item-name,
.discovery-popup.rarity-legendary .discovery-rarity {
    color: var(--gold-color);
}

.discovery-popup.rarity-mythic .discovery-glow {
    background: var(--purple-glow);
}

.discovery-popup.rarity-mythic .discovery-title,
.discovery-popup.rarity-mythic .discovery-item-name,
.discovery-popup.rarity-mythic .discovery-rarity {
    color: var(--purple-color);
}

/* ===== PARTICLES ===== */

.discovery-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    z-index: 5;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--color);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    opacity: 0;
    animation: particle-float var(--duration) var(--delay) ease-out infinite;
}

@keyframes particle-float {
    0% {
        transform: translate(0, 0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

/* ===== DISCOVERY ANIMATIONS ===== */

.discovery-popup.animate-in {
    animation: discovery-enter 1s ease-out forwards;
}

.discovery-popup.animate-out {
    animation: discovery-exit 1s ease-in forwards;
}

@keyframes discovery-enter {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes discovery-exit {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

.discovery-popup.animate-in .discovery-image {
    animation: image-pulse 2s ease-in-out infinite;
}

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

/* ===== CRAFTING CONTAINER ===== */

.crafting-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 1200px;
    height: 600px;
    z-index: 900;
    pointer-events: none;
}

.crafting-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.crafting-item {
    width: 300px;
    text-align: center;
}

.crafting-item img {
    width: 250px;
    height: 250px;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(255, 255, 255, 0.8));
}

.crafting-item p {
    margin-top: 20px;
    font-size: 28px;
    font-weight: bold;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
}

.crafting-fusion {
    position: relative;
    width: 400px;
    height: 400px;
}

.fusion-circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8), transparent);
    opacity: 0;
}

.fusion-spark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    opacity: 0;
}

.fusion-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 250px;
    height: 250px;
    border: 3px solid rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    opacity: 0;
}

.crafting-status {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.crafting-status p {
    font-size: 32px;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 255, 255, 0.5);
}

/* ===== CRAFTING ANIMATIONS ===== */

.crafting-container.animate-crafting .crafting-item-left {
    animation: slide-to-center-left 2s ease-in-out forwards;
}

.crafting-container.animate-crafting .crafting-item-right {
    animation: slide-to-center-right 2s ease-in-out forwards;
}

.crafting-container.animate-crafting .fusion-circle {
    animation: fusion-pulse 1s 2s ease-out forwards;
}

.crafting-container.animate-crafting .fusion-spark:nth-child(2) {
    animation: spark-burst 0.5s 2.5s ease-out forwards;
}

.crafting-container.animate-crafting .fusion-spark:nth-child(3) {
    animation: spark-burst 0.5s 2.6s ease-out forwards;
}

.crafting-container.animate-crafting .fusion-spark:nth-child(4) {
    animation: spark-burst 0.5s 2.7s ease-out forwards;
}

.crafting-container.animate-crafting .fusion-ring {
    animation: ring-expand 1s 2.5s ease-out forwards;
}

@keyframes slide-to-center-left {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(250px);
        opacity: 0;
    }
}

@keyframes slide-to-center-right {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-250px);
        opacity: 0;
    }
}

@keyframes fusion-pulse {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0;
    }
}

@keyframes spark-burst {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(calc(-50% + var(--x, 100px)), calc(-50% + var(--y, 100px))) scale(0);
        opacity: 0;
    }
}

@keyframes ring-expand {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2) rotate(360deg);
        opacity: 0;
    }
}

.crafting-container.animate-out {
    animation: fade-out 1s ease-out forwards;
}

/* ===== CORNER COUNTER ===== */

.corner-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 350px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 15px;
    border: 3px solid currentColor;
    box-shadow: 0 0 30px currentColor;
    z-index: 800;
    pointer-events: none;
}

.counter-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

.counter-content img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 0 10px currentColor);
}

.counter-info {
    flex: 1;
}

.counter-info p {
    margin: 5px 0;
    font-size: 18px;
    font-weight: bold;
}

.counter-quantity {
    font-size: 24px !important;
    color: currentColor;
    text-shadow: 0 0 10px currentColor;
}

/* ===== CORNER COUNTER RARITY COLORS ===== */

.corner-counter.rarity-common {
    border-color: var(--bronze-color);
    color: var(--bronze-color);
}

.corner-counter.rarity-rare {
    border-color: var(--silver-color);
    color: var(--silver-color);
}

.corner-counter.rarity-legendary {
    border-color: var(--gold-color);
    color: var(--gold-color);
}

.corner-counter.rarity-mythic {
    border-color: var(--purple-color);
    color: var(--purple-color);
}

/* ===== CORNER COUNTER ANIMATIONS ===== */

.corner-counter.bounce-in {
    animation: bounce-in 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.corner-counter.fade-out {
    animation: fade-out 0.5s ease-out forwards;
}

@keyframes bounce-in {
    0% {
        transform: translateX(400px) scale(0.8);
        opacity: 0;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes fade-out {
    0% {
        opacity: 1;
        transform: scale(1);
    }
    100% {
        opacity: 0;
        transform: scale(0.9);
    }
}

/* ===== UTILITY ANIMATIONS ===== */

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 20px currentColor);
    }
    50% {
        filter: drop-shadow(0 0 40px currentColor);
    }
}

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

/* ===== GPU ACCELERATION HINTS ===== */

.discovery-popup,
.crafting-container,
.corner-counter,
.discovery-image,
.crafting-item img {
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}
