/* Reset e base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --bg-dark: #0f0f23;
    --bg-darker: #080815;
    --text-light: #e2e8f0;
    --text-muted: #94a3b8;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-ai: linear-gradient(45deg, #6366f1, #8b5cf6, #06b6d4);
    --glow-blue: 0 0 20px rgba(99, 102, 241, 0.3);
    --glow-purple: 0 0 30px rgba(139, 92, 246, 0.4);
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    overflow-x: hidden;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Particelle animate di sfondo */
.particles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.6;
    animation: floatParticle 20s linear infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; }
.particle:nth-child(9) { left: 90%; animation-delay: -16s; }
.particle:nth-child(10) { left: 95%; animation-delay: -18s; }

@keyframes floatParticle {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        transform: translateY(-100px) translateX(100px);
        opacity: 0;
    }
}

/* Sezione Hero */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
    background: radial-gradient(ellipse at center, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

.hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 1000px;
}

/* AI Brain 3D */
.ai-brain {
    position: relative;
    width: 300px;
    height: 300px;
    transform-style: preserve-3d;
    animation: rotateBrain 20s linear infinite;
}

@keyframes rotateBrain {
    0% { transform: rotateY(0deg) rotateX(0deg); }
    100% { transform: rotateY(360deg) rotateX(360deg); }
}

.brain-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120px;
    height: 120px;
    background: var(--gradient-ai);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: var(--glow-purple);
    animation: pulseCore 3s ease-in-out infinite;
}

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

.neural-network {
    position: absolute;
    width: 100%;
    height: 100%;
}

.neuron {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: var(--glow-blue);
    animation: pulseNeuron 2s ease-in-out infinite;
}

.neuron:nth-child(1) {
    top: 20%;
    left: 80%;
    animation-delay: 0s;
}

.neuron:nth-child(2) {
    top: 60%;
    left: 90%;
    animation-delay: 0.5s;
}

.neuron:nth-child(3) {
    top: 80%;
    left: 20%;
    animation-delay: 1s;
}

.neuron:nth-child(4) {
    top: 30%;
    left: 10%;
    animation-delay: 1.5s;
}

.neuron:nth-child(5) {
    top: 10%;
    left: 50%;
    animation-delay: 2s;
}

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

.connection {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
    opacity: 0.4;
    animation: flowData 3s ease-in-out infinite;
}

.connection:nth-child(6) {
    top: 25%;
    left: 30%;
    width: 40%;
    transform: rotate(-30deg);
    animation-delay: 0s;
}

.connection:nth-child(7) {
    top: 65%;
    left: 20%;
    width: 60%;
    transform: rotate(45deg);
    animation-delay: 1s;
}

.connection:nth-child(8) {
    top: 45%;
    left: 35%;
    width: 35%;
    transform: rotate(-60deg);
    animation-delay: 2s;
}

@keyframes flowData {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

/* Testo Hero */
.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 24px;
}

.gradient-text {
    background: var(--gradient-ai);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(60deg); }
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 500px;
}

/* Sezioni */
section {
    position: relative;
    z-index: 2;
    padding: 80px 0;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-title {
    font-size: 2.75rem;
    font-weight: 600;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.section-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

/* Grid Spiegazione */
.explanation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 60px;
}

.explanation-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    backdrop-filter: blur(10px);
    transform: translateY(0);
    transition: all 0.3s ease;
}

.explanation-card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: var(--glow-purple);
}

.card-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 30px;
    position: relative;
    border-radius: 50%;
    background: var(--gradient-ai);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-brain::before {
    content: '🧠';
    font-size: 2rem;
}

.icon-conversation::before {
    content: '💬';
    font-size: 2rem;
}

.icon-learning::before {
    content: '📚';
    font-size: 2rem;
}

.explanation-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-light);
}

.explanation-card p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* Sezione Vantaggi */
.benefits {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.benefits-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.benefits-title {
    font-size: 2.5rem;
    font-weight: 600;
    margin-bottom: 40px;
    background: var(--gradient-ai);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.benefits-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.benefit-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
}

.benefit-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(10px);
}

.benefit-icon {
    font-size: 1.5rem;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--gradient-ai);
}

.benefit-text h4 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-light);
}

.benefit-text p {
    color: var(--text-muted);
}

/* Elementi fluttuanti */
.benefits-visual {
    position: relative;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-elements {
    position: relative;
    width: 300px;
    height: 300px;
}

.floating-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    background: var(--gradient-ai);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--glow-blue);
    animation: float 6s ease-in-out infinite;
}

.floating-icon:nth-child(1) {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 0s;
}

.floating-icon:nth-child(2) {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    animation-delay: 1.5s;
}

.floating-icon:nth-child(3) {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    animation-delay: 3s;
}

.floating-icon:nth-child(4) {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation-delay: 4.5s;
}

.floating-icon::before {
    content: attr(data-icon);
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(10px, -10px) scale(1.1); }
    50% { transform: translate(-10px, -20px) scale(1); }
    75% { transform: translate(-15px, 10px) scale(1.05); }
}

/* CTA Section */
.cta {
    text-align: center;
    padding: 120px 0;
    background: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}

.cta-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 24px;
    background: var(--gradient-ai);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cta-description {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto 50px;
    line-height: 1.7;
}

/* Pulsante CTA 3D */
.cta-button {
    position: relative;
    padding: 20px 50px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    background: var(--gradient-ai);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transform: translateY(0);
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.cta-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.4);
}

.cta-button:active {
    transform: translateY(-2px);
}

.button-text {
    position: relative;
    z-index: 2;
}

.button-glow {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-ai);
    border-radius: 50px;
    filter: blur(20px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cta-button:hover .button-glow {
    opacity: 0.7;
}

.button-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.button-particles span {
    position: absolute;
    width: 4px;
    height: 4px;
    background: white;
    border-radius: 50%;
    animation: buttonParticles 2s ease-in-out infinite;
}

.button-particles span:nth-child(1) {
    animation-delay: 0s;
    top: -20px;
    left: -10px;
}

.button-particles span:nth-child(2) {
    animation-delay: 0.7s;
    top: -15px;
    left: 10px;
}

.button-particles span:nth-child(3) {
    animation-delay: 1.4s;
    top: -25px;
    left: 0px;
}

@keyframes buttonParticles {
    0% {
        transform: translateY(0) scale(0);
        opacity: 1;
    }
    100% {
        transform: translateY(-30px) scale(1);
        opacity: 0;
    }
}

.cta-note {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chatbot-container.active {
    opacity: 1;
    visibility: visible;
}

/* Chatbot Modal Content */
.chatbot-content {
    background: var(--bg-darker);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 800px;
    height: 80vh;
    max-height: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.chatbot-header {
    background: var(--gradient-ai);
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chatbot-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
    color: white;
}

.close-chatbot {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-chatbot:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.chatbot-body {
    flex: 1;
    padding: 0;
    position: relative;
    background: white;
}

/* Widget Chatbot fisso in basso a sinistra */
.fixed-chatbot-widget {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 999;
    opacity: 0.9;
    transition: all 0.3s ease;
}

.fixed-chatbot-widget:hover {
    opacity: 1;
    transform: translateY(-2px);
}

/* Personalizzazioni per il widget Retell AI */
.fixed-chatbot-widget iframe {
    border-radius: 15px !important;
    box-shadow: var(--glow-blue) !important;
    border: 2px solid rgba(99, 102, 241, 0.3) !important;
}

/* Animazioni per l'apertura del chatbot */
.chatbot-content {
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.chatbot-container.active .chatbot-content {
    transform: scale(1) translateY(0);
}

/* Stili per il chatbot nel modal */
#chatbot-modal-instance iframe {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
}

.hidden {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .hero-content,
    .benefits-content {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .cta-title {
        font-size: 2.2rem;
    }

    .explanation-grid {
        grid-template-columns: 1fr;
    }

    .ai-brain {
        width: 250px;
        height: 250px;
    }

    .benefits-visual {
        height: 300px;
    }

    .floating-elements {
        width: 250px;
        height: 250px;
    }
}

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

    .hero-title {
        font-size: 2rem;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .cta-title {
        font-size: 1.8rem;
    }

    .cta-button {
        padding: 16px 40px;
        font-size: 1.1rem;
    }
}