:root {
    /* 主色调 - 更加协调的紫色系 */
    --primary-color: #6B46C1;
    --primary-light: #A78BFA;
    --primary-lighter: #C4B5FD;
    --primary-dark: #553C9A;
    --primary-darker: #4C1D95;
    
    /* 辅助色调 - 更柔和的背景色系 */
    --secondary-color: #F8FAFC;
    --secondary-light: #F1F5F9;
    --secondary-dark: #E2E8F0;
    
    /* 中性色调 - 更好的层次感 */
    --neutral-50: #FAFAFA;
    --neutral-100: #F5F5F5;
    --neutral-200: #E5E5E5;
    --neutral-300: #D4D4D4;
    --neutral-400: #A3A3A3;
    --neutral-500: #737373;
    --neutral-600: #525252;
    --neutral-700: #404040;
    --neutral-800: #262626;
    --neutral-900: #171717;
    
    /* 文字颜色 */
    --text-on-primary: #ffffff;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    
    /* 背景色 */
    --bg-primary: #ffffff;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --bg-body: #FEFEFE;
    
    /* 边框色 */
    --border-light: #F3F4F6;
    --border-medium: #E5E7EB;
    --border-dark: #D1D5DB;
    
    /* 状态色 */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --error-color: #EF4444;
    --info-color: #3B82F6;
    
    /* 设计系统 */
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(107, 70, 193, 0.08);
    --box-shadow-hover: 0 8px 24px rgba(107, 70, 193, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --z-index-dropdown: 1000;
    --z-index-dialog: 2000;
    
    /* 兼容性变量 */
    --text-color: var(--text-primary);
    --card-bg: var(--bg-primary);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    background: linear-gradient(135deg, #F8FAFC 0%, #F1F5F9 100%);
    color: var(--text-primary);
    line-height: 1.6;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* 自定义滚动条样式 */
/* Webkit浏览器 (Chrome, Safari, Edge) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-light);
    border-radius: 4px;
    transition: background 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

::-webkit-scrollbar-thumb:active {
    background: var(--primary-dark);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-light) var(--neutral-100);
}

.container {
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.title-bar {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    padding: 10px 20px;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
    border-radius: 12px 12px 0 0;
    letter-spacing: 1px;
}

.card {
    background-color: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--box-shadow);
    overflow: visible;
    transition: var(--transition);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
    border: 1px solid var(--border-light);
}

/* API Key Dialog */
.api-dialog {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: var(--z-index-dialog);
}

.api-dialog-content {
    background-color: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    width: 90%;
    max-width: 400px;
}

.api-dialog-content h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.api-dialog-content p {
    margin-bottom: 15px;
    font-size: 14px;
    color: var(--text-color);
}

.api-dialog-content input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 15px;
}

.api-dialog-actions {
    display: flex;
    justify-content: flex-end;
}

/* Response Loading Spinner */
.response-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: var(--border-radius);
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(126, 87, 194, 0.2);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Header and selectors */
.header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-medium);
    position: relative;
    z-index: var(--z-index-dropdown);
    background: var(--bg-secondary);
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: max-content;
}

/* 让header-left和header-right之间自动拉伸 */
.header-left {
    display: flex;
    gap: 10px;
    flex: 1 0 auto;
    position: relative;
    align-items: center;
}

.header-right {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    padding-left: 10px;
}

/* 测试版标签样式 */
.header-right span {
  padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.header-right span::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.header-right span:hover::before {
    left: 100%;
}

/* Dropdown styles */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-btn {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding: 0 14px;
    height: 36px;
    font-size: 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
    position: relative;
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(107, 70, 193, 0.06);
}

.dropdown-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.dropdown-content {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background-color: var(--bg-primary);
    min-width: 160px;
    box-shadow: var(--box-shadow-hover);
    border-radius: var(--border-radius);
    z-index: var(--z-index-dropdown);
    margin-top: 6px;
    border: 1px solid var(--border-light);
}

.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 10px 14px;
    text-decoration: none;
    display: block;
    transition: var(--transition);
    font-size: 14px;
}

.dropdown-content a:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

/* Toggle Switch */
.switch {
    position: relative;
    display: flex;
}

.switch input {
    width: 20px;
    height: 20px;
}

/* 专门为testMode checkbox设计的选中样式 */
#testMode {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--neutral-300);
    border-radius: 4px;
    background-color: var(--bg-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    outline: none;
}

#testMode:hover {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

#testMode:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.2);
}

#testMode:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    line-height: 1;
}

#testMode:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.3);
}

.switch input:checked + .slider {
    background-color: #171717;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: #2196F3;
}

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

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Content area */
.content {
    padding: 12px 15px;
    flex-grow: 1;
    z-index: 1; /* 确保内容区域在下层 */
    position: relative;
    overflow: hidden;
}

.input-area {
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    resize: none;
    height: 80px;
    font-family: inherit;
    transition: var(--transition);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
}

.input-area:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
    height: 160px;
}

/* Action buttons */
.action-buttons {
    height: 58px;
    padding-top: 10px;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 为action-buttons添加特殊的滚动条样式 */
.action-buttons::-webkit-scrollbar {
    height: 4px;
}

.action-buttons::-webkit-scrollbar-track {
    background: var(--neutral-100);
    border-radius: 2px;
}

.action-buttons::-webkit-scrollbar-thumb {
    background: var(--primary-lighter);
    border-radius: 2px;
}

.action-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-width: max-content;
    padding: 0 6px;
}

.action-buttons-container {
    display: flex;
    gap: 2%;
    flex: 0 0 auto;
    min-width: 240px;
    justify-content: flex-end;
}

.action-buttons-container .btn {
    border: 1px solid rgba(255, 0, 0, 0);
    box-sizing: border-box;
}
.action-buttons-container .btn:hover {
    border: 1px solid var(--primary-light);
}

/* 优化的页码器样式 */
.pagination {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: nowrap;
    min-width: max-content;
    margin-right: auto;
}

.page-info {
    font-size: 12px;
    color: var(--text-color);
    min-width: 40px;
    text-align: center;
}

.page-btn {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-medium);
    background: var(--bg-primary);
    border-radius: var(--border-radius);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
    color: var(--text-primary);
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(107, 70, 193, 0.06);
}

.page-btn i {
    font-size: 10px;
}

.page-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-hover);
}

.page-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 6px 16px rgba(107, 70, 193, 0.25);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

/* 添加按钮悬停动画 */
.action-buttons-container .btn {
    transform: translateY(0);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.action-buttons-container .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--text-on-primary);
    width: 49%;
    min-width: 120px;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--neutral-200);
    color: var(--text-primary);
    width: 49%;
    min-width: 120px;
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background-color: var(--neutral-300);
    border-color: var(--neutral-400);
}

.btn-stop {
    background-color: var(--error-color) !important;
    color: white !important;
    border: 1px solid var(--error-color) !important;
}

.btn-stop:hover {
    background-color: #DC2626 !important;
    border-color: #DC2626 !important;
}

/* Response section */
.response-section {
    padding: 20px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-light) 100%);
    border-radius: var(--border-radius);
    min-height: 180px;
    flex-grow: 1;
    border: 1px solid var(--border-light);
    position: relative;
    height: 65%;
}

.response-section h3 {
    color: var(--primary-color);
    margin-bottom: 12px;
    font-weight: 500;
    font-size: 16px;
}

.response-container {
    max-height: calc(100% - 50px);
    overflow-y: auto;
}

.response-text {
    white-space: pre-wrap;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-primary);
}

/* Responsive design */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }
    
    .header-row {
        flex-direction: row;
        width: max-content;
        min-width: 100%;
    }
    
    .dropdown-btn {
        font-size: 12px;
        padding: 6px 10px;
        max-width: 100px;
    }
    
    .header-right span {
        font-size: 12px;
    }

    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .page-btn {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    
    .action-row {
        min-width: 100%;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 20px;
        height: 100vh;
    }
    
    .card {
        border-radius: var(--border-radius);
        margin: 20px 0;
    }
} 

/* 更换API按钮 */
.change-api-btn {
    background-color: transparent;
    border: 1px solid #d4d4d4;
    color: #959595;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    font-size: 16px;
    cursor: pointer;
    margin-left: 12px;
    transition: var(--transition);
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(107, 70, 193, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.change-api-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(107, 70, 193, 0.1), transparent);
    transition: left 0.3s;
}

.change-api-btn:hover::before {
    left: 100%;
}

.change-api-btn:hover {
    background-color: var(--primary-light);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(107, 70, 193, 0.20);
}

#aapp-dropdown .dropdown-btn {
    height: 36px;
    padding: 0 10px;
    font-size: 14px;
}

/* 用户名输入框容器样式 */
.user-input-container {
    display: flex;
    align-items: center;
    position: relative;
    margin-left: 16px;
}

.user-input-container i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 14px;
    z-index: 1;
}

.user-input {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--border-radius);
    height: 36px;
    font-size: 14px;
    padding: 0 14px 0 36px;
    transition: var(--transition);
    width: 90px;
    outline: none;
    color: var(--text-primary);
    box-sizing: border-box;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(107, 70, 193, 0.04);
    position: relative;
    font-weight: 400;
}

.user-input:focus {
    width: 140px;
    background: var(--bg-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}
