* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f5f5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar Styles */
.navbar {
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-img {
    height: 60px;
    margin-right: 10px;
}

.logo-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3748;
}

.navbar-actions {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: #4a5568;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 15px;
    border-radius: 5px;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link:hover {
    background-color: #f7fafc;
    color: #2d3748;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 90%;
    max-width: 800px;
    height: calc(80vh - 60px); /* Adjusted height to account for navbar */
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 15px 20px;
    background-color: #84AB6B;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    font-size: 1.5rem;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.logs-link {
    color: #fff;
    font-size: 0.8rem;
    text-decoration: none;
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: background-color 0.2s;
}

.logs-link:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 12px 15px;
    border-radius: 18px;
    white-space: pre-wrap;
}

/* Stile per il testo nei messaggi dell'assistente */
.assistant .message-content p {
    line-height: 1.5;
}

/* Stili specifici per la formattazione del testo dell'assistente */
.assistant .message-content strong {
    font-weight: 600;
}

.assistant .message-content u {
    text-decoration: underline;
    font-weight: 500;
    display: block;
    margin-top: 10px;
    margin-bottom: 5px;
}

/* Supporto per spaziatura tra paragrafi */
.assistant .message-content p + p {
    margin-top: 10px;
}

.user .message-content {
    background-color: #1F274C;
    color: white;
    border-bottom-right-radius: 4px;
}

.assistant .message-content {
    background-color: #edf2f7;
    color: #2d3748;
    border-bottom-left-radius: 4px;
}

.error-message .message-content {
    background-color: #fed7d7;
    color: #c53030;
    border-left: 3px solid #c53030;
}

.chat-input {
    padding: 10px 15px 15px;
    border-top: none; /* Rimuovo il bordo superiore perché già presente nei preset */
}

#message-form {
    display: flex;
}

#user-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #cbd5e0;
    border-radius: 25px;
    margin-right: 10px;
    outline: none;
    font-size: 1rem;
}

#user-input:focus {
    border-color: #4299e1;
}

button {
    background-color: #84AB6B;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #84AB6B;
}

button svg {
    width: 18px;
    height: 18px;
}

.typing-indicator {
    display: inline-block;
    margin-left: 5px;
}

.typing-indicator span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #4a5568;
    margin: 0 2px;
    opacity: 0.6;
    animation: typing 1s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* Supporto per la formattazione di codice */
.assistant .message-content code {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 4px;
    border-radius: 3px;
}

.assistant .message-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    overflow-x: auto;
}

/* Supporto per elenchi */
.assistant .message-content ul,
.assistant .message-content ol {
    margin-left: 20px;
    margin-top: 5px;
    margin-bottom: 5px;
}

.assistant .message-content li {
    margin-bottom: 3px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #84AB6B; /* Stesso colore dell'header della chat */
    margin: auto;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 80%;
    position: relative;
    color: white; /* Testo bianco */
}

.close-button {
    color: #fff;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #ddd;
    text-decoration: none;
}

.contact-info {
    margin-top: 20px;
}

.contact-info p {
    margin: 10px 0;
}

.contact-info h2 {
    color: white;
}

.contact-info a {
    color: white;
    text-decoration: underline;
}

.contact-info ul {
    padding-left: 20px; /* Rientro da sinistra per l'elenco puntato */
    margin: 10px 0;
}

.contact-info ul li {
    margin: 5px 0;
}

/* Stili per i preset di domande */
.chat-presets {
    padding: 10px 15px 5px;
    border-top: 1px solid #e2e8f0;
}

.preset-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.preset-button {
    background-color: #f5f7fa;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    height: auto;
}

.preset-button:hover {
    background-color: #edf2f7;
    color: #1F274C;
    border-color: #cbd5e0;
}

.preset-button:active {
    background-color: #e2e8f0;
    transform: translateY(1px);
}

/* Media query per i preset su schermi piccoli */
@media (max-width: 480px) {
    .preset-container {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 5px;
        justify-content: flex-start;
        -webkit-overflow-scrolling: touch;
    }
    
    .preset-button {
        flex: 0 0 auto;
    }
}

/* Stile per il disclaimer */
.disclaimer {
    font-size: 0.75rem;
    color: #6b7280;
    text-align: center;
    margin-top: 8px;
    padding: 0 15px;
    line-height: 1.3;
}

/* Media queries per il responsive design */
@media (max-width: 768px) {
    .navbar-container {
        width: 95%;
    }
    
    .logo-text {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 10px;
    }
    
    .chat-container {
        width: 100%;
        height: calc(90vh - 60px);
    }

    .navbar-actions {
        display: none;
    }

    .disclaimer {
        font-size: 0.7rem;
        padding: 0 10px;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none; /* Hide logo text on very small screens */
    }
    
    .nav-link {
        padding: 8px 10px;
    }
    
    .chat-header h1 {
        font-size: 1.2rem;
    }
    
    .message {
        max-width: 90%;
    }

    .disclaimer {
        font-size: 0.65rem;
    }
}
