:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --background-color: #f0f4f8;
    --chat-bg: #ffffff;
    --text-color: #1e293b;
    --border-color: #e2e8f0;
    --success-color: #059669;
    --error-color: #dc2626;
    --hover-bg: #f8fafc;
}

[data-theme="dark"] {
    --background-color: #1a1a1a;
    --chat-bg: #2d2d2d;
    --text-color: #e5e5e5;
    --border-color: #404040;
    --hover-bg: #363636;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    padding: 2rem 0;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

h1 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chat-container {
    background: var(--chat-bg);
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 2rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

.message-area {
    height: 450px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    scroll-behavior: smooth;
    background: var(--hover-bg);
}

.message {
    margin-bottom: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    max-width: 80%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.message.assistant {
    background-color: #ffffff;
    margin-right: 20%;
    border-bottom-left-radius: 0.5rem;
}

.message.user {
    background-color: var(--primary-color);
    color: white;
    margin-left: 20%;
    border-bottom-right-radius: 0.5rem;
}

.input-area {
    margin-bottom: 1.5rem;
}

.form-control, .form-select {
    border: 2px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
    font-size: 1rem;
    width: 100%;
    margin-bottom: 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    outline: none;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    border: none;
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.template-selection {
    background: var(--chat-bg);
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-top: 2rem;
}

.form-check {
    margin-bottom: 1rem;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input {
    width: 1.2em;
    height: 1.2em;
    margin-top: 0.25em;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    padding-left: 0.5rem;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(220, 38, 38, 0.1);
    margin-top: 0.5rem;
}

.success-message {
    color: var(--success-color);
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    background-color: rgba(5, 150, 105, 0.1);
    margin-top: 0.5rem;
}

.message {
    animation: slideIn 0.3s ease-out;
}

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

.custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--background-color);
}

.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

[data-theme="dark"] .message.assistant {
    background-color: #363636;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #e5e5e5;
}

[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #2d2d2d;
    border-color: var(--primary-color);
}

[data-theme="dark"] .form-check-label {
    color: #e5e5e5;
}

.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-color);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}