/* ============================================
   GEO Master - 全局样式
   ============================================ */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #dbeafe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px rgba(0,0,0,.05);
    --sidebar-width: 180px;
    --header-height: 56px;
}

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

body {
    font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
}

#app { display:flex; flex-direction:column; height:100vh; }

/* ============================================
   Header
   ============================================ */
.header {
    height: var(--header-height);
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    padding:0 20px;
    gap:20px;
    z-index:100;
    flex-shrink: 0;
}
.header-left { display:flex; align-items:center; }
.logo { font-size:18px; font-weight:700; color:var(--primary); white-space:nowrap; }
.header-center { flex:1; display:flex; justify-content:center; }
.brand-selector {
    padding:6px 16px;
    border:1px solid var(--gray-300);
    border-radius:var(--radius);
    font-size:14px;
    background:#fff;
    min-width:200px;
    cursor:pointer;
}
.brand-selector:focus { outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-light); }
.header-right { display:flex; align-items:center; gap:12px; }
.status-dot { width:8px; height:8px; border-radius:50%; background:var(--gray-300); }
.status-dot.online { background:var(--success); }
.status-dot.offline { background:var(--danger); }
.header-info { font-size:12px; color:var(--gray-500); }

/* ============================================
   Layout
   ============================================ */
.main-layout { display:flex; flex:1; overflow:hidden; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    padding: 8px 0;
    overflow-y: auto;
    flex-shrink: 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: var(--gray-600);
    text-decoration: none;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.nav-item:hover { background:var(--gray-50); color:var(--gray-900); }
.nav-item.active { background:var(--primary-light); color:var(--primary); border-left-color:var(--primary); font-weight:600; }
.nav-icon { font-size:16px; width:20px; text-align:center; }
.nav-divider { height:1px; background:var(--gray-200); margin:8px 12px; }

/* Content */
.content {
    flex:1;
    overflow-y: auto;
    padding: 24px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header h2 { font-size:16px; font-weight:600; }
.card-body { padding:20px; }

/* ============================================
   Stats Grid
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}
.stat-card .stat-value { font-size:28px; font-weight:700; color:var(--gray-900); }
.stat-card .stat-label { font-size:13px; color:var(--gray-500); margin-top:4px; }
.stat-card.primary { border-left: 3px solid var(--primary); }
.stat-card.success { border-left: 3px solid var(--success); }
.stat-card.warning { border-left: 3px solid var(--warning); }
.stat-card.danger { border-left: 3px solid var(--danger); }

/* ============================================
   Tables
   ============================================ */
.table-container { overflow-x:auto; }
table { width:100%; border-collapse:collapse; font-size:14px; }
thead { background:var(--gray-50); }
th { padding:10px 14px; text-align:left; font-weight:600; color:var(--gray-600); border-bottom:2px solid var(--gray-200); white-space:nowrap; }
td { padding:10px 14px; border-bottom:1px solid var(--gray-100); }
tr:hover td { background:var(--gray-50); }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display:inline-flex; align-items:center; gap:6px;
    padding:8px 16px;
    border-radius:var(--radius);
    font-size:14px; font-weight:500;
    cursor:pointer;
    border:1px solid transparent;
    transition: all .15s;
    white-space:nowrap;
    text-decoration:none;
}
.btn:disabled { opacity:.5; cursor:not-allowed; }
.btn-primary { background:var(--primary); color:#fff; }
.btn-primary:hover:not(:disabled) { background:var(--primary-dark); }
.btn-success { background:var(--success); color:#fff; }
.btn-success:hover:not(:disabled) { background:#059669; }
.btn-warning { background:var(--warning); color:#fff; }
.btn-warning:hover:not(:disabled) { background:#d97706; }
.btn-danger { background:var(--danger); color:#fff; }
.btn-danger:hover:not(:disabled) { background:#dc2626; }
.btn-outline { background:#fff; border-color:var(--gray-300); color:var(--gray-700); }
.btn-outline:hover:not(:disabled) { background:var(--gray-50); border-color:var(--gray-400); }
.btn-sm { padding:4px 10px; font-size:12px; }
.btn-lg { padding:12px 24px; font-size:16px; }
.btn-group { display:flex; gap:8px; flex-wrap:wrap; }

/* ============================================
   Forms
   ============================================ */
.form-group { margin-bottom:16px; }
.form-group label { display:block; font-size:13px; font-weight:600; color:var(--gray-700); margin-bottom:4px; }
.form-group .hint { font-size:12px; color:var(--gray-400); margin-top:2px; }
input, textarea, select {
    width:100%;
    padding:8px 12px;
    border:1px solid var(--gray-300);
    border-radius:var(--radius);
    font-size:14px;
    font-family:inherit;
    transition:border .15s;
}
input:focus, textarea:focus, select:focus {
    outline:none;
    border-color:var(--primary);
    box-shadow:0 0 0 3px var(--primary-light);
}
textarea { min-height:100px; resize:vertical; }

.form-row { display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:16px; }

/* ============================================
   Badges / Tags
   ============================================ */
.badge {
    display:inline-block;
    padding:2px 8px;
    border-radius:12px;
    font-size:12px;
    font-weight:500;
}
.badge-primary { background:var(--primary-light); color:var(--primary); }
.badge-success { background:#d1fae5; color:#065f46; }
.badge-warning { background:#fef3c7; color:#92400e; }
.badge-danger { background:#fee2e2; color:#991b1b; }
.badge-gray { background:var(--gray-100); color:var(--gray-600); }

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position:fixed; inset:0;
    background:rgba(0,0,0,.4);
    display:flex; align-items:center; justify-content:center;
    z-index:1000;
}
.modal-box {
    background:#fff;
    border-radius:12px;
    box-shadow:var(--shadow-lg);
    width:90%;
    max-width:700px;
    max-height:80vh;
    display:flex; flex-direction:column;
}
.modal-box.wide { max-width:1000px; }
.modal-header {
    padding:16px 20px;
    border-bottom:1px solid var(--gray-200);
    display:flex; align-items:center; justify-content:space-between;
}
.modal-header h2 { font-size:18px; }
.modal-close { background:none; border:none; font-size:24px; cursor:pointer; color:var(--gray-400); padding:4px; line-height:1; }
.modal-close:hover { color:var(--gray-700); }
.modal-body { padding:20px; overflow-y:auto; flex:1; }
.modal-footer { padding:12px 20px; border-top:1px solid var(--gray-200); display:flex; gap:8px; justify-content:flex-end; }

/* ============================================
   Toast
   ============================================ */
.toast {
    position:fixed; top:20px; right:20px;
    z-index:2000;
    padding:12px 20px;
    border-radius:var(--radius);
    color:#fff;
    font-size:14px;
    max-width:400px;
    transform:translateX(120%);
    transition:transform .3s;
}
.toast.show { transform:translateX(0); }
.toast.success { background:var(--success); }
.toast.error { background:var(--danger); }
.toast.info { background:var(--primary); }

/* ============================================
   Grid / Cards Layout
   ============================================ */
.brand-cards {
    display:grid;
    grid-template-columns:repeat(auto-fill, minmax(300px, 1fr));
    gap:16px;
}
.brand-card {
    cursor:pointer;
    transition: all .2s;
}
.brand-card:hover { transform:translateY(-2px); box-shadow:var(--shadow-lg); }
.brand-card .card-body h3 { font-size:16px; margin-bottom:8px; }
.brand-card .card-body .meta { font-size:13px; color:var(--gray-500); }

/* Article content preview */
.article-preview {
    background:var(--gray-50);
    border:1px solid var(--gray-200);
    border-radius:var(--radius);
    padding:20px;
    max-height:500px;
    overflow-y:auto;
    font-size:14px;
    line-height:1.8;
}
.article-preview h1,.article-preview h2,.article-preview h3 { margin-top:16px; margin-bottom:8px; }
.article-preview table { margin:12px 0; }
.article-preview pre { background:var(--gray-800); color:#e5e7eb; padding:12px; border-radius:var(--radius); overflow-x:auto; font-size:13px; }

/* Expand result table */
.expand-results { max-height:400px; overflow-y:auto; }
.expand-results table { font-size:13px; }
.expand-results .selected { background:var(--primary-light); }

/* Progress bar */
.progress-bar {
    height:8px;
    background:var(--gray-200);
    border-radius:4px;
    overflow:hidden;
}
.progress-bar .fill {
    height:100%;
    background:var(--primary);
    border-radius:4px;
    transition:width .3s;
}

/* Coverage visual */
.coverage-circle {
    width:120px; height:120px;
    border-radius:50%;
    border:8px solid var(--gray-200);
    display:flex; align-items:center; justify-content:center;
    font-size:32px; font-weight:700;
}
.coverage-circle.high { border-color:var(--success); color:var(--success); }
.coverage-circle.medium { border-color:var(--warning); color:var(--warning); }
.coverage-circle.low { border-color:var(--danger); color:var(--danger); }

/* Empty state */
.empty-state {
    text-align:center;
    padding:60px 20px;
    color:var(--gray-400);
}
.empty-state .icon { font-size:48px; margin-bottom:12px; }
.empty-state p { font-size:14px; }

/* Code block */
.code-block {
    background:#1e1e1e;
    color:#d4d4d4;
    padding:16px;
    border-radius:var(--radius);
    font-family:'Consolas','Monaco',monospace;
    font-size:13px;
    overflow-x:auto;
    white-space:pre-wrap;
    max-height:400px;
    overflow-y:auto;
}

/* Tabs */
.tabs { display:flex; border-bottom:2px solid var(--gray-200); margin-bottom:20px; }
.tab {
    padding:10px 20px;
    cursor:pointer;
    font-size:14px;
    font-weight:500;
    color:var(--gray-500);
    border-bottom:2px solid transparent;
    margin-bottom:-2px;
    transition: all .15s;
}
.tab:hover { color:var(--gray-700); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }

/* Responsive */
@media (max-width:768px) {
    .sidebar { width:60px; }
    .nav-item { padding:12px 8px; justify-content:center; }
    .nav-item span:not(.nav-icon) { display:none; }
    .stats-grid { grid-template-columns:repeat(2, 1fr); }
    .brand-cards { grid-template-columns:1fr; }
}
