/* =========================================================
   Koochino customer dashboard — port of the React prototype
   layout: greeting, stats + QR row, quick action tiles,
   lucky-box banner, recent orders, category grid.
   ========================================================= */

.koo-dash {
  display: flex;
  flex-direction: column;
}

/* ========== Greeting ========== */
.koo-greeting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.koo-greeting-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-primary);
}

.koo-greeting-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--text-secondary);
}

/* ========== Stats + QR row ========== */
.koo-dash-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}

.koo-stats-col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.koo-stat-row {
  flex: 1;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  box-shadow: var(--shadow-card);
  text-decoration: none;
  transition: border-color 0.15s ease;
}

.koo-app .koo-inner a.koo-stat-row:hover {
  text-decoration: none;
  border-color: var(--brand-primary);
}

.koo-stat-label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.koo-tint {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.koo-tint-gold { background: #fef3e2; color: #d99a06; }
.koo-tint-green { background: var(--c-green-50); color: var(--c-green-600); }
.koo-tint-amber { background: #fef3e2; color: var(--c-amber-600); }
.koo-tint-blue { background: var(--c-blue-50); color: var(--c-blue-500); }
.koo-tint-purple { background: var(--c-purple-50); color: var(--c-purple-600); }
.koo-tint-rose { background: var(--c-rose-50); color: var(--c-rose-500); }

.koo-stat-value-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.koo-stat-value {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: baseline;
  gap: 4px;
  direction: ltr;
}

.koo-stat-suffix {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-tertiary);
}

.koo-stat-chev {
  color: var(--text-tertiary);
  flex-shrink: 0;
  display: flex;
}

/* QR card */
.koo-qr-card {
  background-image: linear-gradient(155deg, var(--c-green-600), var(--c-green-900));
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--sp-2);
}

.koo-qr-label {
  margin: 0;
  align-self: flex-start;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.koo-qr-box {
  width: 100%;
  max-width: 128px;
  aspect-ratio: 1;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.koo-qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.koo-qr-hint {
  margin: 0;
  color: var(--c-green-100);
  font-size: 10.5px;
  line-height: 1.5;
}

/* ========== Section header ========== */
.koo-section {
  margin-bottom: var(--sp-6);
}

.koo-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-3);
}

.koo-app .koo-inner .koo-section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

.koo-app .koo-inner .koo-see-all {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-primary-strong);
  white-space: nowrap;
}

/* ========== Quick action tiles ========== */
.koo-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
}

.koo-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 14px 6px 12px;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.koo-tile:active {
  transform: scale(0.96);
}

.koo-app .koo-inner a.koo-tile:hover {
  text-decoration: none;
  box-shadow: var(--shadow-card);
  border-color: transparent;
}

.koo-tile .koo-tint {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}

.koo-tile-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.koo-tile-sub {
  font-size: 10.5px;
  color: var(--text-tertiary);
  line-height: 1.2;
}

/* ========== Lucky box banner ========== */
.koo-luckybox {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  background: linear-gradient(135deg, var(--c-purple-500), var(--c-purple-900));
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  overflow: hidden;
  margin-bottom: var(--sp-6);
  text-decoration: none;
}

.koo-app .koo-inner a.koo-luckybox:hover {
  text-decoration: none;
}

.koo-luckybox-glow {
  position: absolute;
  inset: -40% -10% auto auto;
  width: 160px;
  height: 160px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 65%);
  border-radius: 50%;
}

.koo-luckybox-emoji {
  font-size: 42px;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25));
  flex-shrink: 0;
}

.koo-luckybox-text {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.koo-luckybox-title {
  margin: 0;
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}

.koo-luckybox-desc {
  margin: 0;
  color: var(--c-purple-100);
  font-size: 12px;
  line-height: 1.5;
}

.koo-luckybox-cta {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  background: #fff;
  color: var(--c-purple-700);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--r-pill);
}

/* ========== Recent orders ========== */
.koo-order-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.koo-order-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}

.koo-order-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-2);
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--border-subtle);
}

.koo-order-id {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.koo-order-id strong {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--text-primary);
  word-break: break-word;
}

.koo-order-meta {
  font-size: 11.5px;
  color: var(--text-tertiary);
}

.koo-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  line-height: 1.6;
  white-space: nowrap;
  flex-shrink: 0;
}

.koo-badge-green { background: var(--c-green-50); color: var(--c-green-700); }
.koo-badge-amber { background: #fef3e2; color: var(--c-amber-600); }
.koo-badge-rose { background: var(--c-rose-50); color: var(--c-rose-500); }
.koo-badge-neutral { background: var(--c-ink-50); color: var(--text-secondary); }

.koo-order-amount {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  font-size: 13px;
  margin-bottom: 6px;
}

.koo-order-amount span {
  color: var(--text-secondary);
}

.koo-order-amount strong {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  color: var(--text-primary);
}

.koo-order-amount.discount strong {
  color: var(--brand-primary-strong);
}

.koo-app .koo-inner .koo-order-rebuy {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: var(--sp-3);
  min-height: 42px;
  border-radius: var(--r-pill);
  background: var(--c-green-50);
  color: var(--brand-primary-strong);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.koo-empty {
  text-align: center;
  font-size: 13px;
  color: var(--text-tertiary);
  padding: var(--sp-6) 0;
}

/* ========== Category / quick link grid ========== */
.koo-category-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: var(--sp-4);
}

.koo-category-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-3);
}

.koo-category-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: var(--sp-3) var(--sp-1);
  text-decoration: none;
}

.koo-app .koo-inner a.koo-category-tile:hover {
  text-decoration: none;
}

.koo-category-tile .koo-tint {
  width: 44px;
  height: 44px;
  border-radius: var(--r-pill);
}

.koo-category-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ========== Alerts ========== */
.koo-notice {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  margin-bottom: var(--sp-3);
  font-size: 12.5px;
  line-height: 1.6;
}

.koo-notice-blue {
  background: var(--c-blue-50);
  color: var(--c-blue-500);
}

.koo-notice-amber {
  background: #fef4e2;
  color: var(--c-amber-600);
}

.koo-notice p {
  margin: 0;
  flex: 1;
}

.koo-app .koo-inner .koo-notice-btn {
  flex-shrink: 0;
  border: none;
  background: currentColor;
  border-radius: var(--r-pill);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.koo-app .koo-inner .koo-notice-btn span {
  color: #fff;
}

/* ========== Loading ========== */
.koo-skel-row {
  height: 52px;
  border-radius: var(--r-md);
  margin-bottom: var(--sp-2);
}

.koo-skel-tile {
  height: 92px;
  border-radius: var(--r-md);
}

.koo-skel-card {
  height: 128px;
  border-radius: var(--r-lg);
  margin-bottom: var(--sp-3);
}

/* ========== Responsive ========== */
@media (min-width: 640px) {
  .koo-tiles {
    gap: var(--sp-3);
  }

  .koo-category-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .koo-dash-row {
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: var(--sp-5);
  }

  .koo-tiles {
    max-width: 640px;
  }

  .koo-category-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .koo-order-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
  }
}
