/* ========================================
   现代化增强样式 - Visual Redesign 2.0
   ======================================== */

:root {
    /* 核心色板 - 紫蓝渐变体系 */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --primary-gradient-hover: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    --accent-color: #764ba2;
    
    /* 背景体系 */
    --bg-body-gradient: #eeeeee;
    --bg-glass: rgba(255, 255, 255, 0.65);
    --bg-glass-strong: rgba(255, 255, 255, 0.85);
    
    /* 阴影体系 */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.12);
    --shadow-blue: 0 8px 24px rgba(118, 75, 162, 0.25);
    
    /* 圆角 */
    --radius-md: 12px;
    --radius-lg: 20px;
    
    /* 动画 */
    --transition-base: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 暗色模式变量重写 */
[data-theme="dark"] {
    --bg-body-gradient: linear-gradient(120deg, #2a2a72 0%, #009ffd 100%);
    --bg-glass: rgba(30, 41, 59, 0.7);
    --bg-glass-strong: rgba(15, 23, 42, 0.9);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* ========================================
   1. 全局背景与基础布局
   ======================================== */
body {
    background: var(--bg-body-gradient) !important;
    background-attachment: fixed;
    background-size: cover;
    min-height: 100vh;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    color: #2d3748;
}

/* 页面加载动画 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
    z-index: 9999;
    animation: fadeOut 0.8s forwards;
    pointer-events: none;
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* 使得 Main Content 透明，显示Body背景 */
.main-content {
    background: transparent !important;
}

/* Header 使用 fixed 定位，主容器需要预留顶部空间 */
.main-container {
    margin-top: 64px !important;
}

/* 内容区域与顶部对齐 */
.content-wrapper {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* 页面内容无顶部间距 */
.page-content {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* ========================================
   2. 顶部导航栏 (Gradient Header)
   ======================================== */
.header {
    background: var(--bg-glass-strong) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-bottom: 1px solid #ccc;
    box-shadow: var(--shadow-sm);
    height: 64px;
    position: fixed !important;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

/* Logo 样式增强 */
.logo {
    font-weight: 800;
    font-size: 24px;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

/* ========================================
   3. 侧边栏 (Glassmorphism Sidebar)
   ======================================== */
.sidebar {
    background: #ffffff !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border-right: 1px solid rgba(255,255,255,0.3) !important;
    box-shadow: var(--shadow-md);
    margin: 0;
    border-radius: 0;
    height: calc(100vh - var(--header-height)); /* 从banner底部到屏幕底部 */
    padding-left: 0;
    padding-right: 0;
}

.sidebar-title {
    color: var(--accent-color);
    font-weight: 700;
    border-bottom: 2px solid rgba(118, 75, 162, 0.1);
    padding-bottom: 12px;
}

/* API 列表项交互 */
.api-item {
    border-radius: var(--radius-md);
    margin-bottom: 8px;
    transition: var(--transition-base);
    border: 1px solid transparent;
    padding: 10px 16px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.3);
}

.api-item:hover {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0.7) 100%);
    transform: translateX(6px);
    box-shadow: var(--shadow-sm);
}

.api-item.active {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: var(--shadow-blue);
    transform: translateX(6px);
}

/* 弹窗样式统一 (Modal) */
.modal-content, .requirement-modal .modal-content {
    background: var(--bg-glass-strong) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: var(--shadow-lg) !important;
}

/* ========================================
   4. 内容卡片 (Modern Cards)
   ======================================== */
.api-detail-card {
    background: transparent !important;
    backdrop-filter: none;
    border-radius: 0;
    box-shadow: none !important;
    border: none;
    /* 与 footer-content 相同的宽度约束 */
    max-width: calc(1400px - 32px) !important;
    margin: 0 auto !important;
    padding: 0 !important;
    transition: var(--transition-base);
}

/* 标题区域 */
.api-header {
    background: transparent !important; /* 移除之前的背景，保持卡片统一 */
    border-bottom: 2px solid rgba(0,0,0,0.05);
    padding-bottom: 20px;
    margin-bottom: 24px;
}

.api-title {
    font-size: 28px;
    font-weight: 700;
    color: #1a202c;
}

/* ========================================
   5. 按钮与交互 (Buttons)
   ======================================== */
.btn, .search-btn, .submit-requirement-btn, #loginBtn {
    border-radius: 8px;
    border: none;
    transition: var(--transition-base);
    position: relative;
    overflow: hidden;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* 主按钮 */
.btn-primary, #loginBtn, .submit-requirement-btn {
    background: var(--primary-gradient) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

/* 悬浮缩放效果 */
.btn-primary:hover, #loginBtn:hover, .submit-requirement-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(118, 75, 162, 0.4);
}

.btn:active {
    transform: scale(0.98);
}

/* 搜索框 */
.search-input {
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    border-radius: 30px;
    padding: 8px 20px;
    transition: var(--transition-base);
    backdrop-filter: blur(4px);
}

.search-input:focus {
    background: #fff;
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.15);
    width: 280px !important; /* 聚焦展开 */
}

/* ========================================
   6. 调试面板 & 代码块
   ======================================== */
.request-panel, .response-panel {
    border-radius: 0;
    border: none;
    background: rgba(248, 250, 252, 0.5);
}

/* FIXED (T016-7): Exclude code examples from dark background */
.response-content pre,
.response-body pre {
    background: #1e293b !important; /* 深色代码背景 */
    color: #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    font-family: 'Fira Code', monospace;
}

/* Code examples use light background (from style.css T016-6) */
.code-example pre {
    background: #f6f8fa !important;
    color: #24292f !important;
    border: 1px solid #e1e4e8 !important;
    white-space: pre !important;
    word-wrap: normal !important;
}

/* ========================================
   7. 底部 Footer
   ======================================== */
.footer {
    background: transparent !important;
    backdrop-filter: none !important;
    margin-top: 0 !important;
    border-top: none !important;
    padding: 1px 0 !important;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .content-wrapper {
        padding-top: 0 !important;
    }
    .sidebar {
        margin: 0;
        border-radius: 0;
        height: auto;
    }
    .api-detail-card {
        margin: 10px;
        padding: 20px;
    }
    /* FIXED (T016-7): Stack debugger panels on mobile */
    .debugger-container {
        grid-template-columns: 1fr !important;
    }
}

/* ========================================
   8. 修复与优化 (Fixes)
   ======================================== */

/* 修复头部 Badge 可见性 - 确保方法标签清晰可见 */
.api-header .badge {
    background: var(--accent-color); /* 使用主题紫 #764ba2，确保高对比度 */
    color: #ffffff;
    padding: 6px 14px;
    border-radius: var(--radius-md);
    margin-right: 8px;
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.2);
    display: inline-block;
    vertical-align: middle;
}

/* 最后一个 badge (通常是方法标签) 使用特殊颜色区分 */
.api-header .badge:last-child {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%); /* 绿色渐变 */
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* 修复描述文字颜色太浅的问题 */
.api-description {
    color: #334155 !important; /* 深蓝灰色 #334155 */
    font-size: 1.05rem;
    line-height: 1.6;
    margin-top: 16px;
    font-weight: 500;
}

/* 暗色模式适配 */
[data-theme="dark"] .api-description {
    color: #cbd5e1 !important;
}
/* ========================================
   9. User Requested Optimizations (CLI Patch)
   ======================================== */

/* 1. Response Example Code Block Fix */
/* FIXED (T016-7): Only apply to response areas, not code examples */
.response-example,
.code-block,
.response-content,
.response-body pre,
.response-content pre {
    color: #ffffff !important; /* Pure white text for better contrast */
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.response-body pre,
.response-content pre {
    background: #1e293b !important; /* Ensure dark background */
    border: 1px solid rgba(255,255,255,0.1);
}

/* Code examples keep light styling */
.code-example code {
    color: #24292f !important;
    text-shadow: none !important;
}

/* 2. Online Debug Module Optimization */
/* FIXED (T016-7): Preserve grid layout for left-right design */
.debugger-container {
    display: grid !important;
    grid-template-columns: minmax(320px, calc(33.333% - 1px)) minmax(420px, calc(66.667% + 1px)) !important;
    gap: 0 !important;
    height: calc(100vh - var(--header-height) - var(--footer-height)) !important;
    overflow: hidden !important;
}

/* Panels */
.request-panel, .response-panel,
.debugger-tabs-container {
    background: #ffffff !important;
    border: none !important;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.1) !important;
    border-radius: 0 !important;
    transition: all 0.3s ease;
}

/* 左侧请求面板添加右侧分割线 */
.request-panel {
    border-right: 2px solid #e5e7eb !important;
}

/* FIXED (T016-7): Request panel needs padding, tabs container doesn't */
.request-panel, .response-panel {
    padding: 24px !important;
}

.debugger-tabs-container {
    padding: 0 !important; /* No padding for tabs container */
}

/* Input Fields */
.param-input, .debug-input, input[type="text"], textarea {
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    padding: 12px 16px !important;
    transition: all 0.3s ease !important;
    color: #334155 !important;
    font-size: 14px !important;
}

.param-input:focus, .debug-input:focus, input[type="text"]:focus, textarea:focus {
    border-color: var(--accent-color) !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(118, 75, 162, 0.15) !important;
    outline: none !important;
}

/* Send Request Button */
#sendRequestBtn, .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 10px 24px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3) !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
}

#sendRequestBtn:hover, .btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4) !important;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

/* Clear Button */
#clearParamsBtn, .btn-clear {
    background: transparent !important;
    color: #64748b !important;
    border: 1px solid rgba(148, 163, 184, 0.5) !important;
    box-shadow: none !important;
    border-radius: 8px !important;
    padding: 9px 20px !important;
}

#clearParamsBtn:hover, .btn-clear:hover {
    background: rgba(203, 213, 225, 0.3) !important;
    border-color: #94a3b8 !important;
    color: #334155 !important;
}

/* Response Area Glass Effect */
.response-body {
    background: rgba(30, 41, 59, 0.7) !important; /* Dark glass */
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-radius: 12px !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    padding: 0 !important;
    overflow: hidden !important;
    margin-top: 16px !important;
}

/* 3. Footer Width Alignment */
/* Make the footer content wrapper look exactly like the API detail card */
.footer-content {
    background: transparent !important;
    backdrop-filter: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    border: none !important;
    
    /* Footer 保持原有宽度 */
    max-width: calc(1400px - 32px) !important;
    margin: 0 auto 16px auto !important; /* 顶部间距减小 */
    padding: 32px !important;
    width: auto !important;
    box-sizing: border-box !important;
}

/* Reset inner sections to be clean layouts without individual card backgrounds */
.footer-sections {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)) !important;
    gap: 32px !important;
    margin: 0 !important;
    width: 100% !important;
}

.footer-section {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    backdrop-filter: none !important;
}

/* 4. Other Optimizations */
/* Tables */
table {
    width: 100% !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    background: rgba(255, 255, 255, 0.4) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    margin: 16px 0 !important;
}

th {
    background: rgba(118, 75, 162, 0.08) !important;
    color: var(--accent-color) !important;
    font-weight: 600 !important;
    padding: 16px !important;
    text-align: left !important;
}

td {
    padding: 14px 16px !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
    color: #475569 !important;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.6) !important;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 114, 128, 0.8);
}

/* ========================================
   11. Footer Content Detail Optimization (Final Polish)
   ======================================== */

/* 1. Title Styles (.footer-section h4) */
.footer-section h4 {
    font-size: 1.2rem;
    font-weight: 700 !important;
    color: var(--accent-color) !important; /* Theme Purple */
    margin-bottom: 24px;
    padding-left: 16px;
    position: relative;
    border-left: 5px solid var(--accent-color); /* Left decoration line */
    line-height: 1.2;
    letter-spacing: 0.5px;
}

/* 2. Business Dynamics List (.business-line) */
.business-line {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 6px !important; /* 更紧凑的圆角 */
    padding: 6px 10px !important; /* 进一步减小内边距 */
    margin-bottom: 5px !important; /* 进一步减小间距 */
    line-height: 1.4; /* 优化行高 */
    font-size: 0.92rem; /* 稍微减小字体 */
    transition: var(--transition-base);
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.business-line:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-2px); /* 减小悬浮位移 */
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.15); /* 调整阴影使其更精致 */
    border-color: rgba(118, 75, 162, 0.3);
}

.business-line::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background: var(--primary-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.business-line:hover::before {
    opacity: 1;
}

/* 3. Company Intro (.footer-section p) */
.footer-section p {
    line-height: 1.8 !important; /* Line height 1.8 */
    margin-bottom: 20px; /* Paragraph spacing optimization */
    color: #475569;
    font-size: 0.95rem;
    text-align: justify;
}

/* 4. Contact Info (.contact-item) - 横向排列 */
.footer-contact-row {
    margin-top: 20px !important;
}

.contact-items {
    display: flex !important;
    flex-direction: row !important; /* 强制横向 */
    flex-wrap: wrap !important;
    gap: 24px !important;
    align-items: center !important;
}

.contact-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    padding: 8px 16px !important;
    border-radius: 20px !important;
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    transition: var(--transition-base);
    margin-bottom: 0 !important;
}

.contact-item .contact-icon {
    width: 32px;
    height: 32px;
    padding: 6px;
    background: rgba(118, 75, 162, 0.1); /* Icon background */
    border-radius: 50%;
    object-fit: contain;
}

.contact-item span {
    font-weight: 500;
    color: #334155;
}

/* 5. Submit Requirement Button */
.submit-requirement-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; /* Gradient background */
    color: #ffffff !important;
    border: none;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.3);
    overflow: hidden;
    position: relative;
}

.submit-requirement-btn:hover {
    transform: translateY(-3px) scale(1.03); /* Hover animation */
    box-shadow: 0 8px 25px rgba(118, 75, 162, 0.5);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%) !important;
}

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

.submit-requirement-btn:hover::after {
    left: 100%;
}

.submit-requirement-btn .icon-img {
    width: 18px;
    height: 18px;
    filter: brightness(0) invert(1);
}

/* 6. Copyright (.copyright) */
.footer-bottom {
    margin-top: 40px;
    padding-top: 24px;
    border-top: none;
    text-align: center;
}

.copyright p {
    color: #333333 !important;
    font-size: 0.85rem;
    margin: 6px 0;
}

.copyright a.beian {
    color: #94a3b8 !important;
    text-decoration: none;
    border-bottom: 1px dashed transparent;
    transition: border-color 0.3s;
}

.copyright a.beian:hover {
    color: var(--accent-color) !important;
    border-bottom-color: var(--accent-color);
}
