/* Miglioramenti per un design più professionale */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --shadow-light: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-heavy: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius-sm: 6px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
}

/* Tema scuro (default) */
:root[data-theme="dark"] {
    --primary-color: #0056b3;
    --secondary-color: #6c5ce7;
    --background-color: #0a0e14;
    --card-background: #161b22;
    --text-color: #f0f6fc;
    --text-secondary: #a3b1c2;
    --border-color: #30363d;
    --hover-color: #2c3448;
    --accent-color: #58a6ff;
    --glass-background: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-backdrop: blur(10px);
}

/* Tema chiaro */
:root[data-theme="light"] {
    --primary-color: #2563eb;
    --secondary-color: #7c3aed;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-color: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --hover-color: #f1f5f9;
    --accent-color: #3b82f6;
    --glass-background: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
    --glass-backdrop: blur(10px);
}

/* Aggiungi il selettore del tema nella parte superiore della pagina */
.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px; /* Spostato da right a left */
    background: var(--glass-background);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 8px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--glass-shadow);
}

.theme-toggle:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
}

.theme-toggle span {
    color: var(--text-color);
    font-size: 14px;
}
        
        .file-icon {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-right: 8px;
            color: var(--accent-color);
        }
        
        .file-icon .material-symbols-outlined {
            font-size: 20px;
        }
        
        /* Logo EchoChat */
        .echochat-logo {
            display: flex;
            align-items: center;
            margin-right: 10px;
            font-weight: 600;
            color: var(--text-color);
            font-size: 1.1rem;
            letter-spacing: -0.5px;
        }
        
        .echochat-logo-text {
            margin-left: 8px;
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Inter', 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }
        
        body {
            background-color: var(--background-color);
            color: var(--text-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            min-height: 100vh;
            padding: 40px 20px;
            line-height: 1.6;
        }
        
        /* Header più elegante */
        .header {
            width: 100%;
            max-width: 800px;
            text-align: center;
            margin-bottom: 40px;
            position: relative;
            padding: 40px 20px;
            border-radius: var(--border-radius-lg);
            box-shadow: var(--shadow-heavy);
            margin-bottom: 30px;
            overflow: hidden;
        }
        
        .header::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="%23ffffff" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>') repeat;
            pointer-events: none;
        }
        
        h1 {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 12px;
            background: linear-gradient(45deg, #ffffff, #000000);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            letter-spacing: -0.5px;
        }
        
        h2 {
            font-size: 1.2rem;
            font-weight: 400;
            opacity: 0.9;
            color: var(--text-secondary);
            letter-spacing: -0.3px;
            /* Aggiungiamo le keyword per SEO qui, in modo nascosto se preferisci, o integrato nel testo */
            /* Esempio di integrazione: EchoChat, il chatbot AI per l'Italia (ita) */
        }
        
        /* Stile per l'etichetta sopra la barra di input */
.input-label {
    text-align: center;
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 12px;
    margin-top: 0;
    transition: opacity 0.3s ease-out;
}
        
/* Input area più grande e centrata */
.input-area {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    position: relative; /* Inizialmente posizione relativa (non fixed) */
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1); /* Animazione più fluida */
    z-index: 100;
    bottom: 0;
}

/* Classe attiva quando l'utente inizia a scrivere */
.input-area.active {
    position: fixed; /* Diventa fixed quando attivo */
    bottom: 20px; /* Posizionato più in alto rispetto al fondo */
    left: 50%;
    transform: translateX(-50%);
}

/* Nascondi l'etichetta quando attivo */
.input-area.active .input-label {
    opacity: 0;
}

        .input-container,
        .file-preview-container,
        .file-content-container,
        .user-entry,
        .bot-entry,
        .footer {
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            box-shadow: var(--glass-shadow);
        }
        
/* Input area più moderna */
.input-container {
            position: static;
            width: 100%;
            max-width: 800px;
            min-height: 60px;
            max-height: 200px;
            display: flex;
            align-items: center;
            background: rgba(255, 255, 255, 0.15);
            border-radius: 20px;
            padding: 15px;
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            z-index: auto;
            margin: 0 auto;
            box-sizing: border-box;
            transition: height 0.2s ease;
            overflow: hidden;
        }
textarea#userInput {
    flex: 1;
    height: auto; /* Altezza automatica per adattarsi al contenuto */
    max-height: 170px; /* Altezza massima per evitare che occupi troppo spazio */
    font-size: 1.0rem;
    padding: 10px 10px 10px 40px; /* Aumentato il padding a sinistra per evitare sovrapposizioni */
    resize: none;
    overflow-y: auto; /* Aggiunge scrollbar verticale se necessario */
    line-height: 1.5; /* Migliora la leggibilità del testo */
}
        
        .input-container:focus-within {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1), var(--shadow-medium);
            transform: translateY(-2px); /* Effetto di sollevamento quando in focus */
        }
        
        .logo {
            width: 28px;
            height: 28px;
            margin-right: 14px;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-color);
            font-weight: bold;
            font-size: 14px;
            cursor: pointer;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .plus-icon {
            margin-right: 8px;
            color: var(--text-secondary);
            font-size: 16px;
        }
        .animated-btn.image-btn {
    animation: pulse-image 2s infinite;
}

/* Modifica l'animazione esistente per video-btn */
.animated-btn.video-btn {
    animation: pulse-video 2s infinite;
}
@keyframes pulse-image {
    0% { box-shadow: 0 0 0 0 rgba(79, 192, 210, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(79, 192, 210, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 192, 210, 0); }
}

@keyframes pulse-video {
    0% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(229, 57, 53, 0); }
    100% { box-shadow: 0 0 0 0 rgba(229, 57, 53, 0); }
}
        
        textarea {
            flex-grow: 1;
            background: transparent;
            border: none;
            outline: none;
            color: var(--text-color);
            font-size: 1rem;
            padding: 8px 0;
            overflow-y: auto; /* Cambiato da hidden a auto per permettere lo scrolling se necessario */
            resize: none;
            min-height: 30px;
            transition: height 0.2s ease; /* Aggiunge una transizione fluida per il cambio di altezza */
        }

        textarea:focus {
            border: none;
            box-shadow: none;
        }
        
        textarea::placeholder {
            color: var(--text-secondary);
        }
        
        .mic-icon {
            color: var(--text-secondary);
            font-size: 20px;
            margin-left: 8px;
            transition: color 0.2s;
        }
        
        .mic-icon:hover {
            color: var(--accent-color);
        }
        
        /* Pulsanti di allegato migliorati */
        .attachment-icon {
            color: var(--text-secondary);
            font-size: 24px;
            margin-left: 8px;
            margin-top: 4px;
            transition: all 0.2s ease;
            cursor: pointer;
            background: var(--card-background);
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            border: 1px solid var(--border-color);
        }
        
        .attachment-icon:hover {
            background: var(--accent-color);
            color: white;
            transform: scale(1.1);
            box-shadow: var(--shadow-medium);
        }
        
        .file-preview-container {
            width: 100%;
            max-width: 800px;
            margin: 15px 0;
            padding: 10px;
            background: var(--card-background);
            border-radius: 8px;
            border: 1px solid var(--border-color);
            display: none;
        }
        
        .file-preview-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }
        
        .file-name {
            font-size: 0.9rem;
            color: var(--text-color);
            word-break: break-all;
        }
        
        .file-preview-content {
            max-height: 150px;
            overflow-y: auto;
            background: rgba(0, 0, 0, 0.2);
            padding: 8px;
            border-radius: 4px;
            font-family: monospace;
            font-size: 0.85rem;
            color: var(--text-secondary);
            white-space: pre-wrap;
        }
        
        .remove-file {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1rem;
        }
        
        .remove-file:hover {
            color: #f44336;
        }
        
        .file-content-container {
            width: 100%;
            max-width: 800px;
            margin: 15px 0;
            background: var(--card-background);
            border-radius: 12px;
            border: 1px solid var(--border-color);
            overflow: hidden;
        }
        
        .file-header {
            padding: 12px 16px;
            background: rgba(0, 0, 0, 0.2);
            border-bottom: 1px solid var(--border-color);
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        
        .file-title {
            display: flex;
            align-items: center;
            gap: 10px;
            font-weight: 500;
            color: var(--text-color);
        }
        
        .file-metadata {
            font-size: 0.8rem;
            color: var(--text-secondary);
        }
        
        .file-body {
            padding: 16px;
        }
        
        .conversation-entry {
            margin-bottom: 16px;
            padding-bottom: 16px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        }
        
        .conversation-entry:last-child {
            border-bottom: none;
            margin-bottom: 0;
            padding-bottom: 0;
        }
        
        .conversation-timestamp {
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-bottom: 8px;
        }
        
        .conversation-message {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }
        
        .user-entry, .bot-entry {
            padding: 10px 14px;
            border-radius: 8px;
            max-width: 90%;
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            box-shadow: var(--glass-shadow);
        }
        
        .user-entry {
            background: rgba(88, 166, 255, 0.1);
            align-self: flex-end;
            margin-left: auto;
        }
        
        .bot-entry {
            background: rgba(255, 255, 255, 0.05);
            align-self: flex-start;
        }
        
        .sender-name {
            font-weight: 500;
            margin-bottom: 4px;
        }
        
        .user-name {
            color: var(--accent-color);
        }
        
        .bot-name {
            color: #a3b1c2;
        }

        
        .suggestions {
            display: flex;
            flex-wrap: wrap;
            justify-content: center;
            gap: 12px;
            margin: 24px 0;
            max-width: 800px;
        }
        
        /* Suggerimenti più accattivanti */
        .suggestion-btn {
            background: var(--glass-background);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            color: var(--text-color);
            border: 1px solid var(--glass-border);
            border-radius: var(--border-radius-lg);
            padding: 12px 24px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.3s ease;
            position: relative;
            overflow: hidden;
        }
        
        .suggestion-btn::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;
        }
        
        .suggestion-btn:hover::before {
            left: 100%;
        }
        
        .suggestion-btn:hover {
            transform: translateY(-3px);
            box-shadow: var(--shadow-heavy);
            border-color: var(--accent-color);
        }
        
        .footer {
            width: 100%;
            max-width: 800px;
            padding: 30px 20px;
            margin-top: 40px;
            border-top: 1px solid var(--border-color);
            display: flex;
            flex-direction: column;
            gap: 20px;
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            box-shadow: var(--glass-shadow);
            border-radius: 12px;

        }

        /* Aggiungi la sezione donazioni prima del footer-nav */
        .donation-section-container {
            text-align: center;
            padding: 20px 0;
        }
        
        .footer-nav {
            display: flex;
            justify-content: center;
            flex-wrap: wrap;
            gap: 16px;
        }
        
        .footer-link {
            color: var(--accent-color);
            text-decoration: none;
            padding: 8px 16px;
            border-radius: 8px;
            transition: all 0.2s ease;
            font-size: 0.9rem;
            position: relative;
        }
        
        .footer-link:hover {
            background: rgba(88, 166, 255, 0.1);
        }
        
        .footer-link::after {
            content: '•';
            position: absolute;
            right: -10px;
            color: var(--border-color);
        }
        
        .footer-link:last-child::after {
            display: none;
        }
        
        .footer-disclaimer {
            text-align: center;
            color: var(--text-secondary);
            font-size: 0.85rem;
            line-height: 1.5;
            max-width: 600px;
            margin: 0 auto;
            padding: 15px;
            background: rgba(0, 0, 0, 0.2);
            border-radius: 8px;
        }
        
        .footer a {
            color: var(--accent-color);
            text-decoration: none;
            transition: opacity 0.2s;
        }
        
        .footer a:hover {
            opacity: 0.8;
            text-decoration: underline;
        }

        .donation-section {
            text-align: center;
            margin-bottom: 20px; /* Aggiunge spazio sotto la sezione donazioni */
        }

        .donate-button {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            color: white;
            padding: 12px 25px;
            border: none;
            border-radius: 25px;
            font-size: 1.1rem;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.3s ease, box-shadow 0.3s ease;
            text-decoration: none; /* Rimuove la sottolineatura del link */
            display: inline-block; /* Per permettere transform e padding corretti */
            margin-right: 10px; /* Spazio tra il pulsante e l'icona info */
        }

        .donate-button:hover {
            transform: scale(1.05);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        }

        .donation-info-link {
            color: var(--text-secondary);
            font-size: 0.9rem;
            text-decoration: none;
        }

        .donation-info-link:hover {
            color: var(--accent-color);
            text-decoration: underline;
        }
        
        .login-btn {
            position: absolute;
            top: 20px;
            right: 20px;
            background-color: #30363d;
            color: #e6edf3;
            border: none;
            border-radius: 18px;
            padding: 8px 16px;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            cursor: pointer;
        }
        
        .login-btn svg {
            margin-left: 8px;
        }
        
        .home-icon {
            position: absolute;
            top: 20px;
            left: 20px;
            width: 40px;
            height: 40px;
            cursor: pointer;
            transition: transform 0.2s;
        }
        
        .home-icon:hover {
            transform: scale(1.1);
        }
        
        /* Anteprima immagini migliorata */
        .image-preview-container {
            width: 100%;
            max-width: 800px;
            margin: 15px 0;
            padding: 20px;
            background: var(--glass-background);
            backdrop-filter: blur(15px);
            -webkit-backdrop-filter: blur(15px);
            border-radius: var(--border-radius-md);
            border: 2px dashed var(--border-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
            transition: all 0.3s ease;
        }

        .image-preview-container:hover {
            border-color: var(--accent-color);
            background: rgba(88, 166, 255, 0.05);
        }

        .image-preview-container img {
            max-width: 100%;
            height: auto;
            border-radius: var(--border-radius-sm);
            box-shadow: var(--shadow-medium);
            transition: transform 0.2s ease;
        }

        .preview-image {
            border-radius: var(--border-radius-sm);
            box-shadow: var(--shadow-medium);
            transition: transform 0.2s ease;
        }

        .preview-image:hover {
            transform: scale(1.02);
        }

        .image-preview-title {
            color: var(--text-color);
            font-size: 1rem;
            font-weight: 500;
            margin-bottom: 10px;
        }

        .image-actions {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }

        .image-action-btn {
            padding: 8px 16px;
            border-radius: 6px;
            border: none;
            background: var(--accent-color);
            color: white;
            cursor: pointer;
            transition: opacity 0.2s;
        }

        .image-action-btn:hover {
            opacity: 0.9;
        }

        /* Overlay styles for chart and coding mode */
        .overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.overlay-content {
    background: #1c2333;
    padding: 30px;
    border-radius: 12px;
    position: relative;
    max-width: 90%;
    width: 400px;
    animation: slideIn 0.3s ease;
}

.profile-info {
    text-align: center;
    margin-bottom: 30px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #00a0d2, #7b68ee);
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
    font-weight: bold;
}

.profile-name {
    font-size: 24px;
    margin-bottom: 5px;
    color: #e6edf3;
}

.profile-email {
    color: #8b949e;
    font-size: 14px;
}

.overlay-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.overlay-actions button {
    padding: 12px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.overlay-actions button:hover {
    opacity: 0.9;
}

.settings-btn-overlay {
    background: #238636;
    color: white;
}

.change-password-btn {
    background: #1f6feb;
    color: white;
}

.logout-btn {
    background: #da3633;
    color: white;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e6edf3;
    font-size: 14px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #30363d;
    border-radius: 6px;
    background: #0d1117;
    color: #e6edf3;
    font-size: 14px;
}

.form-group input:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.save-settings-btn {
    width: 100%;
    padding: 12px;
    background: #238636;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.save-settings-btn:hover {
    opacity: 0.9;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        
        .overlay-content {
            /* Replace solid background with glass effect */
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 8px;
        }
        
        .overlay-content h2 {
            margin-bottom: 15px;
        }
        
        .overlay-content button {
            /* Change background from dark/solid to glass effect */
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            border-radius: 8px;
            padding: 10px 16px;
            cursor: pointer;
            transition: transform 0.2s, opacity 0.2s;
        }
        
        .overlay-content button:hover {
            transform: translateY(-2px);
            opacity: 0.9;
        }
        
        #closeGraph, #closeCoding {
            position: absolute;
            top: 10px;
            right: 10px;
            background: none;
            border: none;
            color: #e6edf3;
            font-size: 20px;
            cursor: pointer;
        }
        
        #graphCanvas {
            width: 100%;
            max-width: 700px;
            height: 400px;
            margin: 20px auto;
        }
        
        /* Coding editor styles */
        #codeEditor {
            width: 100%;
            height: 300px;
            background: #0d1117;
            color: #e6edf3;
            border: 1px solid #30363d;
            padding: 10px;
            font-family: monospace;
            margin: 15px 0;
            resize: vertical;
        }
        
        #languageSelect {
            padding: 8px;
            background: #30363d;
            color: #e6edf3;
            border: none;
            border-radius: 4px;
            margin-bottom: 10px;
        }
        
        /* Dropdown menu styles */
        .dropdown-menu {
            display: none;
            position: absolute;
            top: calc(100% - 5px); /* Posiziona la dropdown più in alto */
            right: 0;
            background-color: #1c2333;
            border-radius: 8px;
            padding: 8px;
            margin-top: 0; /* Rimuove il margine extra */
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            border: 1px solid #30363d;
            z-index: 100;
        }
        
        .dropdown-menu.visible {
            display: block;
        }
        
        .logout-btn {
            background-color: #30363d;
            color: #e6edf3;
            border: none;
            border-radius: 4px;
            padding: 6px 12px;
            font-size: 0.9rem;
            cursor: pointer;
            width: 100%;
            margin-top: 8px;
        }
        
        .logout-btn:hover {
            background-color: #444c56;
        }
        
        #userEmail {
            color: #e6edf3;
            margin-bottom: 8px;
            word-break: break-all;
        }
        
        /* Stili per il container dei grafici */
        .chart-container {
            background: #1a1e28;
            padding: 15px;
            border-radius: 8px;
            margin-top: 10px;
            display: flex;
            flex-direction: column;
            align-items: center;
        }
        
        /* Stili per il container del codice */
        .code-container {
            background: #1a1e28;
            padding: 15px;
            border-radius: 8px;
            margin-top: 10px;
            width: 100%;
        }
        
        .code-header {
            display: flex;
            align-items: center;
            margin-bottom: 10px;
            flex-wrap: wrap;
            gap: 10px;
        }
        
        #languageHint {
            color: #8b949e;
            font-size: 12px;
            flex: 1;
        }
        
        .code-editor {
            width: 100%;
            min-height: 200px;
            background: #0d1117;
            color: #e6edf3;
            border: 1px solid #30363d;
            border-radius: 6px;
            padding: 10px;
            font-family: monospace;
            margin: 10px 0;
            resize: vertical;
        }
        
        #languageSelect {
            background: #0d1117;
            color: #e6edf3;
            border: 1px solid #30363d;
            border-radius: 4px;
            padding: 5px;
        }
        
        .code-actions {
            display: flex;
            justify-content: flex-end;
            margin-top: 10px;
        }
        
        .download-btn {
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            color: white;
            border: none;
            border-radius: 4px;
            padding: 8px 16px;
            cursor: pointer;
            transition: opacity 0.3s;
        }
        
        .download-btn:hover {
            opacity: 0.9;
        }
        
        /* Animazioni di caricamento migliorate */
        .typing-indicator {
            margin-bottom: 15px;
            background: var(--glass-background);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border-radius: var(--border-radius-md);
            padding: 20px;
            box-shadow: var(--shadow-light);
        }
        
        .thinking-text {
            color: #8b949e;
            font-size: 14px;
            margin-bottom: 5px;
        }
        
        .dots-container {
            display: flex;
            gap: 4px;
            justify-content: center;
        }
        
        .dot {
            width: 8px;
            height: 8px;
            background: var(--accent-color);
            border-radius: 50%;
            animation: typing 1.4s infinite ease-in-out;
        }
        
        .dot:nth-child(1) {
            animation-delay: 0s;
        }
        
        .dot:nth-child(2) {
            animation-delay: 0.2s;
        }
        
        .dot:nth-child(3) {
            animation-delay: 0.4s;
        }
        
        @keyframes typing {
            0%, 80%, 100% {
                transform: scale(0.8);
                opacity: 0.5;
            }
            40% {
                transform: scale(1.2);
                opacity: 1;
            }
        }

/* Typed.js cursor styles */
.typed-cursor {
  opacity: 1;
  animation: typedjsBlink 0.7s infinite;
  -webkit-animation: typedjsBlink 0.7s infinite;
  animation: typedjsBlink 0.7s infinite;
}
@keyframes typedjsBlink {
  50% { opacity: 0.0; }
}
@-webkit-keyframes typedjsBlink {
  0% { opacity: 1; }
  50% { opacity: 0.0; }
  100% { opacity: 1; }
}

/* Space animation */
.space-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at bottom, #1b2735 0%, #090a0f 100%);
    overflow: hidden;
    z-index: -1;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.space-animation.active {
    opacity: 1;
}

.star {
    position: absolute;
    background: white;
    border-radius: 50%;
    animation: twinkle 5s infinite;
}

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

/* Generate multiple stars with different sizes and positions via JS */
        
        /* Miglioramenti per la visualizzazione dei file */
        .file-info {
            color: #e6edf3;
            margin-top: 5px;
            font-size: 12px;
            max-width: 150px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            font-size: 0.8rem;
            color: var(--text-secondary);
            margin-top: 4px;
            display: flex;
            align-items: center;
        }
        
        .file-label {
            font-weight: 500;
            color: var(--accent-color);
            margin-bottom: 5px;
        }
        
        .file-content-text {
            color: var(--text-secondary);
            font-size: 0.9rem;
            margin-top: 5px;
            font-family: monospace;
            background: rgba(0, 0, 0, 0.2);
            padding: 8px;
            border-radius: 4px;
            max-height: 100px;
            overflow-y: auto;
            white-space: pre-wrap;
            word-break: break-all;
        }
        
        .user-message-text {
            margin-bottom: 8px;
        }
        
        .image-preview-container {
            position: relative;
            display: none;
            flex-direction: column;
            align-items: center;
            margin-top: 10px;
            background: rgba(26, 30, 40, 0.5);
            padding: 10px;
            border-radius: 8px;
        }
        
        .image-preview-container img {
            max-width: 200px;
            max-height: 150px;
            border-radius: 4px;
            object-fit: contain;
        }
        
        .remove-preview {
            position: absolute;
            top: -8px;
            right: -8px;
            width: 24px;
            height: 24px;
            background: #f44336;
            color: white;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        }
        
        .remove-preview:hover {
            background: #d32f2f;
        }
        
        /* Coding mode styles */
        .coding-mode {
            width: 80%;
            margin: 20px auto;
            background: #1c2333;
            padding: 20px;
            border-radius: 8px;
            display: none;
        }
        
        #codeEditor {
            width: 100%;
            height: 150px;
            background: #0d1117;
            color: #e6edf3;
            border: 1px solid #30363d;
            padding: 10px;
            font-family: monospace;
            resize: vertical;
        }
        
        #outputConsole {
            background: black;
            color: lime;
            padding: 10px;
            margin-top: 10px;
            border-radius: 4px;
            min-height: 50px;
            max-height: 200px;
            overflow: auto;
        }
        
        .chart-container {
            width: 80%;
            margin: 20px auto;
            display: none;
            background: #1c2333;
            padding: 20px;
            border-radius: 8px;
        }
        
        /* Chart Overlay Styles */
        .chart-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            backdrop-filter: blur(8px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 1000;
        }
        
        .chart-container-overlay {
            background: #1c2333;
            padding: 30px;
            border-radius: 12px;
            width: 90%;
            max-width: 800px;
            position: relative;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
        }
        
        .close-overlay-btn {
            position: absolute;
            top: 15px;
            right: 15px;
            background: rgba(0, 0, 0, 0.3);
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            padding: 5px;
            border-radius: 50%;
            transition: background 0.2s, color 0.2s;
        }
        
        .close-overlay-btn:hover {
            background: rgba(0, 0, 0, 0.5);
            color: #e6edf3;
        }
        
        .download-btn {
            display: inline-flex;
            align-items: center;
            gap: 8px;
            background: #1f6feb;
            color: white;
            border: none;
            border-radius: 6px;
            padding: 10px 20px;
            margin-top: 20px;
            cursor: pointer;
            transition: background 0.2s;
        }
        
        .download-btn:hover {
            background: #388bfd;
        }
        
        /* Chart Form Styles */
        .simple-chart-form {
            display: flex;
            flex-direction: column;
            gap: 18px;
            margin-bottom: 20px;
        }
        
        .chart-type-selector, .chart-data-input {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }
        
        .chart-input {
            padding: 10px;
            border-radius: 6px;
            border: 1px solid #30363d;
            background: #0d1117;
            color: #e6edf3;
            font-size: 14px;
        }
        
        .chart-generate-btn {
            padding: 12px;
            background: linear-gradient(135deg, #1f6feb, #388bfd);
            color: white;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-weight: bold;
            margin-top: 8px;
            transition: opacity 0.2s;
        }
        
        .chart-generate-btn:hover {
            opacity: 0.9;
        }
        
        .chart-examples {
            margin-top: 20px;
            padding: 15px;
            background: rgba(255, 255, 255, 0.05);
            border-radius: 6px;
        }
        
        .chart-examples code {
            background-color: #161b22;
            padding: 3px 6px;
            border-radius: 4px;
            font-size: 12px;
        }
        
        .chart-examples ul {
            padding-left: 20px;
            margin-top: 10px;
        }
        
        .chart-examples li {
            margin-bottom: 8px;
        }
        
        :root {
            --primary-color: #00a0d2;
            --secondary-color: #7b68ee;
            --background-color: #0d1117;
            --text-color: #e6edf3;
        }
        
        body {
            background-color: var(--background-color);
            color: var(--text-color);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: flex-start;
            min-height: 100vh;
            padding: 40px 20px;
            line-height: 1.6;
        }
        
        .chat-container {
            width: 100%;
            max-width: 800px;
            margin: 20px auto;
            flex-grow: 1;
            display: flex;
            flex-direction: column;
            padding: 10px;
            transition: max-height 0.5s ease-out;
            margin-bottom: 60px; /* Added margin to prevent overlap with input bar */
            overflow-y: auto; /* Added to allow full message display */
            height: auto; /* Added to allow full message display */
        }

        .chat-container.expanded {
            /* max-height: calc(100vh - 250px); <-- rimuovi questa riga */
        }
        
        .messages {
            width: 100%;
            max-width: 800px;
            margin: 20px 0;
            display: flex;
            flex-direction: column;
            gap: 16px;
            padding: 20px;
            background-color: #1c2333;
            border-radius: 16px;
            overflow-y: auto;
            max-height: calc(100vh - 200px);
        }

        /* ==== Messaggi – nuovo stile bubble ==== */
        .message-bubble {
            background: var(--glass-background);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid var(--glass-border);
            padding: 14px 18px;
            gap: 20px;
            width: 100%;
            max-width: 800px;
            margin-bottom: 20px;
        }
        
        .message {
            display: flex;
            align-items: flex-start;
            margin-bottom: 15px;
            padding: 12px;
            border-radius: 12px;
            max-width: 80%;
            gap: 12px;
            animation: fadeIn 0.3s ease-in-out;
        }
        
        .user-message {
            background-color: var(--card-background);
            align-self: flex-end;
            margin-left: auto;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .message-avatar {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            flex-shrink: 0;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
        }
        
        .user-avatar {
            background: linear-gradient(135deg, #6c5ce7, #a29bfe);
        }
        
        .message-content {
            background-color: var(--card-background);
            padding: 12px 16px;
            border-radius: 12px;
            border: 1px solid var(--border-color);
            max-width: calc(100% - 50px);
            line-height: 1.5;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
            position: relative;
            flex: 1;
            word-break: break-word;
        }
        
        .user-message .message-content {
            background-color: rgba(108, 92, 231, 0.15);
            border-color: rgba(108, 92, 231, 0.3);
            margin-left: auto;
        }
        
        .message-content::before {
            content: '';
            position: absolute;
            top: 15px;
            left: -6px;
            width: 12px;
            height: 12px;
            background-color: var(--card-background);
            border-left: 1px solid var(--border-color);
            border-bottom: 1px solid var(--border-color);
            transform: rotate(45deg);
        }
        
        .user-message .message-content::before {
            left: auto;
            right: -6px;
            background-color: rgba(108, 92, 231, 0.15);
            border-left: none;
            border-right: 1px solid rgba(108, 92, 231, 0.3);
            border-top: 1px solid rgba(108, 92, 231, 0.3);
            border-bottom: none;
        }
        
        .message-time {
            font-size: 0.7rem;
            color: var(--text-secondary);
            margin-top: 5px;
            text-align: right;
        }

        .message-content {
            color: var(--text-color);
            line-height: 1.5;
            font-size: 1rem;
        }

        .message-content strong {
            font-weight: 600;
            color: var(--text-color);
        }

        .message-content strong.mark {
            background-color: rgba(88, 166, 255, 0.2);
            color: var(--accent-color);
            padding: 0 4px;
            border-radius: 4px;
        }

        .message-content mark {
            background-color: rgba(255, 255, 255, 0.1);
            padding: 2px 4px;
            border-radius: 4px;
        }

        .message-content code {
            background-color: #2c3448;
            padding: 2px 4px;
            border-radius: 4px;
            font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
            color: #388bfd;
        }

        .message-content pre {
            background-color: #2c3448;
            padding: 12px;
            border-radius: 8px;
            overflow-x: auto;
            margin: 16px 0;
            font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
        }

        .message-content a {
            color: #388bfd;
            text-decoration: none;
            font-weight: 500;
        }

        .message-content a:hover {
            text-decoration: underline;
        }

        .message-timestamp {
            font-size: 0.75rem;
            color: #8b949e;
            margin-top: 4px;
            text-align: right;
        }

        .message-actions {
            display: flex;
            gap: 8px;
            margin-top: 16px;
        }

        .message-actions button {
            background-color: #2c3448;
            color: #e6edf3;
            border: none;
            border-radius: 8px;
            padding: 4px 8px;
            font-size: 0.8rem;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .message-actions button:hover {
            background-color: #3c4458;
        }

        .typing-indicator {
            display: flex;
            align-items: center;
            gap: 4px;
            color: #8b949e;
            font-size: 0.9rem;
        }

        .typing-indicator .dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background-color: #8b949e;
            animation: typing 1.4s infinite ease-in-out;
        }

        .typing-indicator .dot:nth-child(1) { animation-delay: -0.32s; }
        .typing-indicator .dot:nth-child(2) { animation-delay: -0.16s; }

        @keyframes typing {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-5px); }
        }
        
        .avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 14px;
            flex-shrink: 0;
        }
        
        .user-avatar {
            background-color: #2c3448;
            color: #e6edf3;
        }
        
        .assistant-avatar {
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            color: white;
        }
        
        /* Pulsanti più moderni */
        .send-btn {
            background: var(--primary-gradient);
            border: none;
            border-radius: 50%;
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            margin-left: 8px;
            color: white;
            box-shadow: var(--shadow-medium);
            transition: all 0.2s ease;
        }
        
        .send-btn.visible {
            display: flex;
        }
        
        .send-btn:hover {
            transform: scale(1.1) rotate(5deg);
            box-shadow: var(--shadow-heavy);
        }
        
        /* Hide suggestions when chat starts */
        .suggestions.hidden {
            display: none;
        }
        
        /* Add styles for typing indicator */
        .typing-indicator .dot {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #8b949e;
            margin: 0 2px;
            animation: typing 1.4s infinite ease-in-out;
        }
        
        .typing-indicator .thinking-text {
            margin-bottom: 5px;
            color: #e6edf3;
        }
        
        .typing-indicator .dots-container {
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }
        
        .typing-indicator .dot:nth-child(1) {
            animation-delay: 0s;
        }
    
        .typing-indicator .dot:nth-child(2) {
            animation-delay: 0.2s;
        }
    
        .typing-indicator .dot:nth-child(3) {
            animation-delay: 0.4s;
        }
    
        @keyframes typing {
            0%, 100% {
                transform: translateY(0);
            }
            50% {
                transform: translateY(-5px);
            }
        }
        
        .message {
            animation: fadeIn 0.5s ease;
        }
    
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        @media (max-width: 600px) {
            .chat-container {
                padding: 5px;
            }
            .message {
                font-size: 14px;
            }
        }
        
        /* Stile per il testo più grande */
        .larger-text {
            font-size: 1.5em;
            font-weight: bold;
            color: #9cdcfe;
        }

        /* Stili per l'overlay del grafico */
        #graphHelpOverlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 1000;
        }

        .graph-help-container {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.3);
            border-radius: 12px;
            padding: 24px;
            max-width: 900px;
            width: 90%;
            max-height: 90vh;
            overflow-y: auto;
        }

        .graph-help-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            padding-bottom: 16px;
            border-bottom: 1px solid #3e3e3e;
        }

        .graph-help-title {
            color: #e6edf3;
            font-size: 1.5em;
            font-weight: bold;
        }

        .close-btn {
            background: none;
            border: none;
            color: #e6edf3;
            font-size: 1.2em;
            cursor: pointer;
            padding: 8px;
            border-radius: 50%;
            transition: background-color 0.2s;
        }

        .close-btn:hover {
            background-color: #3e3e3e;
        }

        .graph-help-content {
            color: #e6edf3;
            font-size: 14px;
            line-height: 1.6;
        }

        .graph-help-section {
            margin-bottom: 24px;
            padding: 16px;
            background: #2d2d2d;
            border-radius: 8px;
        }

        .graph-help-section h3 {
            color: #9cdcfe;
            margin-bottom: 12px;
            font-size: 1.2em;
        }

        .graph-help-code {
            background: #1e1e1e;
            padding: 12px;
            border-radius: 4px;
            margin: 12px 0;
            font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
            color: #d4d4d4;
            overflow-x: auto;
        }

        .graph-help-button {
            display: inline-block;
            padding: 8px 16px;
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            border: none;
            border-radius: 4px;
            color: white;
            cursor: pointer;
            font-size: 14px;
            margin: 4px;
            transition: transform 0.2s;
        }

        .graph-help-button:hover {
            transform: scale(1.05);
        }

        .data-input-section {
            margin-top: 24px;
            padding-top: 16px;
            border-top: 1px solid #3e3e3e;
        }

        .data-input-group {
            margin-bottom: 16px;
            position: relative;
        }

        .data-input-group label {
            display: block;
            margin-bottom: 8px;
            color: #9cdcfe;
        }

        .data-input-group input,
        .data-input-group select {
            width: 100%;
            padding: 8px;
            border: 1px solid #3e3e3e;
            border-radius: 4px;
            background: #2d2d2d;
            color: #e6edf3;
        }

        .data-input-group input:focus,
        .data-input-group select:focus {
            outline: none;
            border-color: #00a0d2;
        }

        .data-input-group input.error {
            border-color: #f44747;
        }

        .data-input-group .error-message {
            color: #f44747;
            font-size: 0.8em;
            margin-top: 4px;
        }

        .color-picker {
            width: 100%;
            padding: 8px;
            border: 1px solid #3e3e3e;
            border-radius: 4px;
            background: #2d2d2d;
            color: #e6edf3;
            margin-top: 8px;
        }

        .preview-container {
            margin: 24px 0;
            padding: 16px;
            background: #1e1e1e;
            border-radius: 8px;
            border: 1px solid #3e3e3e;
        }

        .preview-chart {
            width: 100%;
            height: 300px;
        }

        .generated-code {
            margin-top: 16px;
            padding: 12px;
            background: #1e1e1e;
            border-radius: 4px;
            color: #d4d4d4;
            font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
            cursor: pointer;
            transition: background-color 0.2s;
            position: relative;
        }

        .generated-code:hover {
            background-color: #2d2d2d;
        }

        .generated-code .tooltip {
            position: absolute;
            top: -30px;
            left: 50%;
            transform: translateX(-50%);
            background: #2d2d2d;
            color: #d4d4d4;
            padding: 8px;
            border-radius: 4px;
            font-size: 0.9em;
            opacity: 0;
            transition: opacity 0.2s;
        }

        .generated-code:hover .tooltip {
            opacity: 1;
        }

        .clear-button {
            margin-left: 8px;
            background: linear-gradient(135deg, #f44747, #ff7e7e);
        }

        .clear-button:hover {
            transform: scale(1.05);
        }

        /* Stile per il testo più grande */
        .larger-text {
            font-size: 1.5em;
            font-weight: bold;
        }

        /* Tooltip style */
        .tooltip {
            position: absolute;
            background: #2d2d2d;
            color: #d4d4d4;
            padding: 8px;
            border-radius: 4px;
            font-size: 0.9em;
            opacity: 0;
            transition: opacity 0.2s;
        }

        /* Chart preview styles */
        .chart-preview {
            width: 100%;
            height: 200px;
            margin: 16px 0;
            background: #1e1e1e;
            border-radius: 8px;
            overflow: hidden;
        }

        .chart-preview canvas {
            width: 100% !important;
            height: 100% !important;
        }

        .image-gen-btn {
            margin-top: 20px;
            padding: 10px 20px;
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 1rem;
            cursor: pointer;
            transition: background 0.3s, transform 0.2s;
        }

        .image-gen-btn:hover {
            background: linear-gradient(135deg, #0078a0, #5a4dbf);
            transform: scale(1.05);
        }

        /* Stile per il display del modello selezionato */
        .model-display {
            margin-top: 12px;
            font-size: 1rem;
            color: var(--text-color);
            text-align: center;
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            padding: 8px 16px;
            display: inline-block;
            box-shadow: var(--shadow-light);
        }

        .model-btn.selected {
            border: 2px solid var(--primary-color);
            box-shadow: 0 0 10px var(--primary-color);
        }

        .reasoning-content {
            margin-top: 8px;
            font-style: italic;
            color: gray;
        }

        .toggle-reasoning-btn {
            margin-top: 8px;
            background-color: #2c3448;
            color: #e6edf3;
            border: none;
            border-radius: 8px;
            padding: 4px 8px;
            font-size: 0.8rem;
            cursor: pointer;
            transition: background-color 0.2s;
        }

        .toggle-reasoning-btn:hover {
            background-color: #3c4458;
        }

        .reasoning-btn {
            background-color: var(--card-background);
            color: var(--text-color);
            border: 1px solid var(--border-color);
            border-radius: 50%;
            width: 40px;
            height: 40px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            margin-left: 8px;
            transition: all 0.2s ease;
        }

        .reasoning-btn.active {
            background-color: var(--accent-color);
            color: white;
            border-color: var(--accent-color);
        }

        .reasoning-btn:hover {
            background-color: var(--hover-color);
            transform: scale(1.05);
        }

        .model-btn.locked {
            position: relative;
            pointer-events: none;
            opacity: 0.6;
        }

        .model-btn.locked::after {
            content: '🔒';
            position: absolute;
            top: -10px;
            right: -10px;
            font-size: 16px;
            color: #e6edf3;
        }

        /* Welcome popup styles */
        #welcomePopup {
            position: fixed;
            top: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: #00a0d2;
            color: white;
            padding: 10px 20px;
            border-radius: 4px;
            display: none;
            z-index: 1100;
        }

/* Pulsante impostazioni */
.settings-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    margin-right: 12px;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    min-width: 40px; /* Larghezza minima fissa */
    min-height: 40px; /* Altezza minima fissa */
}
        
        .settings-btn:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--accent-color);
        }
        
        /* Menu a tendina per le impostazioni */
        .settings-menu {
            position: absolute;
            bottom: 100%;
            left: 5%;
            background: var(--glass-background);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            box-shadow: var(--shadow-heavy);
            padding: 10px 0;
            min-width: 200px;
            z-index: 100;
            display: none;
        }
        
        .settings-menu.visible {
            display: block;
            animation: fadeIn 0.2s ease;
        }
        
        .settings-menu-item {
            padding: 12px 20px;
            color: var(--text-color);
            cursor: pointer;
            transition: background 0.2s;
        }
        
        .settings-menu-item:hover {
            background: rgba(255, 255, 255, 0.1);
            color: var(--accent-color);
        }
        
        /* Nascondi il pulsante di cambio modello e il selettore di stile per default */
        .model-change-btn {
            display: none;
            margin: 10px auto; /* Centra il bottone */
            padding: 8px 16px;
            background-color: #0078a0;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            transition: background-color 0.2s;
        }
        .model-change-btn:hover {
            background-color: #005f70;
        }

        .user-menu {
            box-shadow: 0 0 10px var(--primary-color);
            transition: box-shadow 0.3s ease;
        }
        .user-menu:hover {
            box-shadow: 0 0 15px var(--primary-color);
        }
        .download-announcement {
            margin: 20px auto;
            padding: 10px;
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            border-radius: 12px;
            max-width: 800px;
            text-align: center;
            font-size: 1.1rem;
        }
        .download-announcement a {
            color: white;
            text-decoration: none;
        }
        .download-announcement a:hover {
            text-decoration: underline;
        }
        
        .style-selector-container {
            margin-left: 8px;
            position: relative;
            display: none;
        }

        .style-selector {
            background-color: var(--card-background);
            color: var(--text-color);
            border: 1px solid var(--border-color);
            border-radius: 12px;
            padding: 6px 10px;
            font-size: 0.9rem;
            cursor: pointer;
            transition: all 0.2s;
            appearance: none;
            -webkit-appearance: none;
            background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3b1c2' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
            background-repeat: no-repeat;
            background-position: right 8px center;
            background-size: 16px;
            padding-right: 28px;
        }

        .style-selector:hover {
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
        }

        .style-selector:focus {
            outline: none;
            border-color: var(--accent-color);
            box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
        }
        
        /* Indicatore dello stile selezionato */
        .style-display {
            margin-top: 8px;
            font-size: 0.9rem;
            color: var(--text-secondary);
            text-align: center;
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            padding: 6px 12px;
            display: inline-block;
            margin-left: 8px;
        }

        .pwa-popup {
            position: fixed;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            background: linear-gradient(135deg, #1c2333, #2c3448);
            padding: 20px;
            border-radius: 16px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
            z-index: 1000;
            width: 90%;
            max-width: 380px;
            border: 1px solid rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(10px);
            animation: slideUp 0.3s ease-out;
        }

        @keyframes slideUp {
            from {
                transform: translate(-50%, 100%);
                opacity: 0;
            }
            to {
                transform: translate(-50%, 0);
                opacity: 1;
            }
        }

        .pwa-popup-content {
            text-align: center;
            color: #e6edf3;
        }

        .pwa-popup-content h3 {
            margin: 0 0 12px;
            font-size: 1.4em;
            background: linear-gradient(135deg, #00a0d2, #7b68ee);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .pwa-buttons {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-top: 20px;
        }

        .pwa-install-btn {
            background: rgba(255, 255, 255, 0.2);
            backdrop-filter: blur(10px) saturate(180%);
            -webkit-backdrop-filter: blur(10px) saturate(180%);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white;
            padding: 12px;
            border-radius: 8px;
            cursor: pointer;
            font-weight: 500;
            transition: transform 0.2s, opacity 0.2s;
        }

        .pwa-install-btn:hover {
            transform: translateY(-2px);
            opacity: 0.9;
        }

        .pwa-secondary-btn {
            background: transparent;
            color: white;
            border: 1px solid rgba(255,255,255,0.3);
            padding: 10px;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .pwa-secondary-btn:hover {
            background: rgba(255,255,255,0.1);
        }

        /* Status Indicator Styles */
        .status-indicator {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: #1c2333;
            padding: 10px;
            border-radius: 8px;
            display: flex;
            gap: 10px;
            z-index: 1000;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
        }

        .status-item {
            display: flex;
            align-items: center;
            gap: 5px;
            font-size: 12px;
            color: #e6edf3;
        }

        .status-icon {
            width: 12px;
            height: 12px;
            border-radius: 50%;
        }

        .status-icon.accepted {
            background-color: #22c55e;
        }

        .status-icon.pending {
            background-color: #ef4444;
        }

        /* Aggiungi questi stili per la nuova animazione */
        .loading-animation {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 20px;
        }
        
        .spinner {
            width: 50px;
            height: 50px;
            border: 5px solid #f3f3f3;
            border-top: 5px solid #00a0d2;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .image-message {
            max-width: 100%;
            margin: 10px 0;
            border-radius: 8px;
        }
        
        .image-base64 {
            font-size: 12px;
            background: #1e1e1e;
            padding: 10px;
            border-radius: 4px;
            margin-top: 10px;
            max-height: 100px;
            overflow-y: auto;
            word-break: break-all;
        }
        
        /* Responsive migliorato */
        @media (max-width: 768px) {
            .header h1 {
                font-size: 2rem;
            }
            
            .input-area {
                margin-top: 20px;
            }
            .input-container {
                width: 100%;
                padding: 8px 4px;
                height: 80px;
            }
            
            .attachment-icon {
                width: 36px;
                height: 36px;
            }
            
            .send-btn {
                width: 40px;
                height: 40px;
            }
        }

        .welcome-message {
            /* Riduci il margine sotto il titolo principale */
            margin-bottom: 10px;
        }

        /* Stili per i pulsanti animati Image to Code e Video to Code */
        .header-buttons {
            position: fixed;
            top: 20px;
            right: 120px;
            display: flex;
            gap: 12px;
            z-index: 1000;
            overflow: visible;
        }

        .animated-btn {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 10px 16px;
            background: var(--glass-background);
            backdrop-filter: var(--glass-backdrop);
            -webkit-backdrop-filter: var(--glass-backdrop);
            border: 1px solid var(--glass-border);
            border-radius: 12px;
            color: var(--text-color);
            text-decoration: none;
            font-size: 14px;
            font-weight: 500;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: var(--shadow-light);
            position: relative;
            overflow: visible;
        }

        .animated-btn::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;
        }

        .animated-btn:hover {
            transform: translateY(-2px);
            box-shadow: var(--shadow-heavy);
            border-color: var(--accent-color);
        }

        .animated-btn:hover::before {
            left: 100%;
        }

        .animated-btn svg {
            transition: transform 0.3s ease;
        }

        .animated-btn:hover svg {
            transform: scale(1.1);
        }

        .image-btn {
            background: linear-gradient(135deg, rgba(103, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
        }

        .video-btn {
            background: linear-gradient(135deg, rgba(240, 147, 251, 0.1), rgba(245, 87, 108, 0.1));
        }

        .new-badge {
            position: absolute;
            top: -8px;
            right: -8px;
            background: linear-gradient(135deg, #ff6b6b, #ee5a24);
            color: white;
            font-size: 10px;
            font-weight: 600;
            padding: 2px 6px;
            border-radius: 8px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            animation: pulse 2s infinite;
            box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
            z-index: 10;
        }

            @keyframes pulse {
                0% { transform: scale(1); }
                50% { transform: scale(1.1); }
                100% { transform: scale(1); }
            }

        /* Responsive per i pulsanti animati */
        @media (max-width: 768px) {
            .header-buttons {
                position: relative;
                top: auto;
                right: auto;
                justify-content: center;
                margin-bottom: 20px;
                flex-wrap: wrap;
            }

            .animated-btn {
                font-size: 12px;
                padding: 8px 12px;
            }

            .animated-btn span:not(.new-badge) {
                display: none;
            }

            .link-box::after {
            content: "NEW";
            position: absolute;
            top: -8px;
            right: -8px;
            background: linear-gradient(45deg, #ff6b6b, #ee5a24);
            color: white;
            font-size: 10px;
            font-weight: bold;
            padding: 2px 6px;
            border-radius: 8px;
            box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
            z-index: 10;
            animation: pulse 2s infinite;
        }

            .new-badge {
                position: absolute;
                top: -5px;
                right: -5px;
                font-size: 8px;
                padding: 1px 4px;
            }
        }
