/* ===== CSS Variables ===== */
:root {
  --primary: #2d7d46;
  --primary-dark: #1e5f32;
  --primary-light: #4caf50;
  --secondary: #5c6bc0;
  --accent: #ff9800;
  --danger: #f44336;
  --success: #4caf50;
  --warning: #ff9800;
  --info: #2196f3;
  
  --bg-dark: #1a1a2e;
  --bg-card: #16213e;
  --bg-card2: #1a1a3e;
  --bg-input: #0f3460;
  --bg-body: #0f0f23;
  --bg-light: #f5f5f5;
  
  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b0;
  --text-light: #ffffff;
  --text-dark: #333333;
  
  --border-color: #2a2a4a;
  --border-light: #3a3a5a;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  
  --font-minecraft: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  --sidebar-width: 240px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-minecraft);
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent);
}

img {
  max-width: 100%;
  height: auto;
}

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

.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main-content {
  flex: 1;
  padding: 24px 0;
}

/* ===== Header ===== */
.header {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 100%);
  border-bottom: 2px solid var(--primary);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  max-width: 1200px;
  margin: 0 auto;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text-light);
}

.header-logo .logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-nav a {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.header-nav a:hover,
.header-nav a.active {
  color: var(--text-light);
  background: rgba(45, 125, 70, 0.2);
}

.header-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user .user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.header-user .user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 0.85rem;
}

.balance-badge {
  background: linear-gradient(135deg, var(--accent), #ff6f00);
  color: white;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: bold;
}

.btn-login {
  background: var(--primary);
  color: white !important;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  transition: background 0.2s;
}

.btn-login:hover {
  background: var(--primary-dark);
}

.btn-register {
  background: transparent;
  color: var(--text-light) !important;
  border: 1px solid var(--border-color);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.btn-register:hover {
  border-color: var(--primary);
  background: rgba(45, 125, 70, 0.15);
}

/* Mobile menu toggle */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--border-color);
  padding: 32px 0 16px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.footer-col h4 {
  color: var(--text-light);
  margin-bottom: 12px;
  font-size: 1rem;
}

.footer-col a,
.footer-col p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 2;
  display: block;
}

.footer-col a:hover {
  color: var(--primary-light);
}

.footer-bottom {
  border-top: 1px solid var(--border-color);
  padding-top: 16px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-card) 50%, #0d2137 100%);
  padding: 60px 0;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.hero h1 {
  font-size: 2.5rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
  color: white;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-light);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--text-light);
}

.btn-accent {
  background: var(--accent);
  color: white;
}

.btn-accent:hover {
  background: #e68900;
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #d32f2f;
  color: white;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover {
  background: #388e3c;
  color: white;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 14px 32px;
  font-size: 1.05rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s;
}

.card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h3 {
  font-size: 1.05rem;
  color: var(--text-light);
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  background: rgba(0,0,0,0.1);
}

/* ===== Stats Cards ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--text-secondary);
  opacity: 0.4;
}

.stat-card.stat-primary::before { background: var(--primary); opacity: 0.8; }
.stat-card.stat-info::before { background: var(--info); opacity: 0.8; }
.stat-card.stat-success::before { background: var(--success); opacity: 0.8; }
.stat-card.stat-warning::before { background: var(--warning); opacity: 0.8; }
.stat-card.stat-danger::before { background: var(--danger); opacity: 0.8; }
.stat-card.stat-accent::before { background: var(--accent); opacity: 0.8; }

.stat-card .stat-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.stat-card .stat-number {
  font-size: 1.8rem;
  font-weight: bold;
  color: var(--text-light);
}

.stat-card .stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* ===== Item Grid ===== */
.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s;
}

.item-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
}

.item-card .item-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-dark);
}

.item-card .item-placeholder {
  width: 100%;
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-dark), var(--bg-card));
  font-size: 3rem;
  color: var(--text-secondary);
}

.item-card .item-info {
  padding: 14px;
}

.item-card .item-name {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-card .item-tag {
  display: inline-block;
  background: rgba(45, 125, 70, 0.2);
  color: var(--primary-light);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  margin-bottom: 8px;
}

.item-card .item-price {
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent);
}

.item-card .item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-light);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(45, 125, 70, 0.2);
}

.form-input.error,
.form-select.error {
  border-color: var(--danger);
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-select {
  cursor: pointer;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-light);
}

.form-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

.form-error {
  font-size: 0.8rem;
  color: var(--danger);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ===== Auth Pages ===== */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 24px 16px;
}

.auth-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.auth-card h2 {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 8px;
  font-size: 1.5rem;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.9rem;
}

.auth-card .auth-links {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ===== Alerts ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-success {
  background: rgba(76, 175, 80, 0.15);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-danger {
  background: rgba(244, 67, 54, 0.15);
  border: 1px solid var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: rgba(255, 152, 0, 0.15);
  border: 1px solid var(--warning);
  color: var(--warning);
}

.alert-info {
  background: rgba(33, 150, 243, 0.15);
  border: 1px solid var(--info);
  color: var(--info);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb a:hover {
  color: var(--primary-light);
}

.breadcrumb .separator {
  color: var(--border-color);
}

.breadcrumb .current {
  color: var(--text-light);
}

/* ===== Section Titles ===== */
.section-title {
  font-size: 1.3rem;
  color: var(--text-light);
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ===== Search & Filter ===== */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.search-bar .form-input {
  flex: 1;
  min-width: 200px;
}

.filter-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-bar .form-select {
  min-width: 150px;
}

/* ===== Tabs ===== */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 24px;
  overflow-x: auto;
}

.tab-item {
  padding: 10px 20px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  font-size: 0.9rem;
}

.tab-item:hover {
  color: var(--text-light);
}

.tab-item.active {
  color: var(--primary-light);
  border-bottom-color: var(--primary);
}

/* ===== Table ===== */
.table-responsive {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th,
table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

table th {
  background: var(--bg-dark);
  color: var(--text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

table tr:hover td {
  background: rgba(45, 125, 70, 0.05);
}

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-primary {
  background: rgba(45, 125, 70, 0.2);
  color: var(--primary-light);
}

.badge-success {
  background: rgba(76, 175, 80, 0.2);
  color: var(--success);
}

.badge-danger {
  background: rgba(244, 67, 54, 0.2);
  color: var(--danger);
}

.badge-warning {
  background: rgba(255, 152, 0, 0.2);
  color: var(--warning);
}

.badge-info {
  background: rgba(33, 150, 243, 0.2);
  color: var(--info);
}

.badge-secondary {
  background: rgba(160, 160, 176, 0.2);
  color: var(--text-secondary);
}

/* ===== Badge Count (for quick-action buttons) ===== */
.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  margin-left: 4px;
}
.badge-count.bc-danger {
  background: var(--danger);
  color: #fff;
}
.badge-count.bc-warning {
  background: var(--warning);
  color: #fff;
}
.badge-count.bc-info {
  background: var(--info);
  color: #fff;
}
.badge-count.bc-primary {
  background: var(--primary);
  color: #fff;
}

/* ===== Compact Table ===== */
.table-compact th,
.table-compact td {
  padding: 6px 10px;
  font-size: 0.8rem;
}
.table-compact tbody tr:hover td {
  background: rgba(45, 125, 70, 0.08);
}
.table-compact tbody tr:nth-child(even) td {
  background: rgba(255,255,255,0.02);
}
.table-compact tbody tr:nth-child(even):hover td {
  background: rgba(45, 125, 70, 0.1);
}

/* ===== Role Badges ===== */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.role-badge.admin {
  background: rgba(244, 67, 54, 0.2);
  color: #ef5350;
}

.role-badge.official {
  background: rgba(33, 150, 243, 0.2);
  color: #42a5f5;
}

.role-badge.merchant {
  background: rgba(255, 152, 0, 0.2);
  color: var(--accent);
}

.role-badge.user {
  background: rgba(160, 160, 176, 0.2);
  color: var(--text-secondary);
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state .empty-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  color: var(--text-light);
  margin-bottom: 8px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 4px;
  margin-top: 24px;
}

.pagination a,
.pagination span {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  transition: all 0.2s;
}

.pagination a:hover {
  border-color: var(--primary);
  color: var(--text-light);
}

.pagination .active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ===== Detail Page ===== */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-bottom: 32px;
}

.detail-image {
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-dark);
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-image img {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
}

.detail-info h1 {
  font-size: 1.8rem;
  color: var(--text-light);
  margin-bottom: 8px;
}

.detail-info .detail-price {
  font-size: 2rem;
  font-weight: bold;
  color: var(--accent);
  margin-bottom: 16px;
}

.detail-info .detail-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.detail-info .detail-meta span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.detail-info .detail-description {
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 24px;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ===== Store/Shop Pages ===== */
.store-header {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.store-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--bg-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
  overflow: hidden;
}

.store-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-info h2 {
  color: var(--text-light);
  font-size: 1.3rem;
  margin-bottom: 4px;
}

.store-info p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== Dashboard ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 24px;
}

.sidebar-nav {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s;
  font-size: 0.9rem;
}

.sidebar-nav .nav-item:last-child {
  border-bottom: none;
}

.sidebar-nav .nav-item:hover {
  background: rgba(45, 125, 70, 0.1);
  color: var(--text-light);
}

.sidebar-nav .nav-item.active {
  background: rgba(45, 125, 70, 0.15);
  color: var(--primary-light);
  border-left: 3px solid var(--primary);
}

/* ===== Admin Layout ===== */
.admin-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 24px;
  min-height: 80vh;
}

.admin-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
}

.admin-sidebar .nav-section {
  padding: 12px 16px;
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-color);
}

.admin-sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.2s;
  font-size: 0.88rem;
}

.admin-sidebar .nav-item:hover {
  background: rgba(45, 125, 70, 0.1);
  color: var(--text-light);
}

.admin-sidebar .nav-item.active {
  background: rgba(45, 125, 70, 0.15);
  color: var(--primary-light);
  border-left: 3px solid var(--primary);
}

/* ===== Modal ===== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  color: var(--text-light);
  margin-bottom: 16px;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.loading-spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ===== Tooltip ===== */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-dark);
  color: var(--text-light);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 100;
  border: 1px solid var(--border-color);
}

/* ===== Checkbox Toggle ===== */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  display: none;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-input);
  border-radius: 12px;
  transition: 0.3s;
  border: 1px solid var(--border-color);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle input:checked + .toggle-slider {
  background: var(--primary);
}

.toggle input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: white;
}

/* ===== Store Cards Grid ===== */
.store-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.store-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  transition: all 0.3s;
}

.store-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.store-card .store-logo-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg-dark);
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  overflow: hidden;
}

.store-card .store-logo-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.store-card h3 {
  color: var(--text-light);
  margin-bottom: 4px;
}

.store-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

/* ===== Notification ===== */
.notification-bar {
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

/* ===== Category Tags ===== */
.tag-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-chip:hover,
.tag-chip.active {
  border-color: var(--primary);
  color: var(--primary-light);
  background: rgba(45, 125, 70, 0.1);
}

/* ===== Order Status ===== */
.status-steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
  background: var(--bg-dark);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.status-step {
  flex: 1;
  text-align: center;
  padding: 12px 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  position: relative;
}

.status-step.completed {
  color: var(--success);
}

.status-step.active {
  color: var(--accent);
  font-weight: 600;
}

.status-step .step-number {
  display: block;
  width: 28px;
  height: 28px;
  line-height: 28px;
  border-radius: 50%;
  background: var(--bg-input);
  margin: 0 auto 6px;
  font-size: 0.8rem;
}

.status-step.completed .step-number {
  background: var(--success);
  color: white;
}

.status-step.active .step-number {
  background: var(--accent);
  color: white;
}

/* ===== Announcement ===== */
.announcement {
  background: linear-gradient(135deg, rgba(45, 125, 70, 0.1), rgba(76, 175, 80, 0.05));
  border: 1px solid var(--primary);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.announcement h3 {
  color: var(--primary-light);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.announcement p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* ===== Bottom Navigation (Mobile) ===== */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  z-index: 1100;
  padding: 6px 0 env(safe-area-inset-bottom, 6px);
  justify-content: space-around;
  box-shadow: 0 -2px 8px rgba(0,0,0,0.3);
}
.bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  color: var(--text-secondary);
  font-size: 0.7rem;
  text-decoration: none;
  transition: color 0.2s;
  border-radius: var(--radius);
  min-width: 56px;
}
.bn-item .bn-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.bn-item .bn-label {
  font-size: 0.65rem;
  line-height: 1;
}
.bn-item.active {
  color: var(--primary-light);
}
.bn-item:hover {
  color: var(--text-light);
}

/* ===== Responsive Design ===== */

/* Tablet */
@media (max-width: 1024px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: static;
    max-height: none;
    display: flex;
    flex-wrap: wrap;
    border-radius: var(--radius-md);
    overflow-x: auto;
  }
  .admin-sidebar .nav-section { display: none; }
  .admin-sidebar .nav-item {
    border-bottom: none;
    border-right: 1px solid var(--border-color);
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 10px 14px;
  }
  .admin-sidebar .nav-item:last-child { border-right: none; }
  .admin-sidebar .nav-item.active { border-left: none; border-bottom: 2px solid var(--primary); }
  .detail-layout { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .mobile-toggle { display: block; }
  
  .header-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    padding: 8px 0;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    order: 3;
  }
  .header-nav.open { display: flex; }
  .header-nav a { width: 100%; padding: 10px 14px; }
  .header-nav form { width: 100%; padding: 8px 14px; display: block !important; margin-left: 0 !important; }
  .header-nav form .form-input { width: 100% !important; }
  
  /* 手机端折叠用户菜单按钮 */
  .header-user {
    margin-left: auto;
    gap: 4px;
  }
  .header-user .user-info span:not(.balance-badge) { display: none; }
  .header-user .btn-sm { padding: 4px 8px; font-size: 0.75rem; }
  .header-user .balance-badge { font-size: 0.7rem; padding: 2px 6px; }
  
  .hero { padding: 32px 16px; }
  .hero h1 { font-size: 1.5rem; }
  .hero p { font-size: 0.9rem; }
  
  .item-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .item-card .item-image { height: 140px; }
  .item-card .item-placeholder { height: 140px; font-size: 2.2rem; }
  .item-card .item-info { padding: 10px; }
  .item-card .item-name { font-size: 0.9rem; }
  .item-card .item-price { font-size: 1rem; }
  
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .auth-card { padding: 20px 16px; }
  .store-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .stat-number { font-size: 1.4rem; }
  
  .search-bar { flex-direction: column; }
  .filter-bar { flex-direction: column; }
  .filter-bar .form-select { min-width: 100%; }
  
  .section-header { flex-direction: column; align-items: flex-start; }
  .tabs { gap: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab-item { padding: 8px 14px; font-size: 0.82rem; }
  
  /* 订单状态步骤条垂直 */
  .status-steps { flex-direction: column; gap: 0; }
  .status-step { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; }
  .status-step .step-number { margin: 0; flex-shrink: 0; }
  .status-step::after { display: none; }
  
  /* 表格横滚 */
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 0.78rem; }
  table th, table td { padding: 6px 8px; white-space: nowrap; }
  
  .detail-info h1 { font-size: 1.3rem; }
  .detail-info .detail-price { font-size: 1.5rem; }
  .detail-info .detail-meta { gap: 8px; }
  
  .store-header { flex-direction: column; text-align: center; padding: 16px; }
  .store-logo { width: 60px; height: 60px; font-size: 2rem; }
  
  .section-title { font-size: 1.1rem; }
  
  .btn { padding: 8px 16px; font-size: 0.85rem; }
  .btn-sm { padding: 5px 10px; font-size: 0.75rem; }
  .btn-lg { padding: 12px 24px; font-size: 1rem; }
  
  .pagination a, .pagination span { padding: 6px 10px; font-size: 0.8rem; }
  
  .modal { width: 95%; padding: 16px; }
  
  .toast-container { top: auto; bottom: 16px; right: 8px; left: 8px; }
  .toast { max-width: 100%; font-size: 0.85rem; }
  
  .empty-state { padding: 40px 16px; }
  .empty-state .empty-icon { font-size: 3rem; }
  
  .quick-actions { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .quick-action { padding: 12px; }
  .quick-action .qa-icon { font-size: 1.4rem; }
  
  .tag-list { gap: 6px; }
  .tag-chip { padding: 4px 10px; font-size: 0.8rem; }
  
  /* 首页市场标签 */
  .market-tabs { flex-direction: column; gap: 4px; }
  .market-tab:first-child { border-radius: var(--radius-md) var(--radius-md) 0 0; }
  .market-tab:last-child { border-radius: 0 0 var(--radius-md) var(--radius-md); }
  .market-tab { padding: 12px; display: flex; align-items: center; gap: 12px; }
  .market-tab .tab-icon { margin-bottom: 0; font-size: 1.2rem; display: inline; }
  .market-tab .tab-desc { display: none; }
  
  .container { padding: 0 12px; }
  .main-content { padding: 16px 0; }
  .breadcrumb { font-size: 0.78rem; margin-bottom: 14px; }
  
  .header-inner { padding: 8px 12px; }
  .header-logo { font-size: 1.1rem; }
  
  .card-header { padding: 12px 14px; flex-direction: column; gap: 8px; }
  .card-body { padding: 14px; }
  .card-footer { padding: 10px 14px; }
  
  .footer { padding: 20px 0 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .footer-col h4 { font-size: 0.9rem; }
  
  .detail-image { min-height: 200px; }
  .detail-actions { flex-direction: column; }
  .detail-actions .btn { width: 100%; justify-content: center; }
  
  /* 购物车页面 */
  .cart-item { flex-direction: column; gap: 8px; }
  .cart-summary { padding: 14px; }
  
  /* 通知页面 */
  .notif-item { padding: 10px 12px; }

  /* 底部导航栏显示 */
  .bottom-nav { display: flex; }
  .page-wrapper { padding-bottom: 60px; }
  .admin-layout { padding-bottom: 60px; }
  .footer { padding-bottom: 70px; }
}

/* Small mobile */
@media (max-width: 480px) {
  .item-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .item-card .item-image { height: 100px; }
  .item-card .item-placeholder { height: 100px; font-size: 1.8rem; }
  .item-card .item-info { padding: 8px; }
  .item-card .item-name { font-size: 0.82rem; }
  .item-card .item-price { font-size: 0.9rem; }
  .item-card .item-meta { font-size: 0.72rem; }
  
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 12px; }
  .stat-card .stat-number { font-size: 1.2rem; }
  .stat-card .stat-icon { font-size: 1.4rem; }
  
  .btn { padding: 6px 12px; font-size: 0.82rem; }
  .btn-sm { padding: 4px 8px; font-size: 0.72rem; }
  
  .section-title { font-size: 1rem; }
  
  .hero h1 { font-size: 1.3rem; }
  .hero-actions { flex-direction: column; align-items: center; }
  .hero-actions .btn { width: 100%; max-width: 280px; justify-content: center; }
  
  .header-user .user-avatar { width: 26px; height: 26px; font-size: 0.75rem; }
  .header-user .btn-sm { padding: 3px 6px; font-size: 0.7rem; }
  
  .store-grid { gap: 10px; }
  .store-card { padding: 14px; }
  .store-card .store-logo-lg { width: 56px; height: 56px; font-size: 1.5rem; }
  
  .detail-info h1 { font-size: 1.1rem; }
  .detail-info .detail-price { font-size: 1.3rem; }
  
  .quick-actions { grid-template-columns: 1fr 1fr; gap: 6px; }
  .quick-action { padding: 10px; }
  .quick-action .qa-icon { font-size: 1.2rem; }
  .quick-action .qa-label { font-size: 0.78rem; }
  
  .footer-grid { grid-template-columns: 1fr; gap: 12px; }
  
  .badge { font-size: 0.7rem; padding: 1px 6px; }
  .role-badge { font-size: 0.7rem; padding: 2px 8px; }
  
  .auth-card { padding: 16px; }
  .auth-card h2 { font-size: 1.2rem; }
}

/* ===== Marketplace tabs on homepage ===== */
.market-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 24px;
}

.market-tab {
  flex: 1;
  text-align: center;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.market-tab:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.market-tab:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.market-tab:hover {
  background: var(--bg-card2);
}

.market-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.market-tab .tab-icon {
  font-size: 1.5rem;
  display: block;
  margin-bottom: 4px;
}

.market-tab .tab-label {
  font-size: 0.9rem;
  font-weight: 600;
}

.market-tab .tab-desc {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-top: 2px;
}

/* ===== Quick Actions ===== */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  color: var(--text-secondary);
}

.quick-action:hover {
  border-color: var(--primary);
  color: var(--text-light);
  transform: translateY(-2px);
}

.quick-action .qa-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.quick-action .qa-label {
  font-size: 0.85rem;
}

/* ===== Toast/Notification ===== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 0.9rem;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.3s ease;
  max-width: 360px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }
.toast.info { background: var(--info); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border-light);
}

/* ===== Print ===== */
@media print {
  .header, .footer, .sidebar-nav, .admin-sidebar, .bottom-nav { display: none; }
  body { background: white; color: black; }
  .card { border: 1px solid #ddd; box-shadow: none; }
}
