/* ===== Card Pro H5 - Enterprise Theme ===== */
:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #6366f1;
  --primary-bg: #eef2ff;
  --danger: #ef4444;
  --danger-dark: #dc2626;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --price: #ef4444;
  --text: #111827;
  --text-muted: #9ca3af;
  --text-secondary: #6b7280;
  --border: #e5e7eb;
  --bg: #f1f5f9;
  --white: #ffffff;
  --card-bg: #ffffff;
  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
  --shadow-hover: 0 20px 25px -5px rgba(0,0,0,.10), 0 10px 10px -5px rgba(0,0,0,.04);
  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  /* Transitions */
  --transition: 0.2s ease;
  --transition-slow: 0.35s ease;
  /* Font sizes */
  --font-xs: 11px;
  --font-sm: 13px;
  --font-base: 14px;
  --font-lg: 16px;
  --font-xl: 18px;
  --font-2xl: 22px;
  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  /* Toast */
  --toast-success: #059669;
  --toast-error: #dc2626;
  --toast-info: #4f46e5;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
  color: var(--text-secondary);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { display: block; }

/* ===== Container ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 576px)  { .container { padding: 0 20px; } }
@media (min-width: 768px)  { .container { max-width: 760px; } }
@media (min-width: 992px)  { .container { max-width: 992px; } }
@media (min-width: 1200px) { .container { max-width: 1200px; } }

/* ===== Header Navbar ===== */
.header-navbar {
  height: 64px;
  background: var(--white);
  box-shadow: 0 1px 0 var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-flex {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topnav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.topnav-logo img { height: 32px; border-radius: 6px; }
.logo-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--transition);
  line-height: 1.5;
  text-decoration: none;
  white-space: nowrap;
}
.btn:focus { outline: none; }
.btn-primary { background: var(--primary); color: var(--white); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--white); }
.btn-primary:disabled { background: #c4b5fd; border-color: #c4b5fd; cursor: not-allowed; }
.btn-danger { background: var(--danger); color: var(--white); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); border-color: var(--danger-dark); color: var(--white); }
.btn-danger:disabled { background: #fca5a5; border-color: #fca5a5; cursor: not-allowed; }
.btn-success { background: var(--success); color: var(--white); border-color: var(--success); }
.btn-outline-primary {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: 20px;
  font-size: var(--font-sm);
}
.btn-outline-primary:hover { background: var(--primary-bg); color: var(--primary); }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 13px 28px; font-size: var(--font-lg); border-radius: var(--radius); }
.btn svg { flex-shrink: 0; }

/* ===== Page Title ===== */
.page-title-box {
  padding: 20px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-title-box .page-title {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.page-title-box .page-title-right { display: flex; align-items: center; }

/* ===== Search Box ===== */
.app-search { position: relative; }
.app-search input {
  width: 220px;
  padding: 8px 36px 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  font-size: var(--font-sm);
  outline: none;
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, background 0.2s;
}
.app-search input:focus { border-color: var(--primary); background: var(--white); }
.app-search .search-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 0;
  font-size: var(--font-sm);
  color: var(--text-muted);
}
.breadcrumb-link { color: var(--text-muted); text-decoration: none; transition: color 0.2s; }
.breadcrumb-link:hover { color: var(--primary); }
.breadcrumb-current { color: var(--text); font-weight: 500; }
.breadcrumb-sep { display: flex; align-items: center; color: var(--text-muted); opacity: 0.4; }

/* ===== Category Tab Links ===== */
.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
  padding-bottom: 4px;
}
.tab-link {
  font-size: var(--font-sm);
  padding: 6px 16px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  background: var(--white);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  font-weight: 500;
}
.tab-link:hover { border-color: var(--primary); color: var(--primary); }
.tab-link.active {
  color: var(--white);
  background: var(--primary);
  border-color: var(--primary);
}

/* ===== Home Card Grid ===== */
.hyper-wrapper { display: grid; gap: 14px; }
.hyper-wrapper a { text-decoration: none; }

/* Mobile: 2 columns */
@media (max-width: 575px) {
  .hyper-wrapper { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
/* Tablet: 3 columns */
@media (min-width: 576px) and (max-width: 991px) {
  .hyper-wrapper { grid-template-columns: repeat(3, 1fr); }
}
/* Desktop: 4 columns */
@media (min-width: 992px) {
  .hyper-wrapper { grid-template-columns: repeat(4, 1fr); }
}
/* Large desktop: 5 columns */
@media (min-width: 1320px) {
  .hyper-wrapper { grid-template-columns: repeat(5, 1fr); }
}

.home-card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid rgba(0,0,0,.04);
}
.home-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.home-card.out-of-stock {
  opacity: 0.65;
  filter: grayscale(20%);
}
.home-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #f8fafc;
}
.home-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.home-card:hover .home-img { transform: scale(1.04); }
.home-card .card-info-area {
  padding: 12px 14px 14px;
}
.home-card .name {
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  margin-bottom: 8px;
}
.home-card .price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-card .price {
  color: var(--price);
  font-weight: 700;
  font-size: var(--font-lg);
  line-height: 1;
}
.home-card .price b { font-size: 18px; }
.home-card .stock-tag {
  font-size: var(--font-xs);
  color: var(--text-muted);
  background: transparent;
  padding: 0;
}
.card-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: flex-end;
}

/* Sold out overlay */
.ribbon-box { position: relative; overflow: hidden; }
.ribbon-two {
  position: absolute;
  left: -5px; top: -5px;
  z-index: 2;
  width: 72px; height: 72px;
  overflow: hidden;
}
.ribbon-two span {
  font-size: var(--font-xs);
  font-weight: 700;
  color: var(--white);
  text-align: center;
  line-height: 20px;
  transform: rotate(-45deg);
  width: 100px;
  display: block;
  position: absolute;
  top: 18px; left: -21px;
}
.ribbon-two-danger span { background: var(--danger); }

/* ===== Cards ===== */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px 24px; }
.card-title {
  font-size: var(--font-lg);
  font-weight: 700;
  color: var(--text);
  margin-bottom: var(--spacing-md);
}

/* ===== Forms ===== */
.form-group { margin-bottom: 18px; }
.form-group label, .buy-title {
  display: block;
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--font-base);
  outline: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--white);
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
textarea.form-control { resize: vertical; }
.form-control-error { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(239,68,68,.1) !important; }
.field-error { color: var(--danger); font-size: var(--font-xs); margin-top: 4px; }
.input-group { display: flex; }
.input-group .form-control { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; white-space: nowrap; }

/* ===== Quantity Control ===== */
.qty-control {
  display: inline-flex;
  align-items: center;
  height: 38px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--white);
}
.qty-btn {
  width: 38px;
  height: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 20px;
  font-weight: 300;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.qty-btn:hover { background: #f3f4f6; color: var(--primary); }
.qty-input {
  width: 48px;
  height: 100%;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text);
  -moz-appearance: textfield;
  outline: none;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Legacy qty-wrap compat (kept for any stale HTML) */
.qty-wrap { display: flex; align-items: center; }
.qty-wrap .form-control { text-align: center; border-radius: 0; width: 60px; -moz-appearance: textfield; }
.qty-wrap .form-control::-webkit-outer-spin-button,
.qty-wrap .form-control::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ===== Badges ===== */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: var(--font-xs);
  font-weight: 600;
  line-height: 1.4;
}
.badge-outline-primary { border: 1.5px solid var(--primary); color: var(--primary); background: var(--primary-bg); }
.badge-outline-danger { border: 1.5px solid var(--danger); color: var(--danger); background: #fef2f2; }
.badge-outline-dark { border: 1.5px solid #d1d5db; color: var(--text-secondary); background: #f9fafb; }
.badge-outline-muted { font-size: var(--font-xs); padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border); color: var(--text-muted); background: transparent; }
.badge-pending { background: var(--warning-bg); color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed { background: var(--success-bg); color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-expired { background: #f3f4f6; color: #4b5563; }

/* ===== Payment Grid ===== */
.pay-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 480px) { .pay-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 992px) { .pay-grid { grid-template-columns: repeat(2, 1fr); } }

.pay-type {
  position: relative;
  background: var(--white);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 10px;
  cursor: pointer;
  text-align: center;
  font-size: var(--font-sm);
  font-weight: 600;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  user-select: none;
}
.pay-type:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }
.pay-type.active {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-bg);
}
.pay-type.active::after {
  content: '';
  position: absolute;
  top: -1px; right: -1px;
  width: 18px; height: 18px;
  background: var(--primary);
  border-radius: 0 var(--radius) 0 var(--radius);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.pay-type svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ===== Buy Page Layout ===== */
.buy-layout { display: block; }

@media (min-width: 992px) {
  .buy-layout {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 20px;
    align-items: start;
  }
}

/* Product gallery (image area) */
.product-gallery {
  margin-bottom: 16px;
}
.product-img-wrap {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.product-main-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Buy form side */
.buy-form-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 992px) {
  .buy-form-card { position: sticky; top: 76px; }
}
.product-name {
  font-size: var(--font-xl);
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 10px;
}
.product-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.buy-price {
  font-size: 28px;
  font-weight: 800;
  color: var(--danger);
  line-height: 1;
}
.buy-price-unit { font-size: 16px; font-weight: 600; }
.original-price {
  color: var(--text-muted);
  font-size: var(--font-sm);
  text-decoration: line-through;
  margin-left: 8px;
}
.price-row { display: flex; align-items: baseline; gap: 4px; margin-bottom: 18px; }

/* Total row */
.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0 4px;
  font-size: var(--font-base);
  border-top: 1px solid var(--border);
  margin-top: 4px;
  color: var(--text-secondary);
}
.total-amount {
  color: var(--danger);
  font-size: 24px;
  font-weight: 800;
}

/* Trust badges */
.trust-badges {
  display: flex;
  justify-content: space-around;
  padding: 14px 0 0;
  margin-top: 4px;
  border-top: 1px solid #f3f4f6;
}
.trust-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.trust-badge-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary);
}

/* Product description card */
.buy-detail-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-top: 20px;
}
@media (min-width: 992px) {
  .buy-detail-card { margin-top: 0; }
}

/* ===== Bill Page ===== */
.bill-wrap { max-width: 560px; margin: 0 auto; padding-bottom: 40px; }

/* Step indicator */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0 4px;
  margin-bottom: 8px;
}
.step-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  max-width: 120px;
}
.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-muted);
  transition: all var(--transition);
}
.step-item.active .step-circle {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--white);
  box-shadow: 0 0 0 4px var(--primary-bg);
}
.step-item.done .step-circle {
  background: var(--success);
  border-color: var(--success);
  color: var(--white);
}
.step-label {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}
.step-item.active .step-label { color: var(--primary); font-weight: 700; }
.step-item.done .step-label { color: var(--success); }
.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
  margin-bottom: 22px;
  max-width: 60px;
  transition: background var(--transition);
}
.step-line.done { background: var(--success); }
.step-line.active { background: var(--primary); }

/* Bill card */
.bill-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.bill-card-header {
  padding: 18px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-sm);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.bill-card-body { padding: 24px; }
.bill-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f9fafb;
  font-size: var(--font-base);
}
.bill-detail-row:last-child { border-bottom: none; }
.bill-label { font-weight: 600; color: var(--text-muted); font-size: var(--font-sm); }
.bill-value { color: var(--text); font-weight: 500; }
.bill-value.mono { font-family: 'SF Mono', monospace; font-size: var(--font-sm); letter-spacing: 0.5px; }
.bill-value.price { color: var(--danger); font-weight: 700; font-size: var(--font-xl); }

/* Countdown ring */
.countdown-area {
  text-align: center;
  padding: 20px 0;
}
.countdown-ring-wrap {
  position: relative;
  display: inline-block;
  width: 88px;
  height: 88px;
  margin-bottom: 12px;
}
.countdown-ring-bg {
  fill: none;
  stroke: #e5e7eb;
  stroke-width: 5;
}
.countdown-ring-fg {
  fill: none;
  stroke: var(--danger);
  stroke-width: 5;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 1s linear;
}
.countdown-text-inside {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}
.countdown {
  font-size: 18px;
  font-weight: 800;
  color: var(--danger);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: 1px;
}
.countdown-label { font-size: 10px; color: var(--text-muted); }

/* Pay action area */
.pay-action-area { padding: 0 24px 24px; text-align: center; }
.pay-action-hint {
  font-size: var(--font-sm);
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Polling dots */
.polling-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  margin-top: 16px;
}
.polling-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.polling-dots span:nth-child(2) { animation-delay: 0.2s; }
.polling-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotPulse {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

/* Success state */
.success-anim {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  color: var(--success);
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Auto-jump progress bar */
.jump-progress-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin: 14px 0;
}
.jump-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width linear;
}

/* ===== Order Page ===== */
.order-status-hero {
  text-align: center;
  padding: 32px 20px 24px;
}
.order-status-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.order-status-icon.success { background: var(--success-bg); color: var(--success); }
.order-status-icon.pending { background: #dbeafe; color: #2563eb; }
.order-status-icon.warning { background: var(--warning-bg); color: #d97706; }
.order-status-icon.error { background: #fee2e2; color: var(--danger); }
.order-status-title {
  font-size: var(--font-2xl);
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}
.order-status-subtitle { font-size: var(--font-sm); color: var(--text-muted); }

/* Kami display */
.kami-block {
  background: #0f172a;
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
}
.kami-content {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: var(--font-sm);
  color: #e2e8f0;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 220px;
  overflow-y: auto;
}
.kami-copy-btn {
  position: absolute;
  top: 10px; right: 10px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  padding: 5px 10px;
  color: #e2e8f0;
  font-size: var(--font-xs);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.kami-copy-btn:hover { background: rgba(255,255,255,.18); }
.kami-copy-btn.copied { background: rgba(16,185,129,.2); border-color: var(--success); color: var(--success); }

/* Order info grid */
.order-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
@media (min-width: 768px) {
  .order-info-grid { grid-template-columns: 1fr 1fr; gap: 20px; }
}
.order-info-item {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: var(--font-base);
}
.order-info-item:last-child { border-bottom: none; }
.order-info-label { color: var(--text-muted); font-size: var(--font-sm); }
.order-info-value { color: var(--text); font-weight: 600; text-align: right; }

/* ===== Search Page ===== */
.nav-tabs {
  display: flex;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
  gap: 0;
}
.nav-tab-item {
  padding: 10px 20px;
  cursor: pointer;
  font-size: var(--font-base);
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-tab-item:hover { color: var(--primary); }
.nav-tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.nav-tab-item svg { flex-shrink: 0; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Search result cards */
.order-result-card {
  padding: 14px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: block;
  color: inherit;
  text-decoration: none;
  transition: all var(--transition);
}
.order-result-card:hover { background: #f8f9fa; transform: translateX(4px); }
.order-result-card:last-child { border-bottom: none; }
.order-result-card .order-title { font-weight: 600; font-size: var(--font-base); color: var(--text); }
.order-result-card .order-sn { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.order-result-card .order-price { color: var(--danger); font-weight: 600; }

.cache-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
}
.cache-order-row:last-child { border-bottom: none; }

/* ===== Footer ===== */
.hyper-footer {
  padding: 16px 0 20px;
  background: var(--white);
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
  font-size: var(--font-sm);
  text-align: center;
  margin-top: auto;
}
.hyper-footer a { color: var(--text-muted); transition: color 0.2s; }
.hyper-footer a:hover { color: var(--primary); }
.footer-payments { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 8px; }
.footer-pay-icon {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 22px;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 4px;
  padding: 3px;
}
.footer-pay-icon svg { width: 20px; height: 16px; }
.footer-links { margin-bottom: 6px; }
.footer-links a { margin: 0 8px; }
.footer-dot { color: var(--border); }
.footer-copy { font-size: var(--font-xs); color: var(--text-muted); opacity: 0.7; }

/* ===== Buy Prompt Card ===== */
.buy-prompt-card {
  display: flex; gap: 10px; align-items: flex-start;
  border-left: 3px solid var(--primary, #4f46e5);
  background: rgba(79, 70, 229, 0.04);
  border-radius: 0 6px 6px 0;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: var(--font-sm);
  color: var(--text-secondary);
}
.buy-prompt-card strong { color: var(--primary, #4f46e5); display: block; margin-bottom: 2px; }
.buy-prompt-card p { margin: 0; }
.buy-prompt-card svg { flex-shrink: 0; margin-top: 2px; color: var(--primary, #4f46e5); }

/* ===== Sales Tag ===== */
.sales-tag {
  font-size: var(--font-xs);
  color: var(--text-muted);
  background: transparent;
  padding: 0;
}

/* ===== Back to top ===== */
.back-to-top { display: none; position: fixed; bottom: 32px; right: 20px; z-index: 99; }
.back-to-top.show { display: block; }
.back-to-top button {
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  width: 44px; height: 44px;
  background: var(--primary);
  color: var(--white);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79,70,229,.4);
  transition: all var(--transition);
}
.back-to-top button:hover { background: var(--primary-dark); transform: translateY(-2px); }

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

/* ===== Skeleton Screens ===== */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.skeleton-img { height: 0; padding-bottom: 75%; border-radius: 0; }
.skeleton-body { padding: 12px 14px; }
.skeleton-title { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-price { height: 18px; width: 40%; }
.skeleton-detail { padding: 20px; }
.skeleton-line-lg { height: 24px; width: 60%; margin-bottom: 16px; }
.skeleton-line { height: 14px; width: 100%; margin-bottom: 12px; }
.skeleton-line-sm { height: 14px; width: 45%; margin-bottom: 16px; }
.skeleton-block { height: 120px; width: 100%; }

/* ===== Empty State ===== */
.empty { text-align: center; padding: 60px 0; color: var(--text-muted); font-size: var(--font-base); }

/* ===== Toast ===== */
.toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  z-index: 9999;
  opacity: 0;
  transition: all 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
}
.toast-icon { display: flex; align-items: center; flex-shrink: 0; }
.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-out { opacity: 0; transform: translateX(-50%) translateY(-8px); }
.toast-default { background: rgba(17,24,39,0.92); color: var(--white); }
.toast-success { background: var(--toast-success); color: var(--white); }
.toast-error { background: var(--toast-error); color: var(--white); }
.toast-info { background: var(--toast-info); color: var(--white); }

/* ===== Status Icons ===== */
.status-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 64px; height: 64px;
  border-radius: 50%;
  margin-bottom: 12px;
}
.status-icon svg { width: 32px; height: 32px; }
.status-icon-success { background: var(--success-bg); color: var(--success); }
.status-icon-error { background: #fee2e2; color: var(--danger); }
.status-icon-warning { background: var(--warning-bg); color: var(--warning); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  max-width: 480px; width: 90%;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-header h5 { font-size: var(--font-lg); font-weight: 700; color: var(--text); margin: 0; }
.modal-close {
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--text-muted); line-height: 1;
}
.modal-body { padding: 16px 20px; font-size: var(--font-base); line-height: 1.6; color: var(--text-secondary); white-space: pre-wrap; }
.modal-body img { max-width: 100%; height: auto; }
.modal-footer { padding: 12px 20px 20px; text-align: center; }
.modal-footer .btn-confirm {
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  font-size: var(--font-base);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  min-width: 120px;
}
.modal-footer .btn-confirm:hover { background: var(--primary-dark); }

/* ===== Alert ===== */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: var(--font-sm);
  line-height: 1.5;
  margin-bottom: var(--spacing-md);
}
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ===== Utility Classes ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
[x-cloak] { display: none !important; }

/* ===== Order info page (legacy compat for search) ===== */
.orderinfo-grid { display: grid; grid-template-columns: auto; }
@media (min-width: 767px) {
  .orderinfo-card-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
  }
  .orderinfo-info { grid-column: span 2 / span 2; }
  .orderinfo-kami { grid-column: span 4 / span 4; }
}
.orderinfo-info .mb-1 { margin-bottom: 8px; }
.orderinfo-info label { font-weight: 600; color: var(--text); margin-right: 4px; }
.textarea-kami { min-height: 140px; }
.kami-btn { margin-top: 6px; float: right; }
.bill-card.legacy-bill { max-width: 600px; margin: 0 auto; }
.bill-card.legacy-bill .mb-1 { margin-bottom: 8px; font-size: var(--font-base); }
.bill-card.legacy-bill label { font-weight: 600; color: var(--text); margin-right: 4px; }

/* ===== Search Page Hero ===== */
.search-hero { text-align:center; padding:32px 0 24px; }
.search-hero-icon {
  display:inline-flex; width:72px; height:72px;
  background:linear-gradient(135deg,#ede9fe,#ddd6fe); border-radius:20px;
  align-items:center; justify-content:center; color:var(--primary); margin-bottom:16px;
}
.search-hero-title { font-size:24px; font-weight:800; color:var(--text); margin-bottom:6px; }
.search-hero-sub { font-size:14px; color:var(--text-muted); }

/* Search tabs (pill style) */
.search-tabs {
  display:flex; gap:6px; margin-bottom:20px;
  background:#f3f4f6; border-radius:10px; padding:4px;
}
.search-tab-item {
  flex:1; padding:8px 12px; cursor:pointer;
  font-size:var(--font-sm); font-weight:600;
  color:var(--text-secondary); border:none; background:transparent;
  border-radius:7px; transition:all 0.2s;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
.search-tab-item:hover { color:var(--primary); }
.search-tab-item.active {
  background:var(--white); color:var(--primary);
  box-shadow:0 1px 3px rgba(0,0,0,.1);
}
.search-tab-item svg { flex-shrink:0; }

/* Empty state */
.empty-state { text-align:center; padding:40px 0; }
.empty-state-icon {
  width:56px; height:56px; border-radius:50%;
  background:#fef3c7; display:flex; align-items:center; justify-content:center;
  margin:0 auto 12px; color:#f59e0b;
}
.empty-state-title { font-size:15px; font-weight:600; color:var(--text); margin-bottom:4px; }
.empty-state-sub { font-size:13px; color:var(--text-muted); }

/* Result list header */
.result-header { padding:12px 0 8px; font-size:13px; color:var(--text-muted); }

/* ===== Order Detail - Success enhancements ===== */
.success-goods-name {
  font-size:15px; font-weight:600; color:var(--text); margin:8px 0 2px;
}

/* Amount highlight block */
.order-price-highlight {
  text-align:center; padding:16px;
  background:#fff5f5; border-radius:12px; margin-bottom:16px;
}
.order-price-highlight .amount { font-size:30px; font-weight:800; color:var(--danger); }
.order-price-highlight .label { font-size:12px; color:var(--text-muted); margin-top:2px; }

/* Kami section header */
.kami-section-header {
  display:flex; align-items:center; gap:8px;
  font-size:14px; font-weight:700; color:var(--text); margin-bottom:10px;
}

/* Full-width kami copy button */
.kami-copy-full-btn {
  display:block; width:100%; margin-top:12px;
  background:var(--success); color:#fff; border:none; border-radius:10px;
  padding:12px; font-size:14px; font-weight:600; cursor:pointer;
  transition:opacity .2s;
}
.kami-copy-full-btn:hover { opacity:.9; }
.kami-copy-full-btn.copied { opacity:.8; }

/* ===== Mobile Fixes ===== */
@media (max-width: 480px) {
  .app-search input { width: 140px; }
  .page-title-box { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-title-box .page-title-right { width: 100%; }
  .app-search { width: 100%; }
  .app-search input { width: 100%; }
}
@media (max-width: 767px) {
  .form-control { font-size: 16px; } /* Prevent iOS zoom */
  .card-body, .buy-form-card, .buy-detail-card { padding: 16px; }
  .buy-price { font-size: 24px; }
}
