/* ============================================================
 * Mall Analyzer — Shared Report Stylesheet v3.1.0
 * Based on Style A (Tailwind-based report template)
 * ============================================================ */

/* --- CSS Custom Properties --- */
:root {
  --primary: #2563eb;
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --sidebar-width: 280px;
  --font-sans: 'Noto Sans SC', 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Consolas', 'Monaco', 'Fira Code', monospace;
  --bg-gradient: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* --- Dark Mode（跟随系统）--- */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.6);
  }
  body { background: var(--bg-gradient); }
  .sidebar { background: #1e293b; }
  .sidebar-header h2 { color: #e2e8f0; }
  .sidebar-header h2::after { background: linear-gradient(90deg, var(--primary-light), transparent); }
  .nav-section h3 { color: #94a3b8; }
  .nav-link { color: #cbd5e1; }
  .nav-link:hover { background-color: #334155; border-left-color: var(--primary-light); color: #93c5fd; }
  .nav-link.active { background-color: #334155; border-left-color: var(--primary-light); color: #93c5fd; }
  .container { background: transparent; }
  .custom-table { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
  .custom-table tbody tr { border-bottom: 1px solid #334155; }
  .custom-table tbody tr:hover { background-color: #334155; }
  .custom-table tbody td { color: #cbd5e1; }
  ::-webkit-scrollbar-track { background: #1e293b; }
  ::-webkit-scrollbar-thumb { background: #475569; }
  .feature-card { background: #1e293b; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
  .feature-card:hover { box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6); }
  .section-title { background: linear-gradient(135deg, #93c5fd 0%, #60a5fa 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
  .sub-title { color: #e2e8f0; }
  blockquote { background: #1e293b; border-left-color: var(--primary-light); }
  blockquote p { color: #cbd5e1; }
  .tag-badge { background-color: #1e3a5f; color: #93c5fd; }
}

/* --- Reset & Base --- */
* {
  font-family: var(--font-sans);
  scroll-behavior: smooth;
}

body {
  background: var(--bg-gradient);
  min-height: 100vh;
  margin: 0;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Sidebar Navigation --- */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  padding: 2rem;
  position: fixed;
  left: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 1.5rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.sidebar-header h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 2px;
  background: var(--primary);
}

.nav-section { margin-bottom: 2rem; }
.nav-section h3 { font-size: 0.875rem; font-weight: 600; color: #64748b; margin-bottom: 0.75rem; padding-left: 0.75rem; }
.nav-section ul { list-style: none; padding: 0; }
.nav-section li { margin-bottom: 0.5rem; }

.nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #475569;
  text-decoration: none;
  transition: all 0.2s ease;
  font-size: 0.9375rem;
  border-left: 3px solid transparent;
}

.nav-link:hover {
  background-color: #eff6ff;
  border-left-color: var(--primary);
  color: var(--primary);
}

.nav-link.active {
  background-color: #eff6ff;
  border-left-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* --- Main Container --- */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2rem 2rem 2rem calc(var(--sidebar-width) + 2rem);
}

.main-content { flex: 1; }

/* --- Custom Table --- */
.custom-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  margin: 1rem 0;
}

.custom-table table { min-width: 100%; }

.custom-table thead {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.custom-table thead th {
  color: white;
  font-weight: 600;
  padding: 1rem 1.25rem;
  text-align: left;
  font-size: 0.9375rem;
  letter-spacing: 0.025em;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.custom-table tbody tr {
  transition: all 0.2s ease;
  border-bottom: 1px solid #e5e7eb;
}

.custom-table tbody tr:last-child { border-bottom: none; }

.custom-table tbody tr:hover {
  background-color: #f0f9ff;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.custom-table tbody td {
  padding: 0.875rem 1.25rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* --- Confidence Badges --- */
.confidence-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.025em;
  transition: all 0.2s ease;
}

.confidence-badge:hover { transform: scale(1.05); }
.confidence-high { background: linear-gradient(135deg, #d1fae5 0%, var(--success) 100%); color: #065f46; }
.confidence-medium { background: linear-gradient(135deg, #fef3c7 0%, var(--warning) 100%); color: #92400e; }
.confidence-low { background: linear-gradient(135deg, #fee2e2 0%, var(--danger) 100%); color: #991b1b; }

/* --- Status Badges --- */
.status-badge {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-analyzed { background: #dcfce7; color: #166534; }
.status-pending { background: #fef3c7; color: #92400e; }
.status-inactive { background: #fee2e2; color: #991b1b; }

/* --- Feature Cards --- */
.feature-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: all 0.3s ease;
  border-left: 4px solid transparent;
  margin-bottom: 1.5rem;
}

.feature-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-4px);
}

.feature-card.blue-card { border-left-color: var(--primary); }
.feature-card.purple-card { border-left-color: #8b5cf6; }
.feature-card.green-card { border-left-color: var(--success); }
.feature-card.orange-card { border-left-color: var(--warning); }
.feature-card.red-card { border-left-color: var(--danger); }
.feature-card.pink-card { border-left-color: #ec4899; }
.feature-card.teal-card { border-left-color: #14b8a6; }
.feature-card.cyan-card { border-left-color: #06b6d4; }

/* --- Section Titles --- */
.section-title {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sub-title {
  position: relative;
  padding-left: 1rem;
}

.sub-title::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 2px;
}

/* --- Bullet List --- */
.bullet-list li {
  position: relative;
  padding-left: 1.5rem;
  margin-bottom: 0.5rem;
}

.bullet-list li::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0.75rem;
  width: 6px;
  height: 6px;
  background: var(--primary);
  border-radius: 50%;
}

/* --- Divider --- */
.divider {
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, #e5e7eb 50%, transparent 100%);
  margin: 2rem 0;
}

/* --- Blockquote --- */
blockquote {
  background: #f8fafc;
  border-left: 4px solid var(--primary);
  padding: 1rem 1.5rem;
  border-radius: 0 8px 8px 0;
  margin: 1rem 0;
}

blockquote p { margin: 0; color: #475569; }

/* --- Pre/Code --- */
pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: var(--font-mono);
  line-height: 1.6;
}

code {
  font-family: var(--font-mono);
}

/* --- Report Grid & Cards --- */
.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.report-card {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  border-left: 4px solid var(--primary);
}

.report-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-4px);
}

.report-card h3 {
  color: var(--primary-dark);
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.report-card p {
  color: #64748b;
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

/* Platform logo styles */
.platform-logo { width: 28px; height: 28px; border-radius: 4px; object-fit: contain; flex-shrink: 0; }
.platform-logo-fallback { display: none; width: 28px; height: 28px; border-radius: 4px; background: var(--primary); color: #fff; align-items: center; justify-content: center; font-size: 0.8125rem; font-weight: 700; flex-shrink: 0; }
.sidebar-logo { width: 16px; height: 16px; border-radius: 2px; object-fit: contain; flex-shrink: 0; margin-right: 0.25rem; vertical-align: middle; }
.header-logo { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; flex-shrink: 0; }
.header-logo-fallback { display: none; width: 48px; height: 48px; border-radius: 8px; background: var(--primary); color: #fff; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 700; flex-shrink: 0; }

.report-link, .platform-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
}

.report-link:hover, .platform-link:hover {
  text-decoration: underline;
}

/* --- Back to Top --- */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.back-to-top.visible { opacity: 1; visibility: visible; }

.back-to-top:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.5);
}

/* --- Mobile Menu Button --- */
.mobile-menu-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  background: white;
  padding: 0.75rem;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: none;
  cursor: pointer;
  display: none;
}

/* --- Responsive: 1024px --- */
@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    height: 100vh;
    z-index: 1000;
    background: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
    transition: left 0.3s ease;
    width: var(--sidebar-width);
    overflow-y: auto;
  }

  .sidebar.open { left: 0; }

  .container {
    padding: 1rem;
  }

  .main-content { margin-left: 0 !important; padding: 1rem !important; }

  .mobile-menu-btn { display: flex; }

  .header { padding-left: 4rem !important; }
}

/* --- Responsive: 768px --- */
@media (max-width: 768px) {
  .custom-table { display: block; overflow-x: auto; }
  h1 { font-size: 1.75rem !important; }
  h2 { font-size: 1.5rem !important; }
  h3 { font-size: 1.25rem !important; }
}

/* --- Print Styles --- */
@media print {
  .sidebar, .mobile-menu-btn, .back-to-top, .no-print { display: none !important; }

  .container { padding: 0 !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }

  body {
    font-size: 12pt;
    background: white !important;
  }

  .feature-card {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }

  .custom-table { page-break-inside: avoid; }

  a { text-decoration: none; color: black; }
}

/* --- Animation --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-in {
  animation: fadeInUp 0.6s ease-out;
}

/* --- Tag Badge --- */
.tag-badge {
  display: inline-block;
  background-color: #f0f9ff;
  color: #0369a1;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
}

/* 企业官网标签 */
.tag-corporate {
  background-color: #fef3c7;
  color: #92400e;
}

/* 金融平台标签 */
.tag-finance {
  background-color: #e0e7ff;
  color: #3730a3;
}

/* 关联平台标签 */
.tag-related {
  background-color: #f3e8ff;
  color: #7c3aed;
  cursor: help;
}
