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

/* Prevent layout shift when vertical scrollbar appears */
html {
    scrollbar-gutter: stable both-edges;
}

body {
    font-family: Inter, Arial, "Microsoft YaHei", sans-serif;
    background: linear-gradient(180deg, #f7f9fc 0%, #f3f6fa 100%);
    color: #333;
    font-size: 14px;
    /* Reserve space for potential vertical scrollbar to avoid page jump */
    overflow-y: scroll;
}

/* 头部样式 */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(160%) blur(6px);
    border-bottom: 1px solid #e9eef5;
    padding: 32px 0; /* slightly more breathing room */
    min-height: 80px;
}

.header-content {
    width: 100%;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 15px;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.logo-img {
    width: 200px;
    height: 46px;
    object-fit: contain;
}

.logo-text {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.privacy-link {
    color: #666;
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    border-bottom: 2px solid transparent;
}

.privacy-link:hover {
    color: #333;
    border-bottom-color: #333;
}

.language-selector {
    display: flex;
    gap: 4px;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.lang-btn {
    background: #ffffff;
    border: 1px solid #dbe3ed;
    color: #4a5568;
    padding: 8px 14px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    border-radius: 999px;
    transition: all 0.2s ease;
}

.lang-btn.active {
    color: #0f172a;
    background: #e9f1fb;
    border-color: #a7c4ea;
    font-weight: 600;
}

.lang-btn:hover {
    color: #0f172a;
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(16, 24, 40, 0.06);
}

/* 主容器 */
.container {
    max-width: 100%;
    margin: 20px auto;
    padding: 0 20px;
    width: calc(100vw - 40px);
    box-sizing: border-box;
}

/* 主面板 */
.main-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Reserve consistent height on privacy pages to avoid layout shift when PDF loads */
.privacy-page .main-panel {
    min-height: 900px;
}

/* 响应面板 */
.response-panel {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06);
    width: 100%;
    box-sizing: border-box;
}

/* 接口地址区域 */
.api-endpoint-section {
    margin-bottom: 20px;
}

.api-endpoint-section .endpoint-row {
    border: 1px solid #e0e0e0;
    border-top: none; /* 与标题连接 */
    border-radius: 0 0 4px 4px;
    padding: 15px;
    background: #fafafa;
    margin-bottom: 0;
}

/* section-title 保持自适应宽度，且在切换显示时不被撑满 */
.section-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 0;
    color: #0f172a;
    background: #f2f6fc;
    border: 1px solid #e7edf7;
    border-bottom: 2px solid #003d6b;
    border-radius: 12px 12px 0 0;
    padding: 12px 16px;
    display: inline-block;
    position: relative;
    margin-bottom: -1px;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    box-sizing: border-box;
}

/* 参数标题 - 全宽 */
#params-title {
    width: 100%;
    box-sizing: border-box;
}

.endpoint-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    width: 100%;
}

.endpoint-label {
    background: #f0f0f0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    min-width: 80px;
    text-align: center;
    color: #666;
}

.endpoint-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 14px;
    min-width: 0; /* 移除固定最小宽度，允许更好的自适应 */
    max-width: 100%; /* 确保不会超出容器 */
}

.endpoint-select:last-child {
    flex: 2;
    min-width: 0; /* 移除固定最小宽度 */
    max-width: 100%; /* 确保不会超出容器 */
}

.endpoint-select:focus {
    border-color: #007acc;
    outline: none;
}

/* 下拉框错误状态样式 */
.endpoint-select.error {
    border: 2px solid #ff4444 !important;
    position: relative;
}

/* 下拉框容器用于显示感叹号 */
.endpoint-select-wrapper {
    position: relative;
    flex: 1;
    min-width: 0; /* 允许容器收缩 */
}

.endpoint-select-wrapper:last-child {
    flex: 2; /* 第三个下拉框占更多空间 */
}

.endpoint-select-wrapper.error::after {
    content: '!';
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    color: #ff4444;
    font-weight: bold;
    font-size: 18px;
    pointer-events: none;
    z-index: 1;
}

.endpoint-select-wrapper .endpoint-select {
    width: 100%;
}

/* 功能开关区域 */
.toggle-section {
    display: flex;
    gap: 60px;
    margin: 20px 0;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
}

.toggle-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* 隐藏原生复选框 */
.toggle-checkbox {
    display: none;
}

/* 自定义开关样式 */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.toggle-switch.active {
    background-color: #003d6b;
}

.toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

.toggle-switch.active .toggle-slider {
    transform: translateX(26px);
}

.toggle-label {
    font-size: 14px;
    color: #333;
    cursor: pointer;
}

/* 表单区域样式 */
.form-section {
    margin-bottom: 20px;
    border: 1px solid #e7edf7;
    border-top: none; /* 移除顶部边框，与section-title连接 */
    border-radius: 0 0 12px 12px; /* 只保留底部圆角 */
    padding: 16px;
    background: #f9fbff;
    width: 100%;
    box-sizing: border-box;
}

/* 密匙区域 - 一半宽度 */
#auth-section {
    width: 50%;
}

/* 请求头区域 - 一半宽度 */
#headers-section {
    width: 50%;
}

/* 参数区域 - 全宽 */
#params-section {
    width: 100%;
}

/* 缓存区域 - 全宽 */
#cache-section {
    width: 100%;
}

/* 表单样式 */
.form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: center;
}

.form-label {
    background: #f0f0f0;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
    color: #666;
}

.form-input,
.form-select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #dbe3ed;
    border-radius: 10px;
    background: #ffffff;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus,
.form-select:focus {
    border-color: #7fb2f0;
    outline: none;
    box-shadow: 0 0 0 4px rgba(127, 178, 240, 0.15);
}

.form-input[disabled] {
    background: #f5f5f5;
    color: #999;
}

/* 参数行样式 */
.param-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
}

/* 请求头区域的参数行样式 */
#headers-section .param-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    width: 100%;
}

#headers-section .param-row .param-input {
    flex: 1;  
    min-width: 0;
}

#headers-section .param-row .btn-danger {
    flex: none;
    width: auto;
    min-width: 60px;
    margin-left: 10px;
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.param-row-with-labels {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    align-items: flex-end;
}

.param-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.param-label {
    font-size: 12px;
    color: #666;
    font-weight: bold;
}

.param-input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
}

.param-input:focus {
    border-color: #007acc;
    outline: none;
}

/* 按钮样式 */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.06s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn-primary {
    background: linear-gradient(180deg, #0f4a7f 0%, #003d6b 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #125a9b 0%, #004279 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 74, 127, 0.25);
}

.btn-danger {
    background: linear-gradient(180deg, #7f0f0f 0%, #6b0000 100%);
    color: white;
    padding: 6px 12px;
    font-size: 12px;
}

.btn-danger:hover {
    background: linear-gradient(180deg, #9b1212 0%, #790404 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(127, 16, 16, 0.25);
}

.btn-success {
    background: linear-gradient(180deg, #0f4a7f 0%, #003d6b 100%);
    color: white;
    padding: 15px 30px;
    font-size: 16px;
    font-weight: bold;
    margin: 20px 0;
    width: 100%;
    display: block;
    transition: all 0.3s ease;
}

.btn-success:hover {
    background: linear-gradient(180deg, #125a9b 0%, #004279 100%);
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(16, 74, 127, 0.25);
}

.btn-success:disabled {
    background: #ccc;
    color: #666;
    cursor: not-allowed;
}

.btn-success:disabled:hover {
    background: #ccc;
}

/* 加载状态样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #003d6b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

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

.loading-text {
    font-size: 16px;
    color: #333;
    margin: 0;
}

/* 禁用状态样式 */
.form-disabled {
    pointer-events: none;
    opacity: 0.6;
}

/* 系统提示弹框样式 */
.system-alert-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.system-alert-content {
    background: white;
    padding: 40px 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    min-width: 350px;
    max-width: 400px;
}

.system-alert-icon {
    margin-bottom: 25px;
}

.alert-icon-circle {
    width: 80px;
    height: 80px;
    border: 4px solid #ff6b6b;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    background: white;
}

.alert-icon-x {
    color: #ff6b6b;
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
}

.system-alert-title {
    font-size: 20px;
    font-weight: bold;
    color: #333;
    margin: 0 0 20px 0;
}

.system-alert-message {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
    line-height: 1.4;
}

.system-alert-btn {
    background: #4a90e2;
    color: white;
    border: none;
    padding: 12px 40px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
    font-weight: 500;
}

.system-alert-btn:hover {
    background: #357abd;
}

/* 参数错误提示样式 */
.param-error {
    color: #ff4444;
    font-size: 12px;
    margin-top: 5px;
    padding: 5px 0;
    border-top: 1px solid #ffdddd;
    background-color: #fff5f5;
}

/* 参数标签页 */
.param-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
    list-style: none;
}

.param-tabs li {
    margin-right: 2px;
}

.param-tabs a {
    display: block;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    color: #666;
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
}

.param-tabs a.active {
    display: block;
    padding: 10px 14px;
    background: #f1f5fa;
    border: 1px solid #e3e9f3;
    color: #374151;
}

/* 文本域样式 */
.textarea-large {
    width: 100%;
    min-height: 120px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 10px 10px 0 0;
    background: #ffffff;
    color: #0f172a;
    border-bottom: 1px solid #ffffff;
}

.textarea-large:focus {
    box-shadow: 0 -6px 16px rgba(16, 24, 40, 0.06);
    border-color: #007acc;
    outline: none;
}

/* 响应区域样式 */
.response-area {
    margin-top: 20px;
}

/* 响应标签页样式 */
.nav-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 20px;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.nav-tabs li {
    margin-right: 2px;
}

.nav-tabs a {
    display: block;
    padding: 8px 15px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-bottom: none;
    color: #666;
    text-decoration: none;
    border-radius: 4px 4px 0 0;
    font-size: 13px;
    white-space: nowrap;
}

.nav-tabs a.active {
    background: #fff;
    color: #333;
    border-bottom: 1px solid #fff;
    margin-bottom: -1px;
    position: relative;
    z-index: 1;
}

.nav-tabs a:hover {
    background: #e9e9e9;
}

.tab-content {
    display: none;
}

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

.param-tab-content {
    display: none;
}

.param-tab-content.active {
    display: block;
}

.cache-tab-content {
    display: none;
}

.cache-tab-content.active {
    display: block;
}

.response-data {
    background: #ffffff;
    border: 1px solid #e3e9f3;
    border-radius: 12px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
    min-height: 200px;
    color: #333;
}

/* 请求头/返回头分区样式 */
.headers-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    min-height: 200px;
}

.headers-part {
    border-bottom: 2px solid #e0e0e0;
    padding: 15px;
}

.headers-part:last-child {
    border-bottom: none;
}

.headers-title {
    font-size: 14px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
}

.response-panel {
    background: #fafafa;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 20px;
    margin-top: 20px;
}

/* 密码输入框眼睛图标 */
.password-input-container {
    position: relative;
    flex: 1;
}

.password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
    font-size: 16px;
}

/* JSON美化器样式 */
.json-formatter {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    background: #fff;
    color: #333;
}

.json-formatter ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.json-formatter li {
    position: relative;
    margin: 0;
    padding: 0;
}

.json-formatter .json-key {
    color: #0066cc;
    font-weight: bold;
}

.json-formatter .json-string {
    color: #009900;
}

.json-formatter .json-number {
    color: #cc0000;
}

.json-formatter .json-boolean {
    color: #0066cc;
    font-weight: bold;
}

.json-formatter .json-null {
    color: #666;
    font-style: italic;
}

.json-formatter .json-toggle {
    cursor: pointer;
    user-select: none;
    margin-right: 6px;
    color: #666;
    font-weight: bold;
    display: inline-block;
    width: 12px;
    text-align: center;
}

.json-formatter .json-toggle:hover {
    color: #333;
}

.json-formatter .json-toggle.collapsed::before {
    content: '▶';
}

.json-formatter .json-toggle.expanded::before {
    content: '▼';
}

.json-formatter .json-toggle.leaf::before {
    content: '';
}

.json-formatter .json-bracket {
    color: #666;
    font-weight: bold;
}

.json-formatter .json-comma {
    color: #666;
}

.json-formatter .json-line {
    padding: 1px 0;
    border-left: 1px solid transparent;
}

.json-formatter .json-line:hover {
    background-color: #f5f5f5;
}

.json-formatter .json-indent {
    display: inline-block;
    width: 20px;
}

.json-formatter .json-collapsed {
    display: none;
}

.json-formatter .json-ellipsis {
    color: #999;
    font-style: italic;
}

/* 请求头参数面板样式 */
.request-params-panel {
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin: 20px auto;
    width: calc(100vw - 40px);
    max-width: 100%;
    box-sizing: border-box;
}

.request-params-placeholder {
    min-height: 100px;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

/* 底部备案信息样式 */
.footer {
    background: #000;
    color: #fff;
    padding: 15px 0;
    margin-top: 30px;
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .endpoint-row {
        flex-direction: column;
        gap: 10px;
    }

    .toggle-section {
        flex-direction: column;
        gap: 15px;
    }

    .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    .form-label {
        min-width: auto;
    }

    .footer-content {
        font-size: 12px;
        padding: 0 15px;
    }
}

.password-input-container {
    width: 100%;
}
#auth-section .form-input {
    width: 100%;
    min-width: 120px;
    box-sizing: border-box;
}
#auth-section .password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}
#auth-section .form-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
}
