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

:root {
  --primary: #4caf50;
  --primary-dark: #388e3c;
  --primary-light: #e8f5e9;
  --secondary: #1b1b3a;
  --accent: #ff5252;
  --bg: #f5f5f5;
  --card-bg: #ffffff;
  --text: #212121;
  --text-secondary: #757575;
  --border: #e0e0e0;
  --shadow: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --tab-height: 56px;
  --header-height: 48px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  padding-bottom: calc(var(--tab-height) + var(--safe-bottom));
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
}

a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { border: none; cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===== Header ===== */
.header {
  position: sticky; top: 0; z-index: 100;
  background: #fff;
  padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between;
  min-height: var(--header-height);
  border-bottom: 1px solid var(--border);
}
.header-logo {
  display: flex; align-items: center; gap: 4px;
  font-size: 15px; font-weight: 600; color: var(--text);
}
.header-logo .bi { font-size: 16px; }
.header-logo .city { border-bottom: 1px dashed var(--text-secondary); }
.header-actions { display: flex; gap: 6px; align-items: center; }
.header-actions button {
  background: none; color: var(--text); font-size: 14px;
  height: 34px; display: flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 20px; padding: 0 10px; border: 1px solid var(--border);
  font-weight: 500;
}
.header-actions button:active { background: var(--bg); }
.header-actions .lang-btn { font-size: 13px; font-weight: 700; min-width: 36px; padding: 0 8px; }

/* ===== Bottom Tab Bar ===== */
.tab-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  background: #fff;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-around; align-items: center;
  height: var(--tab-height);
  padding-bottom: var(--safe-bottom);
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.04);
}
.tab-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; height: 100%;
  color: var(--text-secondary); font-size: 10px; font-weight: 600;
  gap: 3px; background: none; transition: color 0.2s;
}
.tab-item .tab-icon { font-size: 20px; height: 24px; display: flex; align-items: center; }
.tab-item.active { color: var(--primary); }
.tab-item:active { opacity: 0.7; }

/* ===== Search Bar ===== */
.search-bar-wrap { padding: 8px 16px 12px; background: #fff; }
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border-radius: 12px; padding: 12px 16px;
  border: 1px solid var(--border); transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--primary); }
.search-bar input {
  flex: 1; border: none; outline: none; font-size: 15px;
  background: transparent; color: var(--text);
}
.search-bar input::placeholder { color: #a1a1aa; }
.search-bar .search-icon { color: var(--primary); font-size: 18px; }

/* ===== Category Pills ===== */
.category-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
  background: #fff;
}
.category-scroll::-webkit-scrollbar { display: none; }
.category-pill {
  flex-shrink: 0; padding: 8px 16px;
  border-radius: 24px; font-size: 13px; font-weight: 600;
  background: var(--bg); color: var(--text-secondary); border: none;
  white-space: nowrap; transition: all 0.2s;
}
.category-pill.active { background: var(--primary); color: #fff; }
.category-pill:active { transform: scale(0.96); }

/* ===== Section Title ===== */
.section-title {
  padding: 20px 16px 10px; font-size: 17px; font-weight: 800;
  display: flex; justify-content: space-between; align-items: center;
  letter-spacing: -0.3px;
}
.section-title .see-all { font-size: 13px; color: var(--primary); font-weight: 700; }

/* ===== Event Cards (Grid or Scroll) ===== */
.event-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 0 16px 20px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.event-scroll::-webkit-scrollbar { display: none; }
.event-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px 20px;
}
.event-card {
  flex-shrink: 0; width: 240px; background: var(--card-bg);
  border-radius: var(--radius); overflow: hidden;
  transition: transform 0.2s;
  position: relative;
}
.event-grid .event-card { width: auto; }
.event-card:active { transform: scale(0.97); }
.event-card-img {
  width: 100%; height: 140px; object-fit: cover;
  background: #e0e0e0;
}
.event-grid .event-card-img { height: 120px; border-radius: var(--radius); }
.event-card .fav-btn {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(0,0,0,0.4); color: #fff; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px); z-index: 2;
}
.event-card .fav-btn:active { background: rgba(0,0,0,0.6); }
.event-card-body { padding: 8px 4px; }
.event-grid .event-card-body { padding: 8px 0; }
.event-card-title {
  font-size: 15px; font-weight: 700; margin-bottom: 4px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.event-card-meta { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 2px; }
.event-card-meta .bi { font-size: 11px; }
.event-card-price { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-top: 4px; }
.event-card-price span { font-size: 11px; font-weight: 400; }

/* ===== Event List (Vertical) ===== */
.event-list { padding: 0 16px; }
.event-list-item {
  display: flex; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); align-items: center;
}
.event-list-item:last-child { border-bottom: none; }
.event-list-img {
  width: 80px; height: 80px; border-radius: var(--radius-sm);
  object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, #f093fb, #f5576c);
}
.event-list-info { flex: 1; min-width: 0; }
.event-list-title { font-size: 14px; font-weight: 700; line-height: 1.3; margin-bottom: 4px; }
.event-list-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 2px; }
.event-list-venue { font-size: 12px; color: var(--text-secondary); }
.event-list-price { font-size: 14px; font-weight: 700; color: var(--primary); margin-top: 4px; }

/* ===== Banner ===== */
.banner {
  margin: 8px 16px 16px; border-radius: var(--radius); overflow: hidden;
  background: var(--primary-light);
  padding: 20px; color: var(--text); position: relative;
  border: 1px solid #c8e6c9;
}
.banner h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.banner p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; line-height: 1.5; }
.banner-btn {
  display: inline-block; background: var(--primary); color: #fff;
  padding: 8px 20px; border-radius: 20px; font-size: 13px; font-weight: 600;
}

/* ===== Event Detail Page ===== */
.event-hero {
  width: 100%; height: 240px; object-fit: cover;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.event-detail { padding: 16px; }
.event-detail h1 { font-size: 22px; font-weight: 800; margin-bottom: 8px; line-height: 1.2; }
.event-info-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-secondary); margin-bottom: 6px;
}
.event-info-row .icon { font-size: 18px; width: 24px; text-align: center; }

.guarantee-box {
  margin: 16px; padding: 14px; background: #f0fdf4;
  border-radius: var(--radius-sm); border: 1px solid #bbf7d0;
  display: flex; align-items: flex-start; gap: 10px;
}
.guarantee-box .icon { font-size: 20px; color: var(--primary); flex-shrink: 0; }
.guarantee-box p { font-size: 13px; color: #166534; }

/* ===== Ticket Listing ===== */
.ticket-section { padding: 0 16px 16px; }
.ticket-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.ticket-item {
  background: var(--card-bg); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 10px;
  border: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.ticket-item:active { background: #f9fafb; }
.ticket-info h4 { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.ticket-info p { font-size: 12px; color: var(--text-secondary); }
.ticket-price { text-align: right; }
.ticket-price .price { font-size: 18px; font-weight: 800; color: var(--primary); }
.ticket-price .per { font-size: 11px; color: var(--text-secondary); }

/* ===== Seat Map ===== */
.seat-map-container {
  margin: 16px; background: var(--card-bg); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); text-align: center;
}
.seat-map-container h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.seat-map-svg {
  width: 100%; height: 200px; border-radius: var(--radius-sm);
  background: #f8fafc; display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 13px;
}

/* ===== Sticky Buy Button ===== */
.buy-bar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px;
  background: #fff; border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  display: flex; align-items: center; justify-content: space-between;
  z-index: 200;
}
.buy-bar .price-summary { font-size: 12px; color: var(--text-secondary); }
.buy-bar .price-summary .total { font-size: 20px; font-weight: 800; color: var(--text); display: block; }
.buy-btn {
  background: var(--primary); color: #fff; border-radius: 28px;
  padding: 14px 32px; font-size: 16px; font-weight: 700;
  transition: background 0.2s;
}
.buy-btn:active { background: var(--primary-dark); }

/* ===== Search Page ===== */
.search-page-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--border);
}
.search-page-bar .back-btn { background: none; color: var(--text); font-size: 22px; }
.search-page-bar input {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 16px; font-size: 15px; outline: none;
}
.search-page-bar input:focus { border-color: var(--primary); }
.search-filters {
  display: flex; gap: 8px; padding: 12px 16px;
  overflow-x: auto; scrollbar-width: none;
}
.search-filters::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 16px;
  font-size: 12px; font-weight: 600; background: #fff;
  border: 1px solid var(--border); color: var(--text); white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== Sell Page ===== */
.sell-hero {
  background: var(--primary);
  padding: 60px 24px 40px; color: #fff; text-align: center;
}
.sell-hero h2 { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.sell-hero p { font-size: 14px; opacity: 0.9; }
.sell-form { padding: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 6px;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; outline: none;
  background: #fff; transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
}
.submit-btn {
  width: 100%; padding: 14px; background: var(--primary);
  color: #fff; border-radius: 28px; font-size: 16px; font-weight: 700;
  margin-top: 8px; transition: background 0.2s;
}
.submit-btn:active { background: var(--primary-dark); }

/* ===== Orders Page ===== */
.orders-header {
  background: var(--primary); padding: 16px; color: #fff;
}
.orders-header h2 { font-size: 20px; font-weight: 800; }
.order-tabs {
  display: flex; background: #fff; border-bottom: 1px solid var(--border);
}
.order-tab {
  flex: 1; padding: 12px; text-align: center; font-size: 14px;
  font-weight: 600; color: var(--text-secondary); background: none;
  border-bottom: 2px solid transparent; transition: all 0.2s;
}
.order-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.order-card {
  margin: 12px 16px; background: var(--card-bg); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.order-card-header {
  padding: 14px; display: flex; gap: 12px; align-items: center;
}
.order-card-img {
  width: 60px; height: 60px; border-radius: var(--radius-sm);
  object-fit: cover; flex-shrink: 0;
  background: linear-gradient(135deg, #a855f7, #6366f1);
}
.order-card-info { flex: 1; }
.order-card-title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.order-card-date { font-size: 12px; color: var(--text-secondary); }
.order-card-footer {
  padding: 10px 14px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.order-status {
  padding: 4px 10px; border-radius: 12px; font-size: 11px; font-weight: 700;
}
.order-status.confirmed { background: #dcfce7; color: #166534; }
.order-status.pending { background: #fef9c3; color: #854d0e; }
.order-status.cancelled { background: #fee2e2; color: #991b1b; }
.order-view-btn {
  background: var(--primary); color: #fff; padding: 6px 16px;
  border-radius: 16px; font-size: 12px; font-weight: 600;
}

/* ===== Checkout Page ===== */
.checkout-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: #fff; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.checkout-header .back-btn { background: none; font-size: 22px; color: var(--text); }
.checkout-header h2 { font-size: 18px; font-weight: 700; }
.checkout-summary {
  margin: 16px; background: var(--card-bg); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.checkout-event { display: flex; gap: 12px; margin-bottom: 14px; }
.checkout-event-img {
  width: 70px; height: 70px; border-radius: var(--radius-sm);
  flex-shrink: 0; object-fit: cover;
  background: linear-gradient(135deg, #667eea, #764ba2);
}
.checkout-event-info h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.checkout-event-info p { font-size: 12px; color: var(--text-secondary); }
.checkout-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  font-size: 14px; border-bottom: 1px solid #f3f4f6;
}
.checkout-row:last-child { border-bottom: none; }
.checkout-row.total { font-weight: 800; font-size: 16px; padding-top: 10px; }
.checkout-row.total .val { color: var(--primary); }

.payment-section { margin: 16px; }
.payment-section h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.payment-method {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; background: var(--card-bg); border-radius: var(--radius-sm);
  border: 2px solid var(--border); margin-bottom: 10px; cursor: pointer;
  transition: border-color 0.2s;
}
.payment-method.selected { border-color: var(--primary); }
.payment-method .radio {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.payment-method.selected .radio { border-color: var(--primary); }
.payment-method.selected .radio::after {
  content: ''; width: 10px; height: 10px;
  border-radius: 50%; background: var(--primary);
}
.payment-method-icon { font-size: 24px; }
.payment-method-name { font-size: 14px; font-weight: 600; }

/* ===== Profile Page ===== */
.profile-header {
  background: var(--primary); padding: 24px 16px; color: #fff; text-align: center;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: rgba(255,255,255,0.2); margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
}
.profile-name { font-size: 18px; font-weight: 700; }
.profile-email { font-size: 13px; opacity: 0.8; }
.profile-menu { padding: 16px; }
.profile-menu-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.profile-menu-item .icon { font-size: 20px; width: 28px; text-align: center; color: var(--text-secondary); }
.profile-menu-item .arrow { margin-left: auto; color: var(--text-secondary); font-size: 16px; }

/* ===== Empty State ===== */
.empty-state {
  text-align: center; padding: 48px 32px;
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.empty-state p { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.empty-state-btn {
  display: inline-block; background: var(--primary); color: #fff;
  padding: 10px 24px; border-radius: 24px; font-size: 14px; font-weight: 600;
}

/* ===== Loading ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: calc(var(--tab-height) + 20px); left: 50%; transform: translateX(-50%);
  background: var(--secondary); color: #fff; padding: 12px 24px;
  border-radius: 24px; font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); z-index: 300;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 500; display: none; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-content {
  background: #fff; width: 100%; max-width: 560px;
  border-radius: 16px; padding: 24px;
  max-height: 80vh; overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px; background: #d1d5db;
  border-radius: 2px; margin: 0 auto 16px;
}
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }

/* ===== Responsive ===== */
@media (min-width: 561px) {
  body { border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
}
