:root {
    --bg-color: #0f172a;
    --chat-bg: #1e293b;
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --text-white: #f8fafc;
    --text-gray: #94a3b8;
    --user-msg-bg: #3b82f6;
    --ai-msg-bg: #334155;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-white);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Previene scroll della pagina intera */
}

/* Container Principale */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    background: var(--bg-color);
}

/* Header */
header {
    padding: 15px 20px;
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

header h3 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Chat Area */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    margin-top: 40px;
    color: var(--text-gray);
    opacity: 0.8;
}

.welcome-message i {
    font-size: 40px;
    margin-bottom: 10px;
    color: var(--primary);
}

/* Messaggi */
.msg {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: fadeIn 0.3s ease;
}

.msg.user {
    align-self: flex-end;
    background: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
}

.msg.ai {
    align-self: flex-start;
    background: var(--ai-msg-bg);
    color: var(--text-white);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.05);
}

.msg.error {
    background: #ef4444;
    color: white;
}

/* Input Area */
.input-area {
    padding: 15px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.input-wrapper {
    display: flex;
    gap: 10px;
    background: #1e293b;
    padding: 5px;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 15px;
    color: white;
    font-size: 15px;
    outline: none;
}

input::placeholder {
    color: var(--text-gray);
}

button {
    background: var(--primary);
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    background: var(--text-gray);
    opacity: 0.5;
    cursor: not-allowed;
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Loading Dots */
.typing-dots span {
    width: 6px;
    height: 6px;
    background: #cbd5e1;
    display: inline-block;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
    margin: 0 2px;
}

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

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}