/* ================= 大后台布局样式 (Dashboard Layout) ================= */

html,
body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100vh !important;
    width: 100vw !important;
    overflow: hidden !important;
    background: #0a0a0f !important;
    display: block !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
}

#app {
    display: flex !important;
    flex-direction: row !important;
    height: 100vh !important;
    width: 100vw !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    font-family: 'Noto Sans SC', sans-serif;
    color: var(--text-main);
    box-sizing: border-box;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
}

/* 侧边栏 */
.sidebar {
    width: 260px;
    background: rgba(18, 18, 25, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    box-shadow: 5px 0 25px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.sidebar-brand {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: linear-gradient(to bottom, rgba(142, 68, 173, 0.15), transparent);
}

.sidebar-brand h2 {
    margin: 0;
    font-size: 22px;
    background: linear-gradient(45deg, var(--tarot-gold), #fff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 2px;
}

.sidebar-brand .sub {
    font-size: 11px;
    color: var(--tarot-gold-light);
    opacity: 0.7;
    margin-top: 5px;
    letter-spacing: 1px;
}

/* 菜单导航 */
.menu-group {
    padding: 15px 10px;
}

.menu-category {
    font-size: 12px;
    color: var(--text-muted);
    padding: 10px 15px;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.6;
    margin-top: 10px;
}

.menu-item {
    padding: 12px 15px;
    margin: 4px 5px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #e0e0e0;
    transition: all 0.3s ease;
    font-size: 14px;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--tarot-gold-light);
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.15), transparent);
    color: var(--tarot-gold);
    border-left: 3px solid var(--tarot-gold);
}

/* 右侧主包裹 */
.main-wrapper {
    flex: 1;
    min-width: 0;
    /* 防止 flex 子元素被内容撑宽后不回缩 */
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 0%, #1a1a2e 0%, #0a0a0f 70%);
    overflow: hidden;
}

/* 顶部状态栏 */
.topbar {
    height: 70px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 90;
}

.topbar-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--tarot-gold-light);
    letter-spacing: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* 动态主内容区域 */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px 40px;
    scroll-behavior: smooth;
}

/* ================= 业务模块复用样式扩展 ================= */

/* 原来的 .view-section, .data-card 仍然由 common.css 支撑, 增补细节 */
.card-result-box {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 12px 0;
}

.tarot-card-chip {
    background: rgba(142, 68, 173, 0.15);
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(142, 68, 173, 0.4);
    font-size: 13px;
    color: var(--tarot-gold-light);
    letter-spacing: 1px;
    box-shadow: inset 0 0 10px rgba(142, 68, 173, 0.1);
}

.content-box {
    line-height: 1.8;
    color: var(--text-main);
    font-size: 14px;
    white-space: pre-wrap;
    background: rgba(0, 0, 0, 0.2);
    padding: 24px;
    border-radius: 12px;
    border-left: 3px solid var(--tarot-gold);
}

.json-box {
    font-family: 'Courier New', monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 12px;
    color: #00ff00;
    overflow-x: auto;
    border: 1px solid rgba(0, 255, 0, 0.2);
}

.action-bar {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-bar input[type="text"] {
    width: 280px;
}

/* ================= 塔罗牌动态牌桌 (Sketch) 移植样式 ================= */
.sketch {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    margin-top: 20px;
    margin-bottom: 25px;
}

.sketch-array-card {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.sketch-card-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
}

.sketch-card-position,
.sketch-card-name {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.sketch-card-name {
    color: var(--tarot-gold);
}

.card-image-box {
    border: 0.67px solid #89755A;
    background-color: rgba(126, 88, 194, 0.4);
    box-sizing: content-box;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    border-radius: 12px;
}

.card-image-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.reverse {
    transform: rotateZ(180deg) !important;
}

.sketch-means {
    color: #D69204;
    font-size: 12px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 500;
    margin-top: 4px;
}

/* 文本解牌区紫风卡片 */
.tarot-answer-container {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.tarot-section {
    position: relative;
    background-color: rgba(43, 26, 64, 0.85);
    border-radius: 12px;
    padding: 15px 15px 15px 45px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-height: 80px;
    border: 1px solid rgba(137, 117, 90, 0.3);
}

.tarot-corner-marker {
    position: absolute;
    left: 0;
    top: 0;
    margin: auto;
    width: 25px;
    height: 100%;
    background: linear-gradient(to bottom, #9b59b6, #7d3c98);
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    writing-mode: vertical-rl;
    text-orientation: upright;
    letter-spacing: 2px;
}

.tarot-section-title {
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #f3e8ff;
    display: flex;
    align-items: center;
}

.tarot-section-title::before {
    content: '✨';
    margin-right: 8px;
    font-size: 14px;
}

.tarot-section-content {
    line-height: 1.6;
    font-size: 13px;
    color: #f3f1ff;
    white-space: pre-wrap;
}

/* Toast动画 */
.fade-enter-active,
.fade-leave-active {
    transition: opacity 0.5s ease;
}

.fade-enter-from,
.fade-leave-to {
    opacity: 0;
}

/* ═══════════════════════════════════════════════════════
   驾驶舱 Dashboard 专用样式
   ═══════════════════════════════════════════════════════ */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── KPI 统计卡片行 ── */
.db-kpi-row {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 14px;
}

.db-kpi-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.03);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

.db-kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.db-kpi-icon {
    font-size: 28px;
    line-height: 1;
    flex-shrink: 0;
}

.db-kpi-body {
    flex: 1;
    min-width: 0;
}

.db-kpi-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
    white-space: nowrap;
}

.db-kpi-value {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.db-kpi-sub {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.65;
    white-space: nowrap;
}

.db-kpi-gold {
    border-color: rgba(212, 175, 55, 0.25);
    background: rgba(212, 175, 55, 0.07);
}

.db-kpi-gold .db-kpi-value {
    color: var(--tarot-gold);
}

.db-kpi-purple {
    border-color: rgba(155, 89, 182, 0.3);
    background: rgba(155, 89, 182, 0.08);
}

.db-kpi-purple .db-kpi-value {
    color: #c39bd3;
}

.db-kpi-teal {
    border-color: rgba(100, 181, 246, 0.25);
    background: rgba(100, 181, 246, 0.07);
}

.db-kpi-teal .db-kpi-value {
    color: #81d4fa;
}

.db-kpi-blue {
    border-color: rgba(79, 195, 247, 0.25);
    background: rgba(79, 195, 247, 0.06);
}

.db-kpi-blue .db-kpi-value {
    color: #4fc3f7;
}

.db-kpi-rose {
    border-color: rgba(240, 98, 146, 0.25);
    background: rgba(240, 98, 146, 0.07);
}

.db-kpi-rose .db-kpi-value {
    color: #f48fb1;
}

.db-kpi-amber {
    border-color: rgba(255, 183, 77, 0.25);
    background: rgba(255, 183, 77, 0.07);
}

.db-kpi-amber .db-kpi-value {
    color: #ffb74d;
}

/* ── 图表行 ── */
.db-chart-row {
    display: grid;
    grid-template-columns: 1fr minmax(0, 280px);
    gap: 16px;
}

.db-chart-main,
.db-chart-side {
    padding: 20px;
    overflow: hidden;
    /* 防止 canvas 溢出 grid 列 */
    min-width: 0;
}

/* ── 底部三栏 ── */
.db-bottom-row {
    display: grid;
    grid-template-columns: 1fr 220px 260px;
    gap: 16px;
}

/* ── 牌阵热度排行 ── */
.db-spread-rank {
    padding: 20px;
}

.db-rank-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.db-rank-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.db-rank-no {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.db-rank-no.rank-1 {
    background: rgba(212, 175, 55, 0.3);
    color: var(--tarot-gold);
}

.db-rank-no.rank-2 {
    background: rgba(155, 89, 182, 0.3);
    color: #c39bd3;
}

.db-rank-no.rank-3 {
    background: rgba(100, 181, 246, 0.2);
    color: #81d4fa;
}

.db-rank-info {
    flex: 1;
    min-width: 0;
}

.db-rank-name {
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text-main);
}

.db-rank-bar-wrap {
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}

.db-rank-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.db-rank-meta {
    font-size: 11px;
    color: var(--text-muted);
}

/* ── 今日指引快报 ── */
.db-insight-card {
    padding: 20px;
}

.db-insight-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
}

.db-insight-card-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--tarot-gold);
    text-align: center;
    letter-spacing: 2px;
}

.db-insight-pos {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1px;
}

.db-insight-meta-row {
    display: flex;
    gap: 20px;
    margin-top: 6px;
}

.db-insight-meta-item {
    text-align: center;
}

.db-insight-meta-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.db-insight-meta-val {
    font-size: 16px;
    font-weight: 700;
}

.db-insight-users {
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding-top: 10px;
    width: 100%;
}

/* ── 近7天迷你柱状图 ── */
.db-weekly-bar {
    padding: 20px;
}

.db-bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px;
    height: 160px;
    margin-top: 14px;
}

.db-bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    height: 100%;
}

.db-bar-val {
    font-size: 11px;
    color: var(--tarot-gold);
    font-weight: 600;
    margin-bottom: 4px;
    height: 16px;
    line-height: 16px;
}

.db-bar-body-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}

.db-bar-body {
    width: 100%;
    background: linear-gradient(180deg, var(--tarot-gold) 0%, rgba(155, 89, 182, 0.7) 100%);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
    transition: height 0.6s ease;
}

.db-bar-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    white-space: nowrap;
}

/* ── 月度趋势切换按钮组 ── */
.db-trend-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.db-toggle-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Noto Sans SC', sans-serif;
    white-space: nowrap;
}

.db-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.db-toggle-btn.db-toggle-active {
    background: linear-gradient(135deg, var(--tarot-purple), rgba(212, 175, 55, 0.7));
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(142, 68, 173, 0.4);
}

/* ── 保证内容区域在侧边栏展开收起时正确回缩 ── */
.content-area {
    min-width: 0;
}