/* Google Fonts import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===== GLOBAL: Hide all scrollbars (still scrollable) ===== */
* {
    scrollbar-width: none;
    -ms-overflow-style: none;
}

*::-webkit-scrollbar {
    display: none;
}

/* ================================================================
   VARIABILI BRAND - Palette colori rifinita (70% neutri / 20% azzurro / 10% accenti)
   ================================================================ */
:root {
    /* Colori Brand Primari */
    --primary-color: #2DB6E8;
    /* Azzurro brand - 20% */
    --primary-dark: #1E6F9A;
    /* Blu profondo - supporto primario */
    --primary-light: #E0F6FB;
    /* Azzurro molto chiaro - sfondo */

    /* Accenti Funzionali */
    --accent-warm: #D6453D;
    /* Rosso - errori, alert, azioni critiche */
    --accent-success: #3FAE6B;
    /* Verde - successo, conferme */

    /* Sfondo e Superfici - 70% neutri */
    --bg-color: #FAFAFA;
    /* Sfondo principale - quasi bianco */
    --card-bg: #F0F3F5;
    /* Sfondo card e sezioni */
    --bg-light: #FFFFFF;
    /* Bianco puro per card elevation */

    /* Testo - Gerarchia di contrasto */
    --text-main: #1F2933;
    /* Titoli e testo principale - WCAG AAA */
    --text-body: #4B5563;
    /* Testo corpo - WCAG AA */
    --text-muted: #7A8A99;
    /* Testo secondario - 5.5:1 contrast */
    --text-light: #B0B8C1;
    /* Testo disabilitato - 4.5:1 contrast */

    /* Bordi e Divisori */
    --border-color: #D9E1E9;
    /* Bordi - contrasto morbido */
    --border-light: #E8EDEF;
    /* Bordi chiari */
    --nav-bg: rgba(250, 250, 250, 0.98);
    /* Navbar con blur */

    /* Font */
    --font-main: 'Inter', sans-serif;

    /* Ombre - discrete e professionali */
    --shadow-sm: 0 1px 2px rgba(31, 41, 51, 0.05);
    --shadow-md: 0 2px 8px rgba(31, 41, 51, 0.08);
    --shadow-lg: 0 4px 16px rgba(31, 41, 51, 0.1);
    --shadow-xl: 0 8px 24px rgba(31, 41, 51, 0.12);

    /* Transizioni */
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
    --transition-slow: 0.5s ease-in-out;
}

/* Dark mode - adattamento intelligente */
[data-theme="dark"] {
    --bg-color: #0F1419;
    --card-bg: #1A1F28;
    --bg-light: #232A35;
    --text-main: #F1F5F9;
    --text-body: #CBD5E1;
    --text-muted: #94A3B8;
    --text-light: #64748B;
    --border-color: #334155;
    --border-light: #475569;
    --nav-bg: rgba(15, 20, 25, 0.98);
    --primary-light: #1A4D63;
}

/* ================================================================
   RESET GLOBALE
   ================================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-body);
    line-height: 1.6;
    transition: background-color var(--transition-normal),
        color var(--transition-normal);
}

a {
    text-decoration: none;
    color: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ================================================================
   HEADER E NAVIGAZIONE
   ================================================================ */
header {
    background: var(--nav-bg);
    padding: 16px 0;
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 30px;
}

.logo {
    font-weight: 800;
    font-size: 1.5em;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    transition: color var(--transition-normal);
}

.logo:hover {
    color: var(--primary-dark);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ================================================================
   SELEZIONE LINGUA
   ================================================================ */
.lang-select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-body);
    font-family: var(--font-main);
    cursor: pointer;
    outline: none;
    font-size: 0.9em;
    font-weight: 500;
    transition: border-color var(--transition-fast),
        background-color var(--transition-fast);
}

.lang-select:hover,
.lang-select:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-light);
}

/* ================================================================
   PULSANTE PROFILO E DROPDOWN
   ================================================================ */
.user-menu-container {
    position: relative;
}

.profile-button {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    color: var(--primary-color);
    transition: border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.profile-button:hover {
    border-color: var(--primary-color);
    background-color: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.profile-button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.profile-icon {
    width: 20px;
    height: 20px;
}

.profile-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    min-width: 200px;
    padding: 8px 0;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 1100;
}

.profile-dropdown a {
    padding: 10px 16px;
    color: var(--text-body);
    font-weight: 500;
    transition: background-color var(--transition-fast),
        color var(--transition-fast);
    font-size: 0.9em;
}

.profile-dropdown a:hover {
    background-color: var(--card-bg);
    color: var(--primary-color);
}

.profile-dropdown a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.dropdown-divider {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 4px 0;
}

.hidden {
    display: none !important;
}

/* ================================================================
   SWITCH TEMA (DARK MODE)
   ================================================================ */
.dropdown-item-switch {
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-body);
    font-weight: 500;
    font-size: 0.9em;
}

.theme-switch-wrapper {
    display: flex;
    align-items: center;
}

.theme-checkbox {
    display: none;
}

.theme-label {
    background-color: var(--text-muted);
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px;
    position: relative;
    height: 24px;
    width: 48px;
    transition: background-color var(--transition-normal);
}

.theme-label .ball {
    background-color: var(--bg-light);
    border-radius: 50%;
    position: absolute;
    top: 2px;
    left: 2px;
    height: 20px;
    width: 20px;
    transition: transform var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.theme-checkbox:checked+.theme-label {
    background-color: var(--primary-color);
}

.theme-checkbox:checked+.theme-label .ball {
    transform: translateX(24px);
}

.theme-label:focus-within {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.fa-moon {
    color: #FCD34D;
    font-size: 10px;
}

.fa-sun {
    color: #FBBF24;
    font-size: 10px;
}

/* ================================================================
   PULSANTI - Configurazione completa
   ================================================================ */
.button,
.btn-auth,
.translate-btn,
.swap-btn,
.copy-btn {
    font-family: var(--font-main);
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-weight: 600;
    border: none;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Pulsante CTA Primario */
.cta-primary,
.button.cta-primary {
    background-color: var(--primary-color);
    color: var(--bg-light);
    padding: 15px 40px;
    font-size: 1em;
}

.cta-primary:hover:not(:disabled),
.button.cta-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.cta-primary:active:not(:disabled),
.button.cta-primary:active:not(:disabled) {
    transform: translateY(0);
}

.cta-primary:focus,
.button.cta-primary:focus {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.cta-primary:disabled,
.button.cta-primary:disabled {
    background-color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Pulsante Autenticazione */
.btn-auth {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: var(--bg-light);
    font-size: 1em;
    margin-top: 10px;
}

.btn-auth:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-auth:focus {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

.btn-auth:disabled {
    background-color: var(--text-light);
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pulsante Traduzione */
.translate-btn {
    width: 100%;
    padding: 15px;
    background: var(--primary-color);
    color: var(--bg-light);
    font-size: 1em;
}

.translate-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.translate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Pulsante Swap Lingue */
.swap-btn {
    background: var(--primary-color);
    color: var(--bg-light);
    width: 45px;
    height: 45px;
    padding: 0;
    font-size: 1.2em;
    margin-top: 25px;
}

.swap-btn:hover {
    background: var(--primary-dark);
    transform: rotate(180deg);
    box-shadow: var(--shadow-md);
}

.swap-btn:focus {
    outline: 2px solid var(--primary-dark);
    outline-offset: 2px;
}

/* Pulsante Copia */
.copy-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: var(--accent-success);
    color: var(--bg-light);
    padding: 6px 12px;
    font-size: 0.85em;
    opacity: 0;
}

.text-box:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: #2d8e56;
    box-shadow: var(--shadow-sm);
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9em;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 1em;
    transition: border-color var(--transition-fast),
        background-color var(--transition-fast),
        box-shadow var(--transition-fast);
    box-sizing: border-box;
}

.form-control:hover {
    border-color: var(--primary-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* ================================================================
   MESSAGGI DI FEEDBACK
   ================================================================ */
.error-message {
    background: #FEE5E5;
    color: #AE2626;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    display: none;
    border-left: 4px solid var(--accent-warm);
}

[data-theme="dark"] .error-message {
    background: #7F1D1D;
    color: #FCA5A5;
    border-left-color: #D6453D;
}

.success-message {
    background: #E8F8F0;
    color: #2d8e56;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
    display: none;
    border-left: 4px solid var(--accent-success);
}

[data-theme="dark"] .success-message {
    background: #1B4D3A;
    color: #6EE7B7;
    border-left-color: #3FAE6B;
}

/* ================================================================
   CARD E SEZIONI
   ================================================================ */
.translator-card,
.link-card,
.auth-card,
.step {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 30px;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.link-card:hover,
.step:hover {
    transform: translateY(-4px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.auth-card {
    box-shadow: var(--shadow-lg);
}

/* ================================================================
   TITOLI E GERARCHIE TESTUALI
   ================================================================ */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-main);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: 3.5em;
    font-weight: 800;
}

h2 {
    font-size: 2.5em;
    font-weight: 800;
}

h3 {
    font-size: 1.8em;
    font-weight: 700;
}

h4 {
    font-size: 1.2em;
    font-weight: 600;
}

/* ================================================================
   SEZIONI HERO E CONTENUTI
   ================================================================ */
.hero-section {
    background: var(--bg-color);
    padding: 100px 20px;
    text-align: center;
}

.hero-section h2 {
    color: var(--text-main);
    margin-bottom: 20px;
}

.hero-section p {
    color: var(--text-muted);
    font-size: 1.3em;
    margin-bottom: 40px;
}

.section-title h3,
.section-heading {
    text-align: center;
    font-size: 2.2em;
    margin-bottom: 40px;
    color: var(--text-main);
}

.section-title p {
    text-align: center;
    color: var(--text-body);
    font-size: 1.1em;
    margin-top: 10px;
}

/* ================================================================
   CARD DI FUNZIONALITÀ
   ================================================================ */
.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.link-card h4 {
    margin: 10px 0;
    color: var(--text-main);
}

.link-card p {
    font-size: 0.95em;
    color: var(--text-body);
    line-height: 1.5;
}

.feature-icon {
    width: 60px;
    height: 60px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-radius: 12px;
    color: var(--bg-light);
    font-size: 1.8em;
    box-shadow: var(--shadow-md);
}

/* ================================================================
   SEZIONE TRADUZIONI
   ================================================================ */
.translator-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.welcome-banner {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--bg-light);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.welcome-banner h2 {
    margin: 0;
    font-size: 1.6em;
    color: var(--bg-light);
}

.translator-header {
    text-align: center;
    margin-bottom: 30px;
}

.translator-header h3 {
    color: var(--text-main);
    font-size: 1.8em;
    margin-bottom: 10px;
}

.translator-header p {
    color: var(--text-muted);
}

.language-selector-row {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
    justify-content: center;
}

.lang-dropdown {
    flex: 1;
    max-width: 200px;
}

.lang-dropdown label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.9em;
}

.lang-dropdown select {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--card-bg);
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 1em;
    cursor: pointer;
    transition: border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.lang-dropdown select:hover {
    border-color: var(--primary-color);
}

.lang-dropdown select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.translation-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.text-box {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    min-height: 200px;
    position: relative;
    transition: border-color var(--transition-fast);
}

.text-box:hover {
    border-color: var(--primary-color);
}

.text-box textarea {
    width: 100%;
    height: 180px;
    border: none;
    background: transparent;
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 1em;
    resize: none;
    outline: none;
}

.text-box textarea::placeholder {
    color: var(--text-muted);
}

.output-text {
    color: var(--text-body);
    font-family: var(--font-main);
    font-size: 1em;
    line-height: 1.6;
    min-height: 180px;
    white-space: pre-wrap;
    word-break: break-word;
}

.char-count {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-top: 10px;
}

/* ================================================================
   STATI DI CARICAMENTO
   ================================================================ */
.loading {
    display: inline-block;
    color: var(--primary-color);
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ================================================================
   SEZIONE FOOTER
   ================================================================ */
footer {
    background: var(--card-bg);
    padding: 30px 20px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.9em;
}

/* ================================================================
   SEZIONE ABOUT E CONTACT
   ================================================================ */
.about-section,
.contact-section {
    padding: 80px 20px;
}

.about-section {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
}

.contact-section {
    background: var(--bg-color);
}

.about-content,
.contact-content {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.about-content h3,
.contact-content h3 {
    font-size: 2.5em;
    margin-bottom: 20px;
}

.about-content p,
.contact-content p {
    font-size: 1.1em;
    line-height: 1.8;
    color: var(--text-body);
    margin-bottom: 15px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 30px;
}

.contact-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--text-body);
    font-size: 1.1em;
}

.contact-item i {
    color: var(--primary-color);
    font-size: 1.5em;
}

/* ================================================================
   CTA SECTION
   ================================================================ */
.cta-section {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--bg-light);
    text-align: center;
    padding: 60px 20px;
}

.cta-section h3 {
    font-size: 2.2em;
    margin-bottom: 30px;
    color: var(--bg-light);
}

.cta-section p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 30px;
    font-size: 1.1em;
}

/* ================================================================
   STEP GRID
   ================================================================ */
.how-it-works {
    background: var(--bg-color);
    padding: 80px 0;
}

.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

.step {
    text-align: center;
    padding: 40px 20px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: var(--bg-light);
    font-size: 1.8em;
    font-weight: 800;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}

.step h4 {
    color: var(--text-main);
    margin-bottom: 10px;
}

.step p {
    color: var(--text-body);
}

/* ================================================================
   RESPONSIVE DESIGN
   ================================================================ */
@media (max-width: 768px) {
    .logo {
        font-size: 1.3em;
    }

    .translation-area {
        grid-template-columns: 1fr;
    }

    .language-selector-row {
        flex-direction: column;
    }

    .lang-dropdown {
        max-width: 100%;
    }

    .nav-menu {
        display: none;
    }

    .hero-section h2 {
        font-size: 2.2em;
    }

    .features-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .steps {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .section-title h3,
    .section-heading {
        font-size: 1.8em;
    }
}

@media (max-width: 600px) {
    .hero-section h2 {
        font-size: 1.8em;
    }

    h1 {
        font-size: 2.2em;
    }

    h2 {
        font-size: 1.8em;
    }

    h3 {
        font-size: 1.4em;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .about-content h3,
    .contact-content h3 {
        font-size: 1.8em;
    }

    .cta-section h3 {
        font-size: 1.6em;
    }

    .button,
    .btn-auth {
        width: 100%;
    }

    .swap-btn {
        width: 40px;
        height: 40px;
        font-size: 1em;
    }
}