:root {
    --primary-color: #4361ee;
    --secondary-color: #3f37c9;
    --accent-color: #4895ef;
    --dark-color: #1a1a2e;
    --light-color: #f8f9fa;
    --success-color: #4cc9f0;
    --warning-color: #f72585;
    --info-color: #560bad;
    
    --text-light: #f8f9fa;
    --text-dark: #212529;
    --text-muted: #6c757d;
    
    --bg-light: #ffffff;
    --bg-dark: #0d1117;
    --sidebar-dark: #161b22;
    --sidebar-light: #f8f9fa;
    
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    background-color: var(--bg-light);
    color: var(--text-dark);
    transition: var(--transition);
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-light);
}

.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background-color: #000e47;
    color: white;
    box-shadow: var(--box-shadow);
}

.app-header h1 {
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-controls {
    display: flex;
    gap: 1rem;
}

.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.sidebar {
    width: 300px;
    padding: 1.5rem;
    background-color: var(--sidebar-light);
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    transition: var(--transition);
}

.dark-theme .sidebar {
    background-color: var(--sidebar-dark);
    border-right-color: #30363d;
}

.model-controls, .parameter-controls, .chat-history {
    margin-bottom: 2rem;
}

h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.dark-theme h2 {
    color: var(--accent-color);
}

.select-box {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    background-color: white;
    color: var(--text-dark);
    transition: var(--transition);
}

.dark-theme .select-box {
    background-color: #161b22;
    border-color: #30363d;
    color: var(--text-light);
}

.model-info {
    padding: 1rem;
    background-color: rgba(67, 97, 238, 0.1);
    border-radius: var(--border-radius);
    margin-top: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

.param-group {
    margin-bottom: 1.5rem;
}

.param-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.slider-container input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: #dee2e6;
    outline: none;
    -webkit-appearance: none;
}

.slider-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.param-value {
    min-width: 40px;
    text-align: right;
    font-family: monospace;
}

.toggle-group {
    margin: 1.5rem 0;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    opacity: 0;
}

.toggle-switch .slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: var(--transition);
    border-radius: 50%;
}

.toggle-switch input:checked + .slider {
    background-color: var(--primary-color);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(26px);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    background-color: var(--bg-light);
    transition: var(--transition);
}

.dark-theme .chat-messages {
    background-color: var(--bg-dark);
}

.message {
    max-width: 80%;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--border-radius);
    animation: fadeIn 0.3s ease;
}

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

.user-message {
    margin-left: auto;
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 0;
}

.ai-message {
    margin-right: auto;
    background-color: #e9ecef;
    border-bottom-left-radius: 0;
}

.dark-theme .ai-message {
    background-color: #21262d;
    color: var(--text-light);
}

.message-content {
    word-wrap: break-word;
    line-height: 1.6;
}

.message-meta {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.user-message .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

.input-area {
    padding: 1rem;
    border-top: 1px solid #dee2e6;
    background-color: var(--bg-light);
    transition: var(--transition);
}

.dark-theme .input-area {
    background-color: var(--bg-dark);
    border-top-color: #30363d;
}

.input-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.text-input-container {
    position: relative;
}

textarea {
    width: 100%;
    padding: 1rem;
    padding-right: 3rem;
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    resize: none;
    font-family: inherit;
    transition: var(--transition);
}

.dark-theme textarea {
    background-color: #161b22;
    border-color: #30363d;
    color: var(--text-light);
}

#quick-send {
    position: absolute;
    right: 0.75rem;
    bottom: 0.75rem;
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
}

.button {
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.primary-button {
    background-color: var(--primary-color);
    color: white;
}

.primary-button:hover {
    background-color: var(--secondary-color);
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-dark);
    cursor: pointer;
    font-size: 1rem;
    transition: var(--transition);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-theme .icon-button {
    color: var(--text-light);
}

.icon-button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.dark-theme .icon-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    background-color: rgba(0, 0, 0, 0.05);
    cursor: pointer;
    transition: var(--transition);
}

.dark-theme .history-item {
    background-color: rgba(255, 255, 255, 0.05);
}

.history-item:hover {
    background-color: rgba(67, 97, 238, 0.1);
}

.history-item.active {
    background-color: rgba(67, 97, 238, 0.2);
}

.history-item-title {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
}

.loading-dots {
    display: inline-flex;
    gap: 0.25rem;
}

.loading-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    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); }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    
    .dark-theme .sidebar {
        border-bottom-color: #30363d;
    }
    
    .message {
        max-width: 90%;
    }
}