/* public/assets/css/finance/crypto.css */
:root {
    --primary: #3b82f6; --primary-hover: #2563eb;
    --success: #10b981; --danger: #ef4444;
    --bg: #ffffff; --card: #f8fafc; --text-main: #0f172a; --text-sub: #475569;
    --border: #e2e8f0; --shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.seo-tool-wrapper { 
    width: 100%; max-width: 1000px; margin: 0 auto;
    background: var(--bg); border-radius: 16px; overflow: hidden; 
    border: 1px solid var(--border); box-shadow: var(--shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--text-main);
}

.tool-seo-header { padding: 40px 20px; text-align: center; border-bottom: 1px solid var(--border); background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%); }
.tool-h1 { margin: 0 0 15px 0; font-size: 1.8rem; font-weight: 800; color: #1e293b; letter-spacing: 0.5px; display:flex; align-items:center; justify-content:center;}
.tool-description { margin: 0 auto; max-width: 700px; font-size: 0.95rem; color: var(--text-sub); line-height: 1.6; }

.tool-workspace { padding: 30px; background: #f1f5f9; }

/* API Tabs 导航区域 */
.api-tabs-container {
    display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto;
    padding-bottom: 6px; border-bottom: 2px solid #e2e8f0;
}
.api-tabs-container::-webkit-scrollbar { height: 4px; }
.api-tabs-container::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.api-tab {
    padding: 10px 20px; border: none; background: transparent; color: #64748b;
    font-size: 14px; font-weight: 700; cursor: pointer; transition: 0.2s;
    border-radius: 8px; white-space: nowrap;
}
.api-tab:hover { background: #e2e8f0; color: #1e293b; }
.api-tab.active { background: #3b82f6; color: white; box-shadow: 0 2px 6px rgba(59, 130, 246, 0.3); }

/* 操控台 */
.market-controls { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; flex-wrap: wrap;}
.search-input-group { display: flex; position: relative; flex: 1; min-width: 250px; box-shadow: 0 2px 4px rgba(0,0,0,0.05); border-radius: 10px; background: white;}
.search-icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.seo-input { flex: 1; border: 1px solid var(--border); padding: 12px 16px 12px 42px; font-size: 15px; outline: none; transition: 0.2s; color: var(--text-main); font-weight: 600; border-radius: 10px;}
.seo-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

.control-actions { display: flex; gap: 10px; align-items: center; }
.seo-select { border: 1px solid var(--border); padding: 12px 16px; font-size: 14px; font-weight: bold; border-radius: 10px; outline: none; background: white; cursor: pointer; color: var(--text-main); height: 42px;}
.seo-select:focus { border-color: var(--primary); }
.btn { border: none; font-weight: bold; cursor: pointer; transition: 0.2s; font-size: 14px; border-radius: 10px; height: 42px; display: flex; align-items: center; justify-content: center; padding: 0 16px; }
.btn-secondary { background: white; color: var(--text-main); border: 1px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.05); }
.btn-secondary:hover { background: #e2e8f0; }

/* 动画效果 */
.loading-spin { animation: spin 1s linear infinite; display: block; color: #94a3b8; }
.icon-spin { animation: spin 0.6s ease-in-out; }
@keyframes spin { 100% { transform: rotate(360deg); } }

/* 看板主体 */
.market-board { background: white; border-radius: 16px; border: 1px solid var(--border); min-height: 400px; position: relative; overflow: hidden; }
.state-display { text-align: center; color: #94a3b8; font-size: 15px; padding: 100px 20px; }

/* 数据表格 */
.table-responsive { width: 100%; overflow-x: auto; }
.market-table { width: 100%; border-collapse: collapse; text-align: right; font-size: 14px; table-layout: fixed; }
.market-table th, .market-table td { padding: 16px 12px; border-bottom: 1px solid var(--border); }
.market-table th { background: #f8fafc; font-weight: 800; color: #64748b; text-transform: uppercase; font-size: 12px; letter-spacing: 0.5px; position: sticky; top: 0; z-index: 10;}
.market-table tbody tr { transition: background 0.2s; }
.market-table tbody tr:hover { background: #f8fafc; }

/* ========================================================
   ★ 全新 Top 1, 2, 3 排名徽章样式 (金、银、铜)
   ======================================================== */
.rank-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 26px; height: 26px; border-radius: 6px; font-weight: 900; color: white;
    font-size: 13px; margin: 0 auto;
    position: relative; /* 核心：为绝对定位的皇冠提供参考系 */
}

.rank-badge-1 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); box-shadow: 0 4px 6px -1px rgba(245, 158, 11, 0.4); }
.rank-badge-2 { background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%); box-shadow: 0 4px 6px -1px rgba(148, 163, 184, 0.4); }
.rank-badge-3 { background: linear-gradient(135deg, #b45309 0%, #78350f 100%); box-shadow: 0 4px 6px -1px rgba(180, 83, 9, 0.4); }

@keyframes floatCrown {
    0% { transform: translate(-50%, 0px) rotate(-10deg); }
    50% { transform: translate(-50%, -3px) rotate(10deg); }
    100% { transform: translate(-50%, 0px) rotate(-10deg); }
}

.top-crown { 
    width: 14px; 
    height: 14px; 
    position: absolute; 
    /* 核心：将皇冠绝对定位到徽章正上方 */
    top: -10px; 
    left: 50%;
    /* margin-right 已被丢弃，使用 transform 居中加动画 */
    transform: translate(-50%, 0);
    animation: floatCrown 2s ease-in-out infinite; 
    filter: drop-shadow(0 2px 2px rgba(245, 158, 11, 0.5)); /* 增加一点发光质感 */
}
/* 定义列宽 */
.market-table th:nth-child(1) { width: 60px; text-align: center; } /* 排行 */
.market-table th:nth-child(2) { width: 28%; text-align: left; } /* 资产 */
.market-table th:nth-child(3) { width: 16%; } /* 价格 */
.market-table th:nth-child(4) { width: 16%; } /* 24H涨跌 */
.market-table th:nth-child(5) { width: 16%; } /* 24H量 */
.market-table th:nth-child(6) { width: 24%; } /* 市值 */

.coin-info { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; }
.coin-info > div { display: flex; flex-direction: column; overflow: hidden; flex: 1; min-width: 0; }
.coin-icon { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; border: 1px solid #e2e8f0; background-color: #f8fafc;}
.coin-name { font-weight: 800; color: var(--text-main); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;}
.coin-symbol { color: #94a3b8; font-size: 12px; text-transform: uppercase; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}

.price-val { font-weight: 800; font-family: 'Consolas', monospace; color: var(--text-main); font-size: 14px;}
.vol-val, .cap-val { font-family: 'Consolas', monospace; color: var(--text-sub); font-size: 13px; }
.trend-up { color: var(--success); font-weight: 800; font-size: 13px; display:flex; align-items:center; justify-content:flex-end; gap:2px;}
.trend-down { color: var(--danger); font-weight: 800; font-size: 13px; display:flex; align-items:center; justify-content:flex-end; gap:2px;}

/* SEO 长文本区 */
.seo-article-content { padding: 40px; background: white; border-top: 1px solid var(--border); color: #334155; line-height: 1.8; }
.seo-article-content h2 { font-size: 1.5rem; color: #1e293b; margin-bottom: 20px; }
.seo-article-content h3 { font-size: 1.2rem; margin: 25px 0 15px 0; }
.seo-article-content ul { padding-left: 20px; }
.seo-article-content li { margin-bottom: 10px; }

/* 暗黑模式 */
[data-theme="dark"]:root { --bg: #0f172a; --card: #1e293b; --text-main: #f8fafc; --text-sub: #94a3b8; --border: #334155; }
[data-theme="dark"] .tool-seo-header { background: #0f172a; }
[data-theme="dark"] .tool-workspace { background: #020617; }
[data-theme="dark"] .api-tabs-container { border-bottom-color: #334155; }
[data-theme="dark"] .api-tab { color: #94a3b8; }
[data-theme="dark"] .api-tab:hover { background: #1e293b; color: #f8fafc; }
[data-theme="dark"] .api-tab.active { background: #3b82f6; color: white; }
[data-theme="dark"] .search-input-group, [data-theme="dark"] .seo-select, [data-theme="dark"] .btn-secondary { background: #1e293b; border-color: #334155; color: #f8fafc; }
[data-theme="dark"] .market-board, [data-theme="dark"] .seo-article-content { background: #0f172a; }
[data-theme="dark"] .market-table th { background: #1e293b; color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .market-table td { border-color: #334155; }
[data-theme="dark"] .market-table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="dark"] .coin-icon { border-color: #334155; background-color: #0f172a;}

/* 移动端排版优化 */
@media (max-width: 768px) {
    .market-controls { flex-direction: column; align-items: stretch; }
    .control-actions { justify-content: space-between; }
    
    .market-table th:nth-child(1), .market-table td:nth-child(1),
    .market-table th:nth-child(4), .market-table td:nth-child(4),
    .market-table th:nth-child(5), .market-table td:nth-child(5) { display: none; }
    
    .market-table th:nth-child(2) { width: 45%; }
    .market-table th:nth-child(3) { width: 25%; }
    .market-table th:nth-child(6) { width: 30%; }
    
    .market-table th, .market-table td { padding: 12px 8px; }
    .coin-info { gap: 8px; }
    .coin-icon { width: 24px; height: 24px; }
    .coin-name, .price-val { font-size: 13px; }
    .cap-val { font-size: 12px; }
}