/**
 * STRATEGY OVERLAY STYLES
 * Overlay trasparente con cards 3D fluttuanti per selezione strategia
 */

/* Overlay Background */
.strategy-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s;
    padding: 20px;
    overflow-y: auto;
}

.strategy-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Close Button */
.overlay-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10001;
}

.overlay-close:hover {
    background: var(--primary-color);
    color: var(--bg-primary);
    transform: rotate(90deg) scale(1.1);
}

/* Overlay Content */
.overlay-content {
    max-width: 1400px;
    width: 100%;
    margin: auto;
}

/* Title */
.overlay-title {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 60px;
    animation: fadeInDown 0.6s ease;
}

/* Cards Container */
.strategy-cards-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    perspective: 2000px;
    min-height: 500px;
    position: relative;
}

/* Card Wrapper for 3D effects */
.strategy-card-wrapper {
    position: relative;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    opacity: 0;
    transform: translateX(-200px) rotate(-15deg) scale(0.8);
}

/* Animazione entrata cards stile croupier */
.strategy-card-wrapper:nth-child(1) {
    animation: cardThrow 0.8s ease-out 0.2s forwards;
}

.strategy-card-wrapper:nth-child(2) {
    animation: cardThrow 0.8s ease-out 0.4s forwards;
}

.strategy-card-wrapper:nth-child(3) {
    animation: cardThrow 0.8s ease-out 0.6s forwards;
}

@keyframes cardThrow {
    0% {
        opacity: 0;
        transform: translateX(-200px) translateY(-50px) rotate(-25deg) scale(0.6);
    }
    60% {
        transform: translateX(10px) translateY(10px) rotate(5deg) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(0) translateY(0) rotate(0deg) scale(1);
    }
}

.strategy-card-wrapper:hover {
    transform: translateY(-10px) scale(1.05);
    z-index: 10;
}

/* Card selezionata - passa in primo piano */
.strategy-card-wrapper.selected {
    transform: scale(1.25) translateY(-40px);
    z-index: 100;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Card NON selezionate - vanno in secondo piano con velo */
.strategy-card-wrapper.dimmed {
    transform: scale(0.85) translateY(10px);
    opacity: 0.3;
    filter: grayscale(0.5) blur(3px);
    z-index: 1;
    transition: all 0.5s ease;
}

/* Bagliore ESTERNO pulsante per card selezionata */
.strategy-card-wrapper.selected .strategy-card {
    animation: glowPulse 2s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% {
        box-shadow: 
            0 0 30px rgba(200, 162, 94, 0.4),
            0 0 60px rgba(200, 162, 94, 0.3),
            0 0 90px rgba(200, 162, 94, 0.2),
            0 20px 60px rgba(0, 0, 0, 0.3);
    }
    50% {
        box-shadow: 
            0 0 40px rgba(200, 162, 94, 0.6),
            0 0 80px rgba(200, 162, 94, 0.5),
            0 0 120px rgba(200, 162, 94, 0.4),
            0 0 160px rgba(200, 162, 94, 0.3),
            0 20px 60px rgba(0, 0, 0, 0.3);
    }
}

/* Strategy Card - SOLO PER OVERLAY */
.strategy-overlay .strategy-card {
    width: 380px;
    height: 560px; /* Altezza fissa per uniformità */
    background: var(--bg-card);
    border-radius: 24px;
    padding: 40px 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(200, 162, 94, 0.2);
    position: relative;
    overflow: hidden; /* Nasconde overflow se il contenuto è troppo */
    transition: all 0.4s ease;
    display: flex;
    flex-direction: column;
    animation: floatCard 6s ease-in-out infinite;
}

.strategy-overlay .strategy-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(200, 162, 94, 0.1) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.strategy-overlay .strategy-card:hover::before,
.strategy-overlay .strategy-card-wrapper.selected .strategy-card::before {
    opacity: 1;
}

.strategy-overlay .strategy-card::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: var(--gradient-primary);
    border-radius: 24px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.strategy-overlay .strategy-card-wrapper.selected .strategy-card::after {
    opacity: 0.5;
}

/* Card Header */
.strategy-overlay .strategy-card-header {
    text-align: center;
    margin-bottom: 30px;
}

.strategy-overlay .strategy-card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: #fff;
    box-shadow: 0 8px 24px rgba(200, 162, 94, 0.4);
}

.strategy-overlay .strategy-card-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* Card Description */
.strategy-overlay .strategy-card-description {
    flex: 1;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 30px;
    font-size: 0.95rem;
    overflow-y: auto; /* Scroll se il contenuto è troppo lungo */
    overflow-x: hidden;
    padding-right: 10px; /* Spazio per la scrollbar */
}

/* Personalizza scrollbar per la descrizione */
.strategy-overlay .strategy-card-description::-webkit-scrollbar {
    width: 6px;
}

.strategy-overlay .strategy-card-description::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.strategy-overlay .strategy-card-description::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.strategy-overlay .strategy-card-description::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color-hover);
}

.strategy-overlay .strategy-card-description p {
    margin-bottom: 15px;
}

.strategy-overlay .strategy-card-description strong {
    color: var(--primary-color);
    font-weight: 600;
}

.strategy-overlay .strategy-card-description em {
    color: var(--text-primary);
    font-style: italic;
}

.strategy-overlay .strategy-card-description ul,
.strategy-overlay .strategy-card-description ol {
    padding-left: 20px;
    margin: 15px 0;
}

.strategy-overlay .strategy-card-description li {
    margin-bottom: 8px;
    position: relative;
}

.strategy-overlay .strategy-card-description ul li::marker {
    color: var(--primary-color);
}

/* Card Button */
.strategy-overlay .strategy-card-btn {
    width: 100%;
    padding: 16px 32px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 8px 24px rgba(200, 162, 94, 0.3);
    text-decoration: none;
    display: block;
    text-align: center;
}

.strategy-overlay .strategy-card-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(200, 162, 94, 0.5);
}

.strategy-overlay .strategy-card-btn:active {
    transform: translateY(-1px);
}

/* Navigation Arrows */
.strategy-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(200, 162, 94, 0.2);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    color: var(--primary-color);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
}

.strategy-nav:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-50%) scale(1.1);
}

.strategy-nav.prev {
    left: 20px;
}

.strategy-nav.next {
    right: 20px;
}

.strategy-nav.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

/* Responsive */
@media (max-width: 1200px) {
    .strategy-cards-container {
        gap: 20px;
    }
    
    .strategy-overlay .strategy-card {
        width: 320px;
        min-height: 480px;
    }
}

@media (max-width: 768px) {
    .overlay-title {
        font-size: 1.8rem;
        margin-bottom: 40px;
    }
    
    .overlay-close {
        top: 20px;
        right: 20px;
        width: 45px;
        height: 45px;
    }
    
    .strategy-cards-container {
        flex-direction: column;
        gap: 30px;
        min-height: auto;
        padding: 20px 0;
    }
    
    .strategy-card-wrapper {
        width: 100%;
        max-width: 400px;
        /* Reset animazione per mobile - tutte le card entrano insieme */
        animation: cardFadeIn 0.6s ease-out forwards !important;
    }
    
    @keyframes cardFadeIn {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    .strategy-card-wrapper:hover {
        transform: scale(1.02);
    }
    
    .strategy-card-wrapper.selected {
        transform: scale(1.05);
    }
    
    .strategy-overlay .strategy-card {
        width: 100%;
        min-height: 450px;
        padding: 30px 24px;
    }
    
    .strategy-nav {
        display: none;
    }
}

@media (max-width: 480px) {
    .overlay-title {
        font-size: 1.5rem;
        margin-bottom: 30px;
    }
    
    .strategy-overlay .strategy-card {
        min-height: 420px;
        padding: 24px 20px;
    }
    
    .strategy-overlay .strategy-card-icon {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    .strategy-overlay .strategy-card-title {
        font-size: 1.4rem;
    }
    
    .strategy-overlay .strategy-card-description {
        font-size: 0.9rem;
    }
    
    .strategy-overlay .strategy-card-btn {
        padding: 14px 24px;
        font-size: 1rem;
    }
}

/* Dark/Light Theme */
.theme-dark .strategy-overlay .strategy-card {
    background: #1a1a1a;
    border-color: rgba(200, 162, 94, 0.3);
}

.theme-light .strategy-overlay .strategy-card {
    background: #F8F6F3;
    border-color: rgba(200, 162, 94, 0.3);
}
