/* ============================================
   品牌名录 - 主样式表（完整修复版）
   包含：基础变量、布局、头部、底部、弹窗、卡片、表格、表单、响应式等
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --bg: #f5f7fa;
  --card-bg: #fff;
  --text: #1f2937;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --amber: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ========== 按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
}
.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline:hover {
  background: var(--primary);
  color: #fff;
}
.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}
.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-success {
  background: var(--green);
  color: #fff;
}
.btn-warning {
  background: var(--amber);
  color: #fff;
}
.btn-block {
  width: 100%;
  display: flex;
}

/* ========== 头部样式 ========== */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}
.logo-icon {
  font-size: 24px;
}
.logo-text {
  color: var(--primary);
}
.main-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}
.main-nav .nav-link {
  color: var(--text-secondary);
  font-size: 15px;
  text-decoration: none;
}
.main-nav .nav-link:hover {
  color: var(--primary);
}
.nav-dropdown {
  position: relative;
}
.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 10;
}
.dropdown-menu.show {
  display: block;
}
.dropdown-menu .dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  font-size: 14px;
  text-decoration: none;
}
.dropdown-menu .dropdown-item:hover {
  background: var(--bg);
}
.header-search .search-form {
  display: flex;
  align-items: center;
  background: var(--bg);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.header-search .search-input {
  border: none;
  padding: 6px 12px;
  font-size: 14px;
  background: transparent;
  outline: none;
}
.header-search .search-btn {
  background: transparent;
  border: none;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 16px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-menu-wrapper {
  position: relative;
}
.user-menu-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 24px;
  background: var(--bg);
}
.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--primary-light);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}
.user-name {
  font-size: 14px;
  color: var(--text);
}
.user-role-badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 12px;
  background: #f0f0f0;
}
.role-admin {
  background: #fee2e2;
  color: #991b1b;
}
.role-merchant {
  background: #e0e7ff;
  color: #3730a3;
}
.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 160px;
  z-index: 10;
}
.user-dropdown.show {
  display: block;
}
.user-dropdown .dropdown-item {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.user-dropdown .dropdown-item:hover {
  background: var(--bg);
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.text-red {
  color: var(--red) !important;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}
.mobile-nav {
  display: none;
  flex-direction: column;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 16px;
}
.mobile-nav.show {
  display: flex;
}
.mobile-nav-link {
  padding: 8px 0;
  color: var(--text);
  text-decoration: none;
}
@media (max-width: 768px) {
  .main-nav,
  .header-search,
  .header-actions .btn-outline,
  .header-actions .btn-primary {
    display: none;
  }
  .mobile-menu-btn {
    display: block;
  }
  .header-actions .user-menu-wrapper {
    display: flex;
  }
  .user-name {
    display: none;
  }
}

/* ========== Hero 区域 ========== */
.hero {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #fff;
  padding: 60px 0 48px;
  text-align: center;
}
.hero h1 {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 12px;
}
.hero p {
  font-size: 16px;
  opacity: 0.9;
  margin-bottom: 24px;
}
.search-box {
  display: flex;
  max-width: 640px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}
.search-box input {
  flex: 1;
  padding: 14px 20px;
  border: none;
  font-size: 16px;
  outline: none;
  color: var(--text);
}
.search-box button {
  padding: 14px 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}
.search-box button:hover {
  background: var(--primary-dark);
}

/* ========== 分类网格 ========== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 16px;
}
.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  border: 1px solid transparent;
}
.category-item:hover {
  background: #eff6ff;
  border-color: #dbeafe;
  transform: translateY(-2px);
}
.category-item .cat-icon {
  font-size: 32px;
}
.category-item .cat-name {
  font-size: 13px;
  text-align: center;
  font-weight: 500;
}

/* ========== 商家卡片网格 ========== */
.listing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.listing-card {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.2s;
  border: 1px solid var(--border);
}
.listing-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  transform: translateY(-2px);
}
.listing-card .card-img {
  width: 100%;
  height: 180px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  color: #fff;
}
.listing-card .card-body {
  padding: 16px;
}
.listing-card .card-cat {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 4px;
}
.listing-card .card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}
.listing-card .card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.listing-card .card-address {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.listing-card .card-rating {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}
.listing-card .stars {
  color: var(--amber);
  font-size: 16px;
}
.listing-card .card-rating strong {
  color: var(--amber);
}

/* ========== 详情页 ========== */
.detail-header {
  margin-bottom: 24px;
}
.detail-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-secondary);
}
.detail-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.detail-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
}
.detail-tab {
  padding: 12px 20px;
  font-size: 15px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.detail-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}
.detail-tab:hover {
  color: var(--primary);
}

/* ========== 评价 ========== */
.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.review-item:last-child {
  border-bottom: none;
}
.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.review-author {
  font-weight: 500;
}
.review-date {
  font-size: 12px;
  color: var(--text-muted);
}
.review-content {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

/* ========== 侧边栏 ========== */
.page-layout {
  display: flex;
  gap: 24px;
}
.sidebar {
  width: 280px;
  flex-shrink: 0;
}
.content-area {
  flex: 1;
}
@media (max-width: 768px) {
  .page-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
  }
}

/* ========== 表格 ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.data-table tr:hover td {
  background: #f8fafc;
}
.table-actions {
  display: flex;
  gap: 8px;
}

/* ========== 统计卡片（商家中心/后台） ========== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}
.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ========== 标签徽章 ========== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}
.badge-green {
  background: #ecfdf5;
  color: var(--green);
}
.badge-red {
  background: #fef2f2;
  color: var(--red);
}
.badge-yellow {
  background: #fffbeb;
  color: #d97706;
}
.badge-blue {
  background: #eff6ff;
  color: var(--primary);
}
.badge-primary {
  background: var(--primary);
  color: #fff;
}
.badge-success {
  background: #d1fae5;
  color: #065f46;
}
.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}
.badge-warning {
  background: #fef3c7;
  color: #92400e;
}
.badge-secondary {
  background: #f3f4f6;
  color: #6b7280;
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  background: #f0f9ff;
  color: var(--primary);
  border-radius: 4px;
  font-size: 12px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}
.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  text-decoration: none !important;
}
.pagination a:hover {
  background: #f3f4f6;
}
.pagination .active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== 表单 ========== */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 14px;
}
.form-control {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.form-row {
  display: flex;
  gap: 16px;
}
.form-row .form-group {
  flex: 1;
}
@media (max-width: 480px) {
  .form-row {
    flex-direction: column;
    gap: 0;
  }
}

/* ========== 弹窗 ========== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-title {
  font-size: 18px;
  font-weight: 600;
}
.modal-close {
  font-size: 28px;
  cursor: pointer;
  color: #999;
  line-height: 1;
}
.modal-close:hover {
  color: #333;
}
.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ========== 城市标签 ========== */
.city-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}
.city-tag {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 24px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  background: #fff;
}
.city-tag:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

/* ========== 页脚样式（支持 .site-footer 和 .footer） ========== */
.site-footer,
.footer {
  background: #1f2937;
  color: #d1d5db;
  padding: 40px 0 20px;
  margin-top: 60px;
}
.site-footer .footer-grid,
.footer .footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 24px;
}
.site-footer .footer-col h3,
.site-footer .footer-col h4,
.footer h3,
.footer h4 {
  color: #fff;
  font-size: 18px;
  margin-bottom: 12px;
}
.site-footer .footer-col a,
.footer a {
  display: block;
  color: #d1d5db;
  font-size: 14px;
  margin-bottom: 6px;
  text-decoration: none;
}
.site-footer .footer-col a:hover,
.footer a:hover {
  color: #fff;
}
.site-footer .footer-bottom,
.footer .footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 16px;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
}
@media (max-width: 768px) {
  .site-footer .footer-grid,
  .footer .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ========== 响应式调整 ========== */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 24px;
  }
  .hero p {
    font-size: 15px;
  }
  .search-box {
    flex-direction: column;
    border-radius: 8px;
  }
  .search-box button {
    border-radius: 0;
  }
  .detail-title {
    font-size: 20px;
  }
  .listing-grid {
    grid-template-columns: 1fr;
  }
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  }
  .detail-actions {
    flex-direction: column;
  }
}

/* ========== 辅助工具 ========== */
.text-center {
  text-align: center;
}
.mt-2 {
  margin-top: 8px;
}
.mb-2 {
  margin-bottom: 8px;
}
.hidden {
  display: none;
}

/* ========== 页面容器 ========== */
.section {
  padding: 40px 0;
}
.section-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title a {
  font-size: 14px;
  font-weight: 400;
}

/* ========== Toast 消息 ========== */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius);
  color: #fff;
  font-size: 14px;
  z-index: 10000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.toast.show {
  display: block;
  animation: slideIn 0.3s ease;
}
.toast-success {
  background: var(--green);
}
.toast-error {
  background: var(--red);
}
@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========== 空状态 ========== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}
.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.empty-state h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

/* ========== 商家中心卡片 ========== */
.merchant-dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.merchant-table {
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.merchant-table th {
  background: #f9fafb;
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.merchant-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.merchant-table tr:last-child td {
  border-bottom: none;
}