/* ============================================================
   CSV表格转换工具 - tools/csv-tool/style.css
   包含：官网全局变量/导航/页脚样式（与官网 style.css 一致）
        + 工具页面专属样式 + 移动端适配
   ============================================================ */

/* ===== 全局变量（与官网一致） ===== */
:root {
    --primary: #1a6eff;
    --primary-light: #e8f1ff;
    --primary-dark: #0d4fc4;
    --primary-gradient: linear-gradient(135deg, #1a6eff 0%, #0d4fc4 100%);
    --text: #1a1a2e;
    --text-secondary: #5a5a7a;
    --text-light: #8a8aa0;
    --bg: #ffffff;
    --bg-warm: #f8fafc;
    --bg-card: #ffffff;
    --border: #e8ecf4;
    --shadow: 0 4px 24px rgba(26, 110, 255, 0.08);
    --shadow-hover: 0 12px 40px rgba(26, 110, 255, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --warning: #ff6b35;
    --warning-light: #fff3ed;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --success: #16a34a;
    --success-light: #f0fdf4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ===== 导航（与官网 style.css 规则一致） ===== */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(26, 110, 255, 0.08);
    transition: var(--transition);
}
.navbar.scrolled { box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06); }
.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.logo-icon { display: flex; align-items: center; justify-content: center; color: white; font-weight: 900; font-size: 18px; }
.logo-icon img { height: 44px; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--text); line-height: 1.3; }
.logo-text span { display: block; font-size: 11px; font-weight: 400; color: var(--text-light); letter-spacing: 1px; }
.nav-links { display: flex; gap: 4px; list-style: none; }
.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition);
}
.nav-links a:hover, .nav-links a.active { color: var(--primary); background: var(--primary-light); }
.mobile-toggle {
    display: none;
    width: 40px; height: 40px;
    border: none;
    background: var(--primary-light);
    border-radius: 10px;
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.mobile-toggle span {
    display: block;
    width: 20px; height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: var(--transition);
}

/* ===== 页脚（与官网 style.css 规则一致） ===== */
.footer {
    background: var(--text);
    color: white;
    padding: 64px 0 32px;
}
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 48px;
}
.footer-brand .logo-icon { margin-bottom: 16px; display: flex; align-items: left; justify-content: left; }
.footer-brand .logo-icon img { height: 84px; }
.footer-brand p { font-size: 14px; color: rgba(255, 255, 255, 0.6); line-height: 1.8; max-width: 320px; }
.footer-col h4 { font-size: 14px; font-weight: 700; margin-bottom: 20px; color: rgba(255, 255, 255, 0.9); }
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; }
.footer-col a { color: rgba(255, 255, 255, 0.5); text-decoration: none; font-size: 14px; transition: var(--transition); }
.footer-col a:hover { color: white; }
.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.footer-bottom p, .footer-bottom a { font-size: 13px; color: rgba(255, 255, 255, 0.4); }

/* ===== 页面公共 ===== */
.page-header {
    padding: 140px 0 40px;
    background: linear-gradient(180deg, #f0f5ff 0%, #ffffff 100%);
    text-align: center;
}
.breadcrumb {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin-bottom: 16px; font-size: 13px; color: var(--text-light);
}
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.page-header h1 {
    font-size: clamp(26px, 4vw, 38px);
    font-weight: 900; color: var(--text); margin-bottom: 10px;
}
.page-header h1 .hl {
    background: var(--primary-gradient);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.page-header p { font-size: 15px; color: var(--text-secondary); max-width: 680px; margin: 0 auto; line-height: 1.8; }

.badge-row { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.badge-row span {
    font-size: 12px; font-weight: 600;
    padding: 4px 14px; border-radius: 100px;
    background: var(--primary-light); color: var(--primary);
    border: 1px solid rgba(26,110,255,0.12);
}
.badge-row span.green { background: var(--success-light); color: var(--success); border-color: rgba(22,163,74,0.15); }
.badge-row span.orange { background: var(--warning-light); color: var(--warning); border-color: rgba(255,107,53,0.15); }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0 72px; }

/* ===== 工具主面板 ===== */
.tool-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.panel-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 14px 18px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.panel-head .ph-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 15px; font-weight: 700; color: var(--text);
}
.panel-head .ph-title .ph-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.panel-head .ph-title .ph-icon svg { width: 18px; height: 18px; }
.panel-head .ph-sub { font-size: 12px; color: var(--text-light); width: 100%; font-weight: 400; }

.ph-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 小按钮 */
.mini-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 600; font-family: inherit;
    border: 1.5px solid var(--border); background: white; color: var(--text-secondary);
    cursor: pointer; transition: var(--transition);
    white-space: nowrap;
}
.mini-btn svg { width: 14px; height: 14px; }
.mini-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.mini-btn.primary {
    background: var(--primary-gradient); color: white; border-color: transparent;
    box-shadow: 0 4px 12px rgba(26, 110, 255, 0.28);
}
.mini-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(26, 110, 255, 0.38); color: #fff; background: var(--primary-gradient); }
.mini-btn.green { background: var(--success); border-color: transparent; color: #fff; }
.mini-btn.green:hover { background: #15803d; color: #fff; }

/* 编辑区 */
.editor-wrap { position: relative; flex: 1; display: flex; flex-direction: column; }
.code-editor {
    flex: 1; width: 100%; min-height: 380px; max-height: 520px;
    padding: 16px 18px;
    border: none; outline: none; resize: vertical;
    font-family: 'JetBrains Mono', 'SF Mono', Consolas, 'Courier New', monospace;
    font-size: 13px; line-height: 1.7;
    color: var(--text); background: #fbfcfe;
    tab-size: 4;
}
.code-editor::placeholder { color: var(--text-light); }

/* 拖放高亮 */
.drop-zone.dragover .panel-card { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,110,255,0.18), var(--shadow-hover); }

/* 编辑器底部状态条 */
.editor-status {
    display: flex; align-items: center; gap: 14px;
    padding: 8px 18px;
    background: var(--bg-warm);
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--text-light);
    flex-wrap: wrap;
}
.editor-status .st-item { display: inline-flex; align-items: center; gap: 5px; }
.editor-status .st-item strong { color: var(--text-secondary); font-weight: 600; }
.editor-status .st-detect { color: var(--success); font-weight: 600; }

/* ===== 选项控制条 ===== */
.options-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    margin-bottom: 20px;
}
.options-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 15px; font-weight: 700; margin-bottom: 16px;
}
.options-title .opt-icon {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
}
.options-title .opt-icon svg { width: 18px; height: 18px; }

.opt-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.opt-field { display: flex; flex-direction: column; gap: 6px; }
.opt-field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.opt-field select, .opt-field input[type="text"] {
    padding: 9px 12px;
    border: 1.5px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; color: var(--text);
    background: white; outline: none; transition: var(--transition);
    width: 100%;
}
.opt-field select:focus, .opt-field input[type="text"]:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,110,255,0.12); }

/* 转换按钮区 */
.convert-bar { display: flex; gap: 12px; align-items: center; justify-content: center; margin: 24px 0; flex-wrap: wrap; }

.btn-convert {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 15px 44px; border-radius: 12px;
    font-size: 16px; font-weight: 700; font-family: inherit;
    background: var(--primary-gradient); color: white;
    border: none; cursor: pointer;
    box-shadow: 0 8px 24px rgba(26, 110, 255, 0.35);
    transition: var(--transition);
}
.btn-convert svg { width: 20px; height: 20px; }
.btn-convert:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(26, 110, 255, 0.45); }
.btn-convert:active { transform: translateY(0); }

.btn-ghost2 {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 14px 24px; border-radius: 12px;
    font-size: 14px; font-weight: 600; font-family: inherit;
    background: white; color: var(--text-secondary);
    border: 1.5px solid var(--border); cursor: pointer;
    transition: var(--transition);
}
.btn-ghost2:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* 转换箭头：绝对定位于两栏正中间的悬浮圆形徽章，不参与栅格布局 */
.tool-panel { position: relative; }
.convert-arrow {
    position: absolute;
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    width: 56px; height: 56px;
    background: var(--primary-gradient);
    border-radius: 50%;
    color: white;
    z-index: 5;
    box-shadow: 0 8px 24px rgba(26, 110, 255, 0.35);
    display: flex; align-items: center; justify-content: center;
    pointer-events: none;
    animation: convertPulse 2.4s ease-in-out infinite;
}
.convert-arrow svg { width: 26px; height: 26px; }
@keyframes convertPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(26,110,255,0.35); }
    50% { box-shadow: 0 8px 32px rgba(26,110,255,0.55); }
}
@media (max-width: 768px) {
    .convert-arrow { display: none; }
}

/* ===== 预览表格 ===== */
.preview-wrap { padding: 16px 18px; overflow: auto; max-height: 520px; flex: 1; }
.preview-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px; min-width: 480px;
}
.preview-table th {
    position: sticky; top: 0; z-index: 2;
    background: var(--primary); color: white;
    padding: 9px 12px; text-align: left;
    font-weight: 600; white-space: nowrap;
    font-size: 12.5px;
}
.preview-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    max-width: 260px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.preview-table tr:nth-child(even) td { background: var(--bg-warm); }
.preview-table tr:hover td { background: var(--primary-light); }
.preview-empty { text-align: center; color: var(--text-light); font-size: 13px; padding: 48px 20px; }

/* ===== 提示条 ===== */
.notice-bar {
    display: flex; align-items: flex-start; gap: 12px;
    background: linear-gradient(135deg, #e8f1ff 0%, #f0f5ff 100%);
    border: 1.5px solid rgba(26,110,255,0.15);
    border-radius: var(--radius-sm);
    padding: 14px 18px; margin-bottom: 20px;
    font-size: 13px; color: var(--text-secondary); line-height: 1.7;
}
.notice-bar .nb-icon {
    width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
    background: var(--primary); color: white;
    display: flex; align-items: center; justify-content: center;
}
.notice-bar .nb-icon svg { width: 16px; height: 16px; }
.notice-bar strong { color: var(--primary); }

/* 错误提示 */
.error-bar {
    display: none; align-items: flex-start; gap: 12px;
    background: var(--danger-light);
    border: 1.5px solid rgba(220,38,38,0.25);
    border-radius: var(--radius-sm);
    padding: 14px 18px; margin-bottom: 20px;
    font-size: 13px; color: var(--danger); line-height: 1.7;
}
.error-bar.show { display: flex; }
.error-bar .nb-icon { background: var(--danger); }
.error-bar pre {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 12px; background: white; border-radius: 6px;
    padding: 8px 12px; margin-top: 6px; white-space: pre-wrap; word-break: break-all;
}

/* ===== 功能特性区 ===== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}
.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px 24px;
    transition: var(--transition);
}
.feature-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-4px); border-color: rgba(26,110,255,0.2); }
.feature-card .fc-icon {
    width: 48px; height: 48px; border-radius: 12px;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
}
.feature-card .fc-icon svg { width: 24px; height: 24px; }
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.7; }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 40px;
    transform: translateX(-50%) translateY(20px);
    background: var(--text); color: white;
    font-size: 14px; font-weight: 500;
    padding: 12px 26px; border-radius: 100px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.25);
    opacity: 0; visibility: hidden; z-index: 9999;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}
.toast.show { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* ===== 响应式：1024px（与官网一致：页脚两列） ===== */
@media (max-width: 1024px) {
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .opt-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-panel { grid-template-columns: 1fr; }
}

/* ===== 响应式：768px（与官网一致：汉堡菜单 + 页脚单列） ===== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 72px; left: 0; right: 0;
        background: white;
        flex-direction: column;
        padding: 16px 24px;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
        gap: 4px;
        border-bottom: 1px solid var(--border);
        z-index: 999;
    }
    .nav-links.active { display: flex; }
    .mobile-toggle { display: flex; }

    .page-header { padding: 120px 0 32px; }
    .section { padding: 32px 0 56px; }
    .opt-grid { grid-template-columns: 1fr; }
    .features-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 32px; }

    .panel-head { padding: 12px 14px; }
    .code-editor { min-height: 300px; font-size: 12px; }
    .convert-bar { flex-direction: column; }
    .btn-convert { width: 100%; justify-content: center; }
    .convert-arrow { display: none; }
    .preview-wrap { padding: 12px 14px; }
}
