* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.chat-container {
    width: 100%;
    max-width: 900px;
    height: 90vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 400;
}

.clear-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: #f8f9fa;
}

.messages {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-content {
    padding: 16px 20px;
    border-radius: 12px;
    line-height: 1.6;
    font-size: 0.95rem;
}

.message.user .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.message.assistant .message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
}

.message-content p {
    margin-bottom: 12px;
}

.message-content p:last-child {
    margin-bottom: 0;
}

.message-content ul, .message-content ol {
    margin: 10px 0;
    padding-left: 25px;
}

.message-content li {
    margin-bottom: 8px;
}

.message-content strong {
    font-weight: 600;
    color: #667eea;
}

.message.user .message-content strong {
    color: white;
}

.message-content code {
    background: #f4f4f4;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.message-content pre {
    background: #f4f4f4;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 10px 0;
}

.message-content pre code {
    background: none;
    padding: 0;
}

.message-content h3 {
    margin-top: 15px;
    margin-bottom: 10px;
    color: #667eea;
    font-size: 1.1rem;
}

.message-content h4 {
    margin-top: 12px;
    margin-bottom: 8px;
    color: #764ba2;
    font-size: 1rem;
}

/* Loading indicator */
.message.assistant .message-content.loading {
    display: flex;
    align-items: center;
    gap: 8px;
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #667eea;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out;
}

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

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

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

/* Input Area */
.input-area {
    padding: 20px 30px;
    background: white;
    border-top: 1px solid #e0e0e0;
}

.chat-form {
    margin-bottom: 10px;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    resize: none;
    min-height: 48px;
    max-height: 150px;
    transition: border-color 0.2s;
}

.message-input:focus {
    outline: none;
    border-color: #667eea;
}

.send-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    height: 48px;
}

.send-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.export-button {
    width: 100%;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border: none;
    color: white;
    padding: 12px 20px;
    border-radius: 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.export-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    .chat-container {
        height: 100vh;
        border-radius: 0;
        max-width: 100%;
    }

    header {
        padding: 20px;
    }

    .header-content h1 {
        font-size: 1.4rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .messages-container {
        padding: 20px;
    }

    .message {
        max-width: 90%;
    }

    .message-content {
        font-size: 0.9rem;
        padding: 14px 16px;
    }

    .input-area {
        padding: 15px 20px;
    }

    .message-input {
        font-size: 0.9rem;
    }
}

/* Scrollbar Styling */
.messages-container::-webkit-scrollbar {
    width: 8px;
}

.messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

.messages-container::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
