/* ==========================================================================
   SAMR Public Viewer — Responsive White & Indigo Design
   反垄断数据库 | 陈元熹律师
   ========================================================================== */

:root {
    /* 核心色彩系统 */
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;

    --text-primary: #0f172a;    /* 墨黑 slate-900 */
    --text-secondary: #475569;  /* 烟灰 slate-600 */
    --text-muted: #94a3b8;      /* 浅灰 slate-400 */

    --accent-blue: #1e3a8a;     /* 藏青权威主色 blue-900 */
    --accent-hover: #1d4ed8;    /* blue-700 */
    --accent-light: #eff6ff;    /* blue-50 */
    --accent-border: #bfdbfe;   /* blue-200 */

    --accent-green: #059669;    /* emerald-600 */
    --accent-amber: #d97706;    /* amber-600 */
    --accent-red: #dc2626;      /* red-600 */

    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.08);

    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-full: 9999px;

    --font-sans: 'Noto Sans SC', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header (顶部导航与团队背书)
   ========================================================================== */
.header {
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-xs);
}

.header-inner {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-text {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.logo-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0;
    white-space: nowrap;
}

.logo-divider {
    color: var(--border);
    font-weight: 300;
    font-size: 1.15rem;
    line-height: 1;
    user-select: none;
}

.logo-sub {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.header-badge {
    display: flex;
    align-items: center;
}

.header-practice-areas {
    font-size: 0.775rem;
    color: var(--text-secondary);
    line-height: 1.4;
    text-align: right;
}

.header-practice-areas .practice-label {
    color: var(--accent-blue);
    font-weight: 600;
}

.lawyer-tag {
    font-size: 0.775rem;
    font-weight: 600;
    background: var(--accent-light);
    color: var(--accent-blue);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    border: 1px solid var(--accent-border);
    white-space: nowrap;
}

/* ==========================================================================
   Main Container (全屏自适应，彻底消除 600px 限制)
   ========================================================================== */
.main-container {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 20px 48px;
}

/* ==========================================================================
   1. 极简单行数据微栏 (取代原臃肿方块，高度从120px压缩到42px)
   ========================================================================== */
.metrics-ribbon-section {
    margin-bottom: 10px;
}

.metrics-ribbon {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    box-shadow: var(--shadow-xs);
    margin-bottom: 8px;
}

.metric-item {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.metric-val {
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--accent-blue);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
    line-height: 1;
}

.metric-val.cat-jyaj { color: #4338ca; }
.metric-val.cat-xzcf { color: var(--accent-red); }
.metric-val.cat-ftj { color: var(--accent-amber); }

.metric-name {
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.metric-sep {
    color: #cbd5e1;
    font-size: 0.85rem;
    user-select: none;
}

.metric-updated {
    margin-left: auto;
    font-size: 0.775rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   2. 省份紧凑胶囊快速筛选 (横向微徽章，秒级直达过滤)
   ========================================================================== */
.province-bar-wrapper {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 14px;
    box-shadow: var(--shadow-xs);
}

.province-header-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.province-header-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.province-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
    align-items: center;
}

.province-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    font-variant-numeric: tabular-nums;
    font-family: inherit;
}

.province-chip:hover {
    border-color: var(--accent-border);
    color: var(--accent-blue);
    background: #ffffff;
}

.province-chip.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
    font-weight: 600;
}

.province-chip .chip-count {
    opacity: 0.85;
    font-size: 0.7rem;
}

.toggle-chart-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
    font-family: inherit;
    white-space: nowrap;
    margin-left: auto;
}

.toggle-chart-btn:hover {
    color: var(--accent-blue);
    border-color: var(--accent-border);
    background: var(--accent-light);
}

.province-chart-drawer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.chart-bars {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 16px;
}

.chart-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-bar-label {
    width: 44px;
    font-size: 0.775rem;
    color: var(--text-secondary);
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
}

.chart-bar-track {
    flex: 1;
    height: 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 7px;
    transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
}

.chart-bar-fill::after {
    content: attr(data-count);
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.65rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1;
}

.bar-color-0 { background: #1e3a8a; }
.bar-color-1 { background: #0284c7; }
.bar-color-2 { background: #059669; }
.bar-color-3 { background: #d97706; }
.bar-color-4 { background: #7c3aed; }
.bar-color-5 { background: #dc2626; }

/* ==========================================================================
   3. 搜索与排序工具栏 (桌面单行横排，移动端自适应)
   ========================================================================== */
.search-section {
    position: sticky;
    top: 60px;
    z-index: 90;
    background: var(--bg-secondary);
    padding: 8px 0;
    margin-bottom: 8px;
}

.search-filter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px 12px;
    box-shadow: var(--shadow-sm);
}

.search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    position: relative;
}

.search-icon {
    font-size: 0.95rem;
    margin-right: 8px;
    color: var(--text-muted);
    flex-shrink: 0;
}

#search-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.925rem;
    outline: none;
    font-family: var(--font-sans);
    padding: 6px 0;
}

#search-input::placeholder {
    color: var(--text-muted);
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 6px;
    display: none;
    transition: color 0.15s;
}

.clear-btn.visible { display: block; }
.clear-btn:hover { color: var(--text-primary); }

.filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.filter-select {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.825rem;
    font-weight: 500;
    padding: 6px 26px 6px 10px;
    outline: none;
    font-family: var(--font-sans);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%2364748b'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.filter-select:focus {
    border-color: var(--accent-blue);
    background-color: #ffffff;
}

.reset-filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.825rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}

.reset-filter-btn:hover {
    color: var(--accent-red);
    border-color: #fecaca;
    background: #fef2f2;
}

.result-count {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 6px;
    padding-left: 2px;
    min-height: 1.2em;
    font-weight: 500;
}

/* ==========================================================================
   4. 案件列表 (电脑端自适应双列网格，手机端单列)
   ========================================================================== */
.case-list-section {
    min-height: 360px;
}

.case-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
}

.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 0;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 案件卡片设计 */
.case-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.case-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background-color 0.15s ease;
}

.case-card:hover {
    border-color: #cbd5e1;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.case-card:hover::before {
    background: var(--accent-blue);
}

.case-card:active {
    transform: scale(0.99);
}

.case-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.55;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.case-title mark {
    background: #fef08a;
    color: #854d0e;
    padding: 0 2px;
    border-radius: 2px;
}

.case-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-variant-numeric: tabular-nums;
}

.case-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.725rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
}

.tag-date {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.tag-province {
    background: #eff6ff;
    color: var(--accent-blue);
    border: 1px solid #bfdbfe;
}

.tag-category {
    background: #ecfdf5;
    color: var(--accent-green);
    border: 1px solid #a7f3d0;
}

.case-link-hint {
    margin-left: auto;
    font-size: 0.775rem;
    color: var(--accent-blue);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 2px;
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
    opacity: 0.6;
}

.empty-state .empty-text {
    font-size: 0.95rem;
}

/* ==========================================================================
   5. Pagination
   ========================================================================== */
.pagination {
    margin: 20px auto 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.page-btn {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 6px 12px;
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s;
    min-width: 38px;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.page-btn:hover:not(:disabled) {
    background: var(--bg-secondary);
    border-color: var(--border-strong);
}

.page-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: #ffffff;
    font-weight: 600;
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-size: 0.825rem;
    color: var(--text-secondary);
    padding: 0 8px;
}

/* ==========================================================================
   6. 业务咨询与专业合作 Banner
   ========================================================================== */
.upsell-banner {
    margin: 32px auto 0;
}

.upsell-content {
    background: #ffffff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent-blue);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 900px;
    margin: 0 auto;
}

.upsell-content h3,
.upsell-content .team-title {
    font-size: 1.15rem;
    color: var(--accent-blue);
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.upsell-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.contact-channels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
    gap: 16px;
    margin: 20px auto;
    max-width: 760px;
}

.contact-channel-card {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: left;
    transition: all 0.2s ease;
}

.email-channel-card {
    cursor: pointer;
}

.email-channel-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    background: #f8fafc;
}

.channel-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.channel-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.channel-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.channel-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 2px 0 10px;
}

.email-img {
    height: 24px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: inline-block;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.05));
}

.email-action-row {
    margin-top: auto;
}

.email-action-hint {
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--accent-blue);
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.email-channel-card:hover .email-action-hint {
    color: #1d4ed8;
    text-decoration: underline;
}

.wechat-channel-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.wechat-qr-box {
    flex-shrink: 0;
    width: 84px;
    height: 84px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wechat-qr-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 5px;
    display: block;
}

.wechat-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wechat-info .channel-card-header {
    margin-bottom: 2px;
}

.wechat-desc {
    font-size: 0.925rem;
    color: var(--accent-blue);
    margin: 2px 0;
    line-height: 1.3;
}

.wechat-desc strong {
    font-weight: 700;
}

.wechat-hint {
    font-size: 0.725rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.wechat-subhint {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.upsell-desc {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-top: 14px;
    line-height: 1.6;
}

/* ==========================================================================
   7. Footer
   ========================================================================== */
.footer {
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 20px 48px;
    text-align: center;
    font-size: 0.775rem;
    color: var(--text-muted);
    line-height: 1.8;
    border-top: 1px solid var(--border);
}

.footer-disclaimer {
    opacity: 0.8;
}

/* ==========================================================================
   8. 响应式规则 (Responsive Breakdown)
   ========================================================================== */
@media (max-width: 900px) {
    .case-list {
        grid-template-columns: 1fr;
    }
    .chart-bars {
        grid-template-columns: repeat(2, 1fr);
    }
    .metrics-ribbon {
        justify-content: flex-start;
    }
    .metric-updated {
        width: 100%;
        margin-left: 0;
        margin-top: 4px;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 10px 16px;
    }
    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    .header-badge {
        display: none;
    }
    .main-container {
        padding: 10px 14px 40px;
    }
    .search-section {
        top: 54px;
    }
    .search-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .filter-controls {
        width: 100%;
        gap: 6px;
    }
    .filter-select {
        flex: 1;
        min-width: 110px;
    }
    .chart-bars {
        grid-template-columns: 1fr;
    }
}
