/**
 * Story & Visual Enhancement Styles
 * Premium dark UI with mystical/futuristic aesthetic
 */

/* ========================================
   ENHANCED VISUAL DESIGN SYSTEM
   ======================================== */

/* Additional color variables for story elements */
:root {
    --story-glow-primary: rgba(0, 242, 254, 0.6);
    --story-glow-secondary: rgba(168, 85, 247, 0.6);
    --story-glow-gold: rgba(251, 191, 36, 0.6);
    --story-glow-legendary: rgba(255, 215, 0, 0.7);
    
    /* Rarity colors */
    --rarity-common: #9ca3af;
    --rarity-uncommon: #10b981;
    --rarity-rare: #00f2fe;
    --rarity-epic: #a855f7;
    --rarity-legendary: #fbbf24;
}

/* ========================================
   ENHANCED GLASSMORPHISM CARDS
   ======================================== */

.glass-card {
    background: rgba(17, 24, 39, 0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.glass-card::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 0.5s ease;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 242, 254, 0.3);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.5),
        0 0 40px var(--story-glow-primary),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* ========================================
   3D-INSPIRED CARDS WITH DEPTH
   ======================================== */

.card-3d {
    background: linear-gradient(135deg, rgba(17, 24, 39, 0.9) 0%, rgba(11, 15, 26, 0.9) 100%);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.card-3d::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.15) 0%, transparent 70%);
    transform: translateZ(-10px);
    transition: all 0.6s ease;
}

.card-3d:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.6),
        0 0 60px var(--story-glow-primary);
}

.card-3d:hover::before {
    transform: translateZ(-10px) rotate(180deg);
}

/* ========================================
   ARTIFACT & REWARD CARDS
   ======================================== */

.artifact-card {
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(16px);
    border: 2px solid;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.artifact-card.common {
    border-color: var(--rarity-common);
    box-shadow: 0 4px 20px rgba(156, 163, 175, 0.3);
}

.artifact-card.uncommon {
    border-color: var(--rarity-uncommon);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.3);
}

.artifact-card.rare {
    border-color: var(--rarity-rare);
    box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4);
    animation: glow-rare 3s ease-in-out infinite;
}

.artifact-card.epic {
    border-color: var(--rarity-epic);
    box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4);
    animation: glow-epic 3s ease-in-out infinite;
}

.artifact-card.legendary {
    border-color: var(--rarity-legendary);
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.5);
    animation: glow-legendary 2s ease-in-out infinite;
}

@keyframes glow-rare {
    0%, 100% { box-shadow: 0 4px 20px rgba(0, 242, 254, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(0, 242, 254, 0.6), 0 0 40px rgba(0, 242, 254, 0.3); }
}

@keyframes glow-epic {
    0%, 100% { box-shadow: 0 4px 20px rgba(168, 85, 247, 0.4); }
    50% { box-shadow: 0 4px 30px rgba(168, 85, 247, 0.6), 0 0 40px rgba(168, 85, 247, 0.3); }
}

@keyframes glow-legendary {
    0%, 100% { 
        box-shadow: 0 4px 20px rgba(251, 191, 36, 0.5);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 4px 40px rgba(251, 191, 36, 0.8), 0 0 60px rgba(251, 191, 36, 0.4);
        transform: scale(1.02);
    }
}

.artifact-card:hover {
    transform: translateY(-8px) scale(1.05);
}

.artifact-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px currentColor);
    display: block;
}

.artifact-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.artifact-rarity {
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 2px;
    font-weight: 600;
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.artifact-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.artifact-power {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ========================================
   AMBIENT LIGHTING & ATMOSPHERIC EFFECTS
   ======================================== */

.ambient-glow {
    position: relative;
}

.ambient-glow::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, var(--story-glow-primary) 0%, transparent 70%);
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: -1;
}

.ambient-glow:hover::after {
    opacity: 0.3;
}

/* Particle effects for special moments */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0;
    animation: particle-float 3s ease-out forwards;
}

@keyframes particle-float {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-200px) scale(0.5);
    }
}

/* ========================================
   CHAPTER BACKGROUNDS & TRANSITIONS
   ======================================== */

.chapter-bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    transition: all 1s ease;
}

.chapter-indicator {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.chapter-indicator-icon {
    font-size: 1.5rem;
    filter: drop-shadow(0 0 10px currentColor);
}

.chapter-indicator-text {
    font-size: 0.875rem;
    font-weight: 600;
}

.chapter-indicator-subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ========================================
   ENHANCED BUTTONS WITH GLOW
   ======================================== */

.btn-glow {
    position: relative;
    overflow: hidden;
    border: none;
    background: var(--gradient-primary);
    color: white;
    padding: 0.875rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px var(--primary-glow);
}

.btn-glow::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-glow:hover::before {
    width: 300px;
    height: 300px;
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--primary-glow);
}

.btn-glow:active {
    transform: translateY(0);
}

/* ========================================
   SOFT ANIMATIONS & MICRO-INTERACTIONS
   ======================================== */

.fade-slide-in {
    animation: fadeSlideIn 0.5s ease-out forwards;
}

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

.scale-in {
    animation: scaleIn 0.4s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 0 0 20px var(--primary-glow);
    }
    50% {
        box-shadow: 0 0 40px var(--primary-glow), 0 0 60px var(--primary-glow);
    }
}

/* ========================================
   PROGRESS BARS WITH GLOW
   ======================================== */

.progress-bar-glowing {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    height: 12px;
}

.progress-fill-glowing {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    position: relative;
    transition: width 0.5s ease;
    box-shadow: 0 0 20px var(--primary-glow);
}

.progress-fill-glowing::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4));
    animation: shimmer 2s infinite;
}

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

/* ========================================
   TOOLTIPS WITH GLOW
   ======================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(16px);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(0, 242, 254, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 20px var(--story-glow-primary);
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    transform: translateX(-50%) translateY(-12px);
}

/* ========================================
   VISUAL BADGES & STATUS INDICATORS
   ======================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid;
    backdrop-filter: blur(10px);
}

.status-badge.active {
    border-color: var(--success-color);
    color: var(--success-color);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.status-badge.premium {
    border-color: var(--gold-color);
    color: var(--gold-color);
    box-shadow: 0 0 20px var(--story-glow-gold);
    animation: glow-legendary 2s ease-in-out infinite;
}

.status-badge.legendary {
    border-color: var(--rarity-legendary);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
    color: var(--rarity-legendary);
    box-shadow: 0 0 30px var(--story-glow-legendary);
    animation: glow-legendary 2s ease-in-out infinite;
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 768px) {
    .card-3d:hover {
        transform: translateY(-4px) scale(1.01);
    }
    
    .artifact-card:hover {
        transform: translateY(-4px) scale(1.02);
    }
    
    .btn-glow {
        padding: 0.75rem 1.5rem;
    }
}

/* ========================================
   LAZY LOADING PLACEHOLDER
   ======================================== */

.lazy-image {
    background: var(--glass-bg);
    position: relative;
    overflow: hidden;
}

.lazy-image::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.lazy-image.loaded::before {
    display: none;
}
