/* style.css */
:root {
    --primary-color: #4f46e5;
    --user-message-bg: #e0e7ff;
    --assistant-message-bg: #f3f4f6;
    --text-color: #1f2937;
    --light-text: #6b7280;
    --border-radius: 12px;
    --container-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #f0f4f8, #e6e9f0);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.container {
    max-width: 800px;
    width: 100%;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--container-shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 90vh;
}

header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
}

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

header p {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chat-history {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    animation: fadeIn 0.3s ease-out;
}

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

.message.user {
    align-self: flex-end;
    background: var(--user-message-bg);
    border-bottom-right-radius: 4px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--assistant-message-bg);
    border-bottom-left-radius: 4px;
}

.message-content {
    white-space: pre-wrap;
    word-break: break-word;
}

.input-area {
    display: flex;
    gap: 10px;
    background: white;
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid #d1d5db;
}

.input-area textarea {
    flex: 1;
    border: none;
    resize: none;
    padding: 12px;
    font-size: 1rem;
    border-radius: 8px;
    outline: none;
    min-height: 60px;
    max-height: 150px;
}

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

.input-area button:hover {
    background: #4338ca;
}

.input-area button:disabled {
    background: #a5b4fc;
    cursor: not-allowed;
}

.input-area button svg {
    width: 24px;
    height: 24px;
}

.loading, .error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.loading {
    display: none;
}

.error {
    display: none;
    background: rgba(255, 255, 255, 0.95);
    text-align: center;
    padding: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e7ff;
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 15px;
    font-size: 1rem;
}

.error button:hover {
    background: #4338ca;
}

/* Responsive styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        height: 95vh;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    main {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
    
    .chat-history {
        padding: 10px;
        gap: 12px;
    }
    
    .input-area {
        padding: 8px;
    }
    
    .input-area textarea {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .input-area button {
        width: 45px;
        height: 45px;
    }
}