/* 全局变量：定义一套炫酷的霓虹色系 */
:root {
    --primary-gradient: linear-gradient(135deg, #00c6fb 0%, #005bea 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --text-glow: 0 0 10px rgba(255, 255, 255, 0.5);
    --card-radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 更加平滑的字体渲染 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* 深邃星空背景 */
    background: radial-gradient(circle at 10% 20%, rgb(33, 33, 33) 0%, rgb(10, 10, 30) 90.2%);
    color: #e2e8f0;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

/* 动态背景光斑 - 营造氛围感 */
body::before, body::after {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    animation: floatingOrb 20s infinite ease-in-out alternate;
}

body::before {
    background: rgba(118, 75, 162, 0.25);
    top: -100px;
    left: -100px;
}

body::after {
    background: rgba(0, 198, 251, 0.15);
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes floatingOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, 50px) scale(1.1); }
    100% { transform: translate(-30px, -20px) scale(0.9); }
}

/* 顶部导航栏 - 悬浮玻璃条 */
.header {
    background: rgba(20, 20, 40, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    z-index: 100;
}

.header h1 {
    font-size: 26px;
    font-weight: 800;
    letter-spacing: 1px;
    /* 渐变文字 + 辉光 */
    background: linear-gradient(to right, #fff, #a5f3fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    text-shadow: 0 0 20px rgba(165, 243, 252, 0.4);
    position: relative;
}

.header h1::after {
    content: 'PRO';
    font-size: 10px;
    background: var(--primary-gradient);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    vertical-align: super;
    color: white;
    text-shadow: none;
    box-shadow: 0 0 10px rgba(0, 198, 251, 0.5);
}

.header-controls {
    display: flex;
    gap: 12px;
}

/* 按钮通用样式 - 科技感 */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* 主按钮 - 霓虹流光 */
.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 91, 234, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 91, 234, 0.6);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

/* 次级按钮 - 磨砂玻璃 */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

/* 设置面板 - 高级弹窗 */
.settings-panel {
    background: rgba(23, 25, 35, 0.95);
    backdrop-filter: blur(25px);
    padding: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    animation: slideDown 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.settings-panel h3 {
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 20px;
    border-left: 3px solid #00c6fb;
    padding-left: 10px;
}

.setting-item label {
    color: #cbd5e1;
    font-size: 14px;
}

.setting-item input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.setting-item input:focus {
    outline: none;
    border-color: #00c6fb;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 198, 251, 0.15);
}

/* 主布局 */
.main-container {
    display: flex;
    height: calc(100vh - 72px); /* 减去header高度 */
    gap: 20px;
    padding: 20px;
}

/* 面板 - 核心容器 */
.panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* 极致的毛玻璃效果 */
    background: rgba(30, 30, 45, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--card-radius);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: transform 0.3s ease;
}

.panel:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.panel-header {
    padding: 15px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 0%, transparent 100%);
}

.panel-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 标题前的小装饰点 */
.panel-header h2::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #00c6fb;
    box-shadow: 0 0 10px #00c6fb;
}

.left-panel .panel-header h2::before {
    background: #f5576c;
    box-shadow: 0 0 10px #f5576c;
}

/* 内容区域 */
.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    position: relative;
}

/* 炫酷的自定义滚动条 */
.panel-content::-webkit-scrollbar {
    width: 6px;
}
.panel-content::-webkit-scrollbar-track {
    background: transparent;
}
.panel-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.panel-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* PDF Canvas 效果 - 悬浮阴影 */
#pdfCanvas {
    display: block;
    margin: 0 auto;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s ease;
}

#pdfCanvas:hover {
    transform: scale(1.01);
}

/* 翻译内容排版 */
.translation-content {
    line-height: 1.8;
    color: #e2e8f0;
    font-size: 15px;
}

.translation-content p {
    margin-bottom: 20px;
    text-align: justify;
}

.translation-content h1, 
.translation-content h2, 
.translation-content h3 {
    margin: 30px 0 15px;
    background: linear-gradient(135deg, #fff 0%, #cbd5e1 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
    position: relative;
    padding-left: 15px;
}

.translation-content h1::before,
.translation-content h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 5px;
    bottom: 5px;
    width: 4px;
    background: var(--secondary-gradient);
    border-radius: 2px;
}

/* 加载动画 - 炫酷光圈 */
.loading-indicator {
    color: #00c6fb;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(0, 198, 251, 0.2);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0, 198, 251, 0.3);
    border-top-color: #00c6fb;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.68, -0.55, 0.27, 1.55) infinite;
}

/* 分页标签 */
.page-translation {
    position: relative;
    padding-bottom: 40px;
    margin-bottom: 40px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
}

.page-number {
    display: inline-block;
    background: rgba(255, 255, 255, 0.1);
    color: #00c6fb;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 20px;
    border: 1px solid rgba(0, 198, 251, 0.2);
    box-shadow: 0 0 15px rgba(0, 198, 251, 0.1);
}

/* 底部控制栏 */
.panel-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    background: rgba(0, 0, 0, 0.2);
}

.nav-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.nav-btn:hover:not(:disabled) {
    background: var(--primary-gradient);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 91, 234, 0.5);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

#currentPage {
    font-family: 'Courier New', monospace;
    color: #00c6fb;
    font-weight: bold;
    font-size: 16px;
    text-shadow: 0 0 10px rgba(0, 198, 251, 0.5);
}

/* 占位符动画 */
.placeholder {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 18px;
    letter-spacing: 1px;
    animation: breath 3s infinite ease-in-out;
}

@keyframes breath {
    0%, 100% { opacity: 0.4; transform: scale(0.98); }
    50% { opacity: 0.8; transform: scale(1); text-shadow: 0 0 20px rgba(255, 255, 255, 0.2); }
}

/* 标签页 */
.tabs {
    display: flex;
    gap: 8px;
}

.tab-btn {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.tab-btn.active {
    background: var(--primary-gradient);
    border-color: rgba(0, 198, 251, 0.3);
    color: white;
    box-shadow: 0 0 15px rgba(0, 198, 251, 0.3);
}

.tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
}

.panel-content-inner {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
}

/* 问答界面 */
.qa-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.qa-history {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.qa-message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease;
}

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

.qa-question {
    background: rgba(0, 198, 251, 0.1);
    border: 1px solid rgba(0, 198, 251, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.qa-question::before {
    content: '👤';
    font-size: 18px;
}

.qa-answer {
    background: rgba(245, 87, 108, 0.1);
    border: 1px solid rgba(245, 87, 108, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.6;
}

.qa-answer::before {
    content: '🤖';
    font-size: 18px;
}

.qa-input-area {
    display: flex;
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#questionInput {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 10px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#questionInput:focus {
    border-color: #00c6fb;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 3px rgba(0, 198, 251, 0.15);
}

#questionInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.qa-input-area .btn {
    padding: 10px 24px;
    white-space: nowrap;
}

/* 预设问题区域 */
.qa-questions-area {
    margin-bottom: 15px;
    padding: 12px;
}

.qa-questions-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.qa-questions-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.question-chip {
    padding: 10px 18px;
    background: rgba(0, 198, 251, 0.12);
    border: 1px solid rgba(0, 198, 251, 0.3);
    border-radius: 20px;
    color: #e0f2fe;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.question-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        120deg,
        transparent 30%,
        rgba(0, 198, 251, 0.15),
        transparent 70%
    );
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.question-chip:hover {
    background: rgba(0, 198, 251, 0.25);
    border-color: rgba(0, 198, 251, 0.5);
    transform: translateY(-3px) scale(1.02);
    box-shadow:
        0 8px 25px rgba(0, 198, 251, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    color: white;
}

.question-chip:hover::before {
    transform: translateX(100%);
}

.question-chip:active {
    transform: translateY(-1px) scale(0.98);
}

/* 响应式适配 */
@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        height: auto;
    }
    .panel {
        min-height: 400px;
    }
}

/* ============ 设置弹窗样式 ============ */

/* 模态框背景 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

/* 模态框内容 */
.modal-content {
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.98));
    border: 1px solid rgba(0, 198, 251, 0.2);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(0, 198, 251, 0.1);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 模态框头部 */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.modal-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 32px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s ease;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: rotate(90deg);
}

/* 模态框主体 */
.modal-body {
    padding: 25px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    font-weight: 500;
}

.setting-item input {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.setting-item input:focus {
    border-color: #00c6fb;
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 0 3px rgba(0, 198, 251, 0.15);
}

.setting-item input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.setting-item small {
    display: block;
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
}

/* 状态信息 */
.setting-status {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    text-align: center;
    margin-top: 10px;
    transition: all 0.3s ease;
}

.setting-status.info {
    background: rgba(0, 198, 251, 0.1);
    border: 1px solid rgba(0, 198, 251, 0.2);
    color: #00c6fb;
}

.setting-status.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.setting-status.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* 模态框底部 */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 25px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-footer .btn {
    padding: 10px 24px;
    border-radius: 10px;
    font-size: 14px;
}

/* 设置按钮 */
.btn-icon {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: rgba(0, 198, 251, 0.3);
    box-shadow: 0 0 15px rgba(0, 198, 251, 0.2);
}

/* 临时密钥显示 */
.temp-key-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.temp-key-container code {
    flex: 1;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 198, 251, 0.3);
    border-radius: 10px;
    color: #00c6fb;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: all;
}

.temp-key-container code:hover {
    background: rgba(0, 198, 251, 0.1);
    border-color: #00c6fb;
}

.btn-small {
    padding: 8px 16px;
    background: rgba(0, 198, 251, 0.1);
    border: 1px solid rgba(0, 198, 251, 0.3);
    border-radius: 8px;
    color: #00c6fb;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    white-space: nowrap;
}

.btn-small:hover {
    background: rgba(0, 198, 251, 0.2);
    border-color: #00c6fb;
}