/* =================================================================
   DESIGN SYSTEM DEFINITIVO PER ANNOTA.AI
   ================================================================= */

/* --- 1. IMPOSTAZIONI GLOBALI E COLORI --- */
:root {
    --color-background: #0B0F19; /* Nero-blu profondo */
    --color-text: #E5E7EB;
    --color-text-muted: #9CA3AF;
    --color-accent: #8B5CF6; /* Viola/Indaco come colore primario */
    --color-border: rgba(255, 255, 255, 0.1);

    --bg-section-light: rgba(11, 15, 25, 0.6); /* Sfondo "chiaro", più trasparente */
    --bg-section-dark: rgba(17, 24, 39, 0.8); /* Sfondo "scuro", più opaco */
    --bg-card: rgba(23, 31, 46, 0.7);

    /* Variabili specifiche per l'Editor (Simulazione) */
    --line: rgba(255,255,255,0.15);
    --primary-color: #8B5CF6;
    --primary-hover: #7C3AED;
    --success-color: #10B981;
    --danger-color: #EF4444;
    
    /* Variabili Real Platform (High Fidelity) */
    --bg-panel: #1F2937;
    --bg-input: #111827;
    --bg-canvas: #000000;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    overflow-x: hidden; /* Prevenzione scroll orizzontale su mobile */
}
body.modal-open {
    overflow: hidden;
}

/* Scrollbar Custom per modali e contenuti */
.custom-scrollbar::-webkit-scrollbar { width: 6px; }
.custom-scrollbar::-webkit-scrollbar-track { background: #111827; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #4B5563; }

/* Hide scrollbar utility */
.scrollbar-hide::-webkit-scrollbar { display: none; }
.scrollbar-hide { -ms-overflow-style: none; scrollbar-width: none; }

/* --- 2. LAYOUT E SFONDI --- */
#particle-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    z-index: -1;
    pointer-events: none; /* Assicura che non blocchi i click */
}
header {
    z-index: 50;
    border-bottom: 1px solid var(--color-border);
}
main {
    position: relative;
    z-index: 1;
}
/* Sfondi di sezione alternati */
.bg-transparent {
    background-color: transparent;
}
.bg-alternate {
    background-color: var(--bg-section-dark);
    backdrop-filter: blur(16px);
}

/* --- 3. ELEMENTI DI DESIGN --- */
.gradient-text {
    background: linear-gradient(90deg, #A78BFA, #3B82F6, #EC4899);
    -webkit-background-clip: text;
    background-clip: text; 
    -webkit-text-fill-color: transparent;
    animation: gradient-animation 5s ease infinite;
    background-size: 200% auto;
}
@keyframes gradient-animation {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.cta-button {
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.2), 0 0 0 0 rgba(139, 92, 246, 0.7);
    cursor: pointer;
}
.cta-button:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3), 0 0 20px 4px rgba(139, 92, 246, 0.3);
}
.ghost-button {
    transition: all 0.3s ease;
    cursor: pointer;
}
.ghost-button:hover {
    transform: translateY(-3px);
    background-color: var(--color-accent);
    color: #ffffff;
    border-color: var(--color-accent);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}
.feature-card {
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid var(--color-border);
    background-color: var(--bg-card);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.feature-card:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.15);
}
.feature-card:hover svg.icon-svg {
    transform: scale(1.1);
}

/* --- EFFETTI TEAM MEMBER --- */
.team-avatar-container {
    width: 120px; height: 120px; /* Mobile friendly */
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid rgba(139, 92, 246, 0.3);
    margin-bottom: 1.5rem;
    position: relative;
    transition: all 0.4s ease;
    box-shadow: 0 0 20px rgba(0,0,0,0.3);
}
@media (min-width: 768px) {
    .team-avatar-container { width: 140px; height: 140px; }
}

.feature-card:hover .team-avatar-container {
    border-color: #8B5CF6;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.5);
    transform: scale(1.05);
}

.team-avatar-img {
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: grayscale(100%);
    transition: all 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    transform: scale(1.0);
}

.feature-card:hover .team-avatar-img {
    filter: grayscale(0%);
    transform: scale(1.1);
}

/* --- 4. NAVIGAZIONE --- */
nav a {
    transition: color 0.3s ease;
}
nav a.active {
    color: var(--color-accent);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}
.lang-dropdown { position: relative; }
.lang-dropdown-content {
    display: none; position: absolute; top: 100%; right: 0; /* Align right for mobile safety */
    background-color: #1F2937; border: 1px solid #374151;
    border-radius: 0.5rem; min-width: 140px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 10; margin-top: 8px; opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.lang-dropdown-content.show { display: block; opacity: 1; transform: translateY(0); }
.lang-option { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; cursor: pointer; transition: background-color 0.2s; }
.lang-option:hover { background-color: #374151; }

/* --- 5. COMPONENTI SPECIFICI --- */
.faq-item details > summary { list-style: none; cursor: pointer; }
.faq-item details > summary::-webkit-details-marker { display: none; }
.faq-item details[open] summary svg { transform: rotate(180deg); }
.modal-overlay { transition: opacity 0.3s ease; }
.modal-content { transition: all 0.3s ease; }
.form-input { background-color: #1F2937; border: 1px solid #374151; color: #F3F4F6; transition: all 0.3s ease; }
.form-input:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.4); }
.cookie-banner { transition: transform 0.5s ease-out, opacity 0.5s ease-out; }

.cookie-decline-button {
    background-color: transparent;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.cookie-decline-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* --- 6. LOGO SVG --- */
#header-logo-svg { transition: all 0.3s ease; }
#header-logo-svg .logo-path { fill-opacity: 0; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
#logo-icon .logo-path, #logo-text-annota .logo-path { stroke: #F3F4F6; fill: #F3F4F6; }
#logo-text-ai .logo-path { stroke: url(#logo-gradient-for-stroke); fill: url(#logo-gradient); }
@keyframes draw { 40% { stroke-dashoffset: 0; fill-opacity: 0; } 100% { stroke-dashoffset: 0; fill-opacity: 1; } }
#header-logo-svg.animate .logo-path { animation: draw 2s linear forwards; }

/* --- 7. SCORRIMENTO E ANIMAZIONI SEZIONI --- */
/* Disabilitato lo scroll snap rigido su mobile per fluidità */
@media (min-width: 1024px) {
    html { scroll-snap-type: y mandatory; }
    .full-page { scroll-snap-align: start; scroll-snap-stop: always; height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
    .section-content-wrapper { flex-grow: 1; overflow-y: auto; display: flex; align-items: center; justify-content: center; }
}
@media (max-width: 1023px) {
    .full-page { min-height: 100vh; padding-top: 4rem; } /* Padding per header fisso */
    .section-content-wrapper { padding-bottom: 2rem; }
}

@keyframes contentFadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
.section-content { opacity: 0; width: 100%; }
.section-content.in-view { animation: contentFadeInUp 0.8s 0.2s ease-out forwards; }

/* --- 8. ANIMAZIONI SVG AVANZATE (VECCHIE E NUOVE) --- */
.icon-svg { transition: transform 0.3s ease; }

/* NUOVE ANIMAZIONI PER LA SEZIONE "INCONTRA LUCY" */

/* 1. Flusso Dati in Ingresso (Flow In) */
.flow-in {
    animation: flowIn 4s infinite linear;
}
@keyframes flowIn {
    0% { transform: translateX(0); opacity: 0; }
    10% { opacity: 1; }
    40% { transform: translateX(120px); opacity: 1; } /* Entrano in Lucy */
    45% { opacity: 0; }
    100% { opacity: 0; }
}

/* 2. Processo Centrale (Pulse Brain) */
.process-pulse {
    animation: processPulse 2s infinite ease-in-out;
}
@keyframes processPulse {
    0% { r: 30; stroke-opacity: 0.5; }
    50% { r: 35; stroke-opacity: 1; filter: drop-shadow(0 0 5px #8B5CF6); }
    100% { r: 30; stroke-opacity: 0.5; }
}

.scan-vertical {
    animation: scanVertical 2s infinite linear;
}
@keyframes scanVertical {
    0% { transform: translateY(0); opacity: 0.2; }
    50% { transform: translateY(100px); opacity: 1; }
    100% { transform: translateY(0); opacity: 0.2; }
}

/* 3. Human Check Popup */
.human-check-popup {
    animation: humanCheckPopup 4s infinite ease-in-out;
    transform-origin: 300px 80px;
}
@keyframes humanCheckPopup {
    0%, 40% { transform: scale(0); opacity: 0; }
    45% { transform: scale(1.2); opacity: 1; }
    50% { transform: scale(1); opacity: 1; }
    55% { transform: scale(1); opacity: 1; }
    60% { transform: scale(0); opacity: 0; }
    100% { transform: scale(0); opacity: 0; }
}

/* 4. Output (Eject) */
.eject-out {
    animation: ejectOut 4s infinite linear;
}
@keyframes ejectOut {
    0% { transform: translateX(0); opacity: 0; }
    50% { transform: translateX(0); opacity: 0; }
    55% { opacity: 1; }
    100% { transform: translateX(100px); opacity: 0; }
}

/* ALTRE ANIMAZIONI ESISTENTI (Preservate) */
.animate-pulse-node { animation: pulseNode 2s infinite; }
@keyframes pulseNode { 0%, 100% { r: 2; opacity: 0.5; } 50% { r: 3; opacity: 1; box-shadow: 0 0 5px currentColor; } }
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }

.animate-blink { animation: eyeBlink 4s infinite; transform-origin: center; }
@keyframes eyeBlink { 0%, 48%, 52%, 100% { transform: scaleY(1); } 50% { transform: scaleY(0.1); } }

.animate-look-around { animation: lookAround 5s infinite ease-in-out; }
@keyframes lookAround { 0%, 100% { transform: translate(0, 0); } 20% { transform: translate(-3px, 0); } 40% { transform: translate(3px, 0); } 60% { transform: translate(0, -2px); } 80% { transform: translate(0, 2px); } }
.animate-scan-reticle { animation: scanReticle 3s infinite linear; transform-origin: center; }
@keyframes scanReticle { 0% { transform: rotate(0deg) scale(1); opacity: 0.8; } 50% { transform: rotate(180deg) scale(1.1); opacity: 1; } 100% { transform: rotate(360deg) scale(1); opacity: 0.8; } }

.animate-sound-wave { animation: soundWaveEmit 1.5s infinite ease-out; opacity: 0; }
@keyframes soundWaveEmit { 0% { transform: scale(0.8); opacity: 1; stroke-width: 2; } 100% { transform: scale(1.5); opacity: 0; stroke-width: 0; } }
.wave-delay-1 { animation-delay: 0s; }
.wave-delay-2 { animation-delay: 0.5s; }

/* ANIMAZIONI PER "PERCHE' NOI" */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-1px) rotate(-1deg); }
  20%, 40%, 60%, 80% { transform: translateX(1px) rotate(1deg); }
}
.animate-shake { animation: shake 3s infinite ease-in-out; transform-origin: center; }

@keyframes drawCheck {
  0% { stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; }
  50% { stroke-dashoffset: 0; opacity: 1; }
  100% { stroke-dashoffset: 0; opacity: 1; }
}
.animate-draw-check { animation: drawCheck 3s infinite ease-in-out; }

@keyframes grow-bar {
  0% { transform: scaleY(0.3); opacity: 0.5; }
  100% { transform: scaleY(1); opacity: 1; }
}
.animate-grow-bar { transform-origin: bottom; animation: grow-bar 1.5s infinite alternate ease-in-out; }

@keyframes pulse-chip {
  0% { stroke-width: 1; opacity: 0.7; transform: scale(1); }
  50% { stroke-width: 2; opacity: 1; transform: scale(1.05); filter: drop-shadow(0 0 2px currentColor); }
  100% { stroke-width: 1; opacity: 0.7; transform: scale(1); }
}
.animate-pulse-chip { animation: pulse-chip 2s infinite ease-in-out; transform-origin: center; }

/* ANIMAZIONI PER "COME FUNZIONA" */
@keyframes flow {
  0% { stroke-dasharray: 5; stroke-dashoffset: 20; }
  100% { stroke-dasharray: 5; stroke-dashoffset: 0; }
}
.animate-flow path { animation: flow 1s linear infinite; }
@keyframes flashConnection {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}
.animate-flash { animation: flashConnection 2s infinite; }

@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.animate-spin-slow { animation: spin-slow 8s linear infinite; transform-origin: center; }

@keyframes bounce-small {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.animate-bounce-small { animation: bounce-small 2s infinite ease-in-out; }


/* --- 9. GRECAPTCHA --- */
.grecaptcha-badge { visibility: hidden; }

/* =================================================================
   10. STILI PIATTAFORMA REALE (RESPONSIVE UPDATE)
   ================================================================= */

.lucy-ide-container {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #0B0F19;
    display: flex;
    flex-direction: column;
    /* Altezza flessibile su mobile, fissa su desktop */
    height: auto; 
}
@media (min-width: 768px) {
    .lucy-ide-container { height: 700px; }
}

.ide-header {
    background: #1F2937;
    border-bottom: 1px solid var(--line);
    padding: 0 16px;
    height: 48px; /* Leggermente più alto per touch */
    display: flex;
    align-items: center;
    gap: 16px;
    overflow-x: auto; /* Scroll orizzontale su mobile */
}

.ide-tab {
    height: 100%;
    padding: 0 16px;
    display: flex;
    align-items: center;
    font-size: 13px;
    color: #9CA3AF;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap; /* Previene a capo */
}
.ide-tab:hover { color: white; background: rgba(255,255,255,0.03); }
.ide-tab.active {
    color: white;
    border-bottom-color: var(--primary-color);
    background: rgba(139, 92, 246, 0.1);
}

.platform-wrapper {
    font-size: 13px;
    color: #d1d5db;
    display: flex;
    flex-direction: column;
    gap: 10px;
    /* Su mobile l'altezza è determinata dal contenuto, su desktop riempie */
    height: 100%;
}

/* Toolbar Responsiva */
.toolbar {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    min-height: 52px;
    gap: 8px;
    flex-wrap: wrap; /* A capo su schermi piccoli */
}

/* Grid Split Responsiva */
.grid.split {
    display: flex;
    flex-direction: column; /* Mobile first: impilato */
    gap: 12px;
    flex: 1;
    height: auto; /* Lascia che cresca su mobile */
    overflow: visible;
}

@media (min-width: 1024px) {
    .grid.split {
        display: grid;
        /* MODIFICA: Ridotto pannello JSON da 400px a 320px per dare più spazio all'editor */
        grid-template-columns: 1fr 8px 320px; 
        gap: 0;
        height: 100%;
        overflow: hidden; 
    }
    .col-resizer { display: flex; } /* Mostra resizer solo su desktop */
}

.col-resizer {
    cursor: col-resize;
    background: transparent;
    display: none; /* Nascondi su mobile */
    align-items: center;
    justify-content: center;
}
.col-resizer::after {
    content: '';
    width: 4px; height: 40px;
    background: var(--line);
    border-radius: 2px;
}

.card {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.left-card { 
    flex: 1; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    min-height: 400px; /* Altezza minima su mobile */
}
.right-card { 
    display: flex; 
    flex-direction: column; 
    gap: 10px; 
    min-height: 200px; /* Altezza minima su mobile */
}
@media (min-width: 1024px) {
    .right-card { overflow: hidden; min-height: auto; }
}

.btn {
    background: #374151;
    border: 1px solid var(--line);
    color: #e5e7eb;
    padding: 8px 12px; /* Touch target più grande */
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex; align-items: center; justify-content: center;
}
.btn:hover { background: #4B5563; color: white; }

.btn-primary-style {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}
.btn-primary-style:hover { background: var(--primary-hover); }

.row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.row label {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    min-width: 60px;
}

/* Input e Textarea Simulazione */
.lucy-ide-container input[type="text"], 
.lucy-ide-container input[type="number"], 
.lucy-ide-container textarea, 
.lucy-ide-container select {
    background: var(--bg-input);
    border: 1px solid var(--line);
    color: #fff;
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Inter', sans-serif;
    width: auto;
    max-width: 100%;
}
.lucy-ide-container textarea {
    font-family: 'Monaco', 'Consolas', monospace;
    resize: none;
    line-height: 1.4;
    width: 100%;
}
.lucy-ide-container input:focus, .lucy-ide-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.canvas-wrap {
    flex: 1;
    background: var(--bg-canvas);
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Altezza gestita dal JS, ma min-height CSS aiuta */
    min-height: 300px;
}

.sim-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.sim-table th {
    text-align: left;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--line);
    padding: 6px;
}
.sim-table td {
    padding: 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sim-table tr:hover td { background: rgba(255,255,255,0.03); }

.lucy-typing::after {
    content: '|';
    animation: blink 1s step-start infinite;
    color: var(--primary-color);
}
@keyframes blink { 50% { opacity: 0; } }