:root {
  --primary: #FF2442;
  --primary-light: #ff4766;
  --primary-dark: #e01030;
  --secondary: #FF8C1A;
  --accent: #6C5CE7;
  --bg: #f5f5f5;
  --bg-white: #ffffff;
  --text: #1a1a1a;
  --text-secondary: #666666;
  --text-light: #999999;
  --border: #e8e8e8;
  --success: #00b578;
  --danger: #ff3b30;
  --warning: #ff9500;
  --card-radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ========== Header ========== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 56px;
}
.logo { display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 800; font-size: 18px; color: var(--primary); user-select: none; }
.logo-icon { font-size: 24px; }
.nav-links { display: flex; gap: 4px; }
.nav-link {
  padding: 8px 16px; border-radius: 20px; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); cursor: pointer; transition: all .2s;
  user-select: none;
}
.nav-link:hover, .nav-link.active { color: var(--primary); background: rgba(255,36,66,0.06); }
.header-right { display: flex; align-items: center; gap: 12px; }
.live-indicator {
  display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success);
  background: rgba(0,181,120,0.08); padding: 4px 12px; border-radius: 20px;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:0.3; } }

/* ========== Buttons ========== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 20px; border-radius: var(--radius-sm); border: none;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
  white-space: nowrap; user-select: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(255,36,66,0.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: rgba(255,36,66,0.05); }
.btn-sm { padding: 6px 14px; font-size: 12px; border-radius: 6px; }
.btn-lg { padding: 12px 28px; font-size: 16px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: rgba(0,0,0,0.05); }

/* ========== Main ========== */
.main { max-width: 1200px; margin: 0 auto; padding: 16px; min-height: calc(100vh - 56px); }

/* ========== Home Page ========== */
.home-banner {
  background: linear-gradient(135deg, var(--primary), #ff6b81, var(--secondary));
  border-radius: var(--card-radius); padding: 32px 24px;
  color: #fff; margin-bottom: 20px; position: relative; overflow: hidden;
}
.home-banner::after {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 200px; height: 200px; border-radius: 50%;
  background: rgba(255,255,255,0.1);
}
.home-banner h1 { font-size: 26px; font-weight: 800; margin-bottom: 8px; position: relative; z-index: 1; }
.home-banner p { font-size: 14px; opacity: 0.9; position: relative; z-index: 1; }

/* ========== Tabs ========== */
.tabs { display: flex; gap: 0; margin-bottom: 16px; background: var(--bg-white); border-radius: var(--radius-sm); padding: 4px; box-shadow: var(--shadow); overflow-x: auto; }
.tab {
  padding: 10px 20px; border-radius: 6px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all .2s;
  color: var(--text-secondary); user-select: none;
}
.tab.active { background: var(--primary); color: #fff; }
.tab:not(.active):hover { background: rgba(255,36,66,0.05); color: var(--primary); }

/* ========== Filter Bar ========== */
.filter-bar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center;
}
.filter-chip {
  padding: 6px 14px; border-radius: 20px; font-size: 13px;
  background: var(--bg-white); border: 1px solid var(--border);
  cursor: pointer; transition: all .2s; user-select: none;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.filter-chip:hover:not(.active) { border-color: var(--primary); color: var(--primary); }
.search-input {
  flex: 1; min-width: 200px; padding: 8px 16px; border-radius: 20px;
  border: 1px solid var(--border); font-size: 13px; outline: none;
  transition: border .2s;
}
.search-input:focus { border-color: var(--primary); }

/* ========== Concert Grid ========== */
.concert-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.concert-card {
  background: var(--bg-white); border-radius: var(--card-radius);
  overflow: hidden; box-shadow: var(--shadow); cursor: pointer;
  transition: all .3s; position: relative;
}
.concert-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.concert-card .poster {
  width: 100%; aspect-ratio: 3/4; object-fit: cover;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 48px; position: relative;
}
.concert-card .poster .status-badge {
  position: absolute; top: 12px; left: 12px;
  padding: 4px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; color: #fff;
  backdrop-filter: blur(10px);
}
.status-badge.hot { background: var(--primary); }
.status-badge.presale { background: var(--secondary); }
.status-badge.upcoming { background: var(--accent); }
.status-badge.sold-out { background: #999; }
.concert-card .info { padding: 12px 14px; }
.concert-card .title { font-size: 15px; font-weight: 700; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concert-card .venue { font-size: 12px; color: var(--text-light); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concert-card .meta { display: flex; align-items: center; justify-content: space-between; }
.concert-card .city { font-size: 12px; color: var(--text-secondary); }
.concert-card .price { font-size: 14px; font-weight: 700; color: var(--primary); }
.concert-card .price small { font-size: 11px; font-weight: 400; color: var(--text-light); }
.concert-card .date-info { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 4px; }

/* ========== Concert Detail ========== */
.detail-header {
  background: linear-gradient(135deg, var(--primary), #ff6b81);
  border-radius: var(--card-radius); padding: 32px 24px;
  color: #fff; margin-bottom: 20px; position: relative;
}
.detail-header h1 { font-size: 24px; font-weight: 800; margin-bottom: 8px; }
.detail-header .detail-meta { display: flex; gap: 16px; font-size: 13px; opacity: 0.9; flex-wrap: wrap; }
.detail-header .detail-meta span { display: flex; align-items: center; gap: 4px; }
.session-card {
  background: var(--bg-white); border-radius: var(--card-radius);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  border: 2px solid transparent; transition: border .2s; cursor: pointer;
}
.session-card:hover, .session-card.selected { border-color: var(--primary); }
.session-card .session-date { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.session-card .session-info { font-size: 13px; color: var(--text-secondary); }
.session-card .session-status { margin-top: 8px; }

/* ========== Tier Selection ========== */
.tier-list { margin-bottom: 20px; }
.tier-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--bg-white);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  border: 2px solid transparent; cursor: pointer; transition: all .2s;
}
.tier-item:hover, .tier-item.selected { border-color: var(--primary); background: rgba(255,36,66,0.03); }
.tier-item .tier-name { font-weight: 600; font-size: 14px; }
.tier-item .tier-price { font-size: 16px; font-weight: 700; color: var(--primary); }
.tier-item .tier-remain { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ========== Buyer Form ========== */
.buyer-form { background: var(--bg-white); border-radius: var(--card-radius); padding: 20px; margin-bottom: 16px; }
.buyer-form h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.form-input {
  width: 100%; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); font-size: 14px; outline: none;
  transition: border .2s; background: var(--bg-white);
}
.form-input:focus { border-color: var(--primary); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-error { color: var(--danger); font-size: 13px; margin-bottom: 12px; min-height: 20px; }
.form-input::placeholder { color: var(--text-light); }

/* ========== Payment ========== */
.payment-box {
  background: var(--bg-white); border-radius: var(--card-radius);
  padding: 24px; text-align: center; box-shadow: var(--shadow);
}
.payment-amount { font-size: 36px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.payment-amount small { font-size: 14px; font-weight: 400; }
.qr-container { display: inline-block; background: #fff; padding: 16px; border-radius: var(--radius-sm); margin: 16px 0; box-shadow: var(--shadow); }
.qr-container img { width: 200px; height: 200px; border-radius: 8px; }

/* ========== E-ticket ========== */
.e-ticket {
  background: var(--bg-white); border-radius: var(--card-radius);
  padding: 24px; box-shadow: var(--shadow);
}
.ticket-qr { text-align: center; margin: 16px 0; }
.ticket-info { font-size: 13px; color: var(--text-secondary); }
.ticket-info .info-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ticket-info .info-row:last-child { border-bottom: none; }
.ticket-info .info-label { color: var(--text-light); }
.ticket-info .info-value { font-weight: 600; color: var(--text); }

/* ========== Auth Modal ========== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-white); border-radius: var(--card-radius);
  width: 90%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: slideUp .3s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-light); padding: 4px; }
.modal-body { padding: 20px; }

/* ========== Auth Tabs ========== */
.auth-tabs { display: flex; gap: 0; margin-bottom: 20px; background: var(--bg); border-radius: var(--radius-sm); padding: 3px; }
.auth-tab { flex: 1; padding: 8px; text-align: center; border-radius: 6px; font-weight: 600; font-size: 14px; cursor: pointer; transition: all .2s; border: none; background: none; color: var(--text-secondary); }
.auth-tab.active { background: var(--bg-white); color: var(--primary); box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.code-input-group { display: flex; gap: 8px; }
.code-input-group .form-input { flex: 1; }
.code-input-group .btn { flex-shrink: 0; }

/* ========== User Menu ========== */
.user-menu { position: relative; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.user-dropdown {
  position: absolute; top: 42px; right: 0; background: var(--bg-white);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-hover);
  padding: 8px 0; min-width: 180px; display: none; z-index: 50;
}
.user-dropdown.show { display: block; }
.user-dropdown-item { padding: 10px 16px; font-size: 13px; cursor: pointer; transition: background .15s; }
.user-dropdown-item:hover { background: rgba(0,0,0,0.04); }

/* ========== Toast ========== */
.toast-container { position: fixed; top: 70px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius-sm);
  color: #fff; font-size: 13px; font-weight: 500;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  animation: toastIn .3s ease;
  max-width: 360px;
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } }
.toast.info { background: var(--accent); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* ========== Live Banner ========== */
#live-banner { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 250; background: linear-gradient(135deg, var(--primary), var(--secondary)); color: #fff; padding: 10px 24px; border-radius: 20px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 16px rgba(255,36,66,0.4); max-width: 90vw; text-align: center; cursor: pointer; }

/* ========== Admin ========== */
.admin-sidebar {
  display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-white);
  border-radius: var(--radius-sm); padding: 4px; box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.admin-sidebar .tab { padding: 10px 16px; font-size: 13px; }
.admin-header { margin-bottom: 20px; }
.admin-header h2 { font-size: 22px; font-weight: 800; }
.admin-header p { font-size: 13px; color: var(--text-light); }
.stat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--bg-white); border-radius: var(--radius-sm); padding: 16px;
  box-shadow: var(--shadow);
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.table-wrap { overflow-x: auto; background: var(--bg-white); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg); font-weight: 600; color: var(--text-secondary); }
td { color: var(--text); }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-success { background: rgba(0,181,120,0.1); color: var(--success); }
.badge-warning { background: rgba(255,149,0,0.1); color: var(--warning); }
.badge-danger { background: rgba(255,59,48,0.1); color: var(--danger); }
.badge-info { background: rgba(108,92,231,0.1); color: var(--accent); }

/* ========== Orders ========== */
.order-card {
  background: var(--bg-white); border-radius: var(--radius-sm);
  padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: box-shadow .2s;
}
.order-card:hover { box-shadow: var(--shadow-hover); }
.order-info { flex: 1; }
.order-info .order-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.order-info .order-meta { font-size: 12px; color: var(--text-light); }
.order-status { text-align: right; }
.order-price { font-size: 18px; font-weight: 700; color: var(--primary); }

/* ========== Empty State ========== */
.empty { text-align: center; padding: 48px 16px; color: var(--text-light); }
.empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

/* ========== Loading ========== */
.loading { text-align: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .6s linear infinite; margin: 0 auto 12px; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Mobile bottom nav (hidden on desktop) ========== */
@media (max-width: 768px) {
  .header-inner { padding: 0 12px; height: 50px; }
  .logo-text { display: none; }
  .nav-links { display: none; }
  .live-indicator span:not(.live-dot) { display: none; }
  .main { padding: 12px; }
  .concert-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .home-banner { padding: 20px 16px; }
  .home-banner h1 { font-size: 20px; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .form-row { flex-direction: column; gap: 0; }
}

/* ========== Responsive ========== */
@media (max-width: 480px) {
  .concert-grid { grid-template-columns: 1fr; }
}

/* ========== Misc ========== */
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-title { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.text-center { text-align: center; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-20 { margin-bottom: 20px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #999; }

/* ========== Tier row for admin ========== */
.tier-row .form-input { font-size: 13px; padding: 8px 10px; }

/* ========== Verify modal extras ========== */
#verify-modal .modal-body { padding: 24px 20px; }
