/* Lumen Market — marketplace-inspired category layout (original branding) */

:root {
  --orange: #ff6a00;
  --orange-dark: #e55f00;
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --line: #ebebeb;
  --bg: #f7f5f2;
  --card: #ffffff;
  --sale: #e11d48;
  --radius: 10px;
  --header-h: 112px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", "DM Sans", sans-serif;
  --shadow: 0 8px 28px rgba(26, 26, 26, 0.08);
  --chat-a: #fff4eb;
  --chat-b: #eef6ff;
  --chat-a-border: #ffd2a8;
  --chat-b-border: #b7d4f5;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button,
input,
select {
  font: inherit;
}

/* Promo */
.promo-bar {
  background: linear-gradient(90deg, #1a1a1a, #333);
  color: #fff;
  text-align: center;
  font-size: 0.8rem;
  padding: 0.45rem 1rem;
  letter-spacing: 0.02em;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem 1rem;
  align-items: center;
}

.menu-btn {
  display: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-mark {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--orange);
  box-shadow: 0 0 0 2px rgba(255, 106, 0, 0.25);
  flex-shrink: 0;
}

.brand-name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.search-form {
  display: flex;
  align-items: stretch;
  background: #f2f0ec;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.search-form:focus-within {
  background: #fff;
  border-color: var(--orange);
}

.search-form input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0.65rem 1rem;
  outline: none;
  min-width: 0;
}

.search-form button {
  border: 0;
  background: var(--orange);
  color: #fff;
  padding: 0 1rem;
  cursor: pointer;
}

.header-actions {
  display: flex;
  gap: 0.25rem;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  position: relative;
}

.icon-btn:hover {
  background: #f0eeea;
}

.cart-count {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--orange);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}

.cat-nav {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 0.65rem;
  display: flex;
  gap: 1.1rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.cat-nav::-webkit-scrollbar {
  display: none;
}

.cat-nav a {
  font-size: 0.9rem;
  color: var(--muted);
  white-space: nowrap;
  padding-bottom: 0.25rem;
  border-bottom: 2px solid transparent;
}

.cat-nav a.active,
.cat-nav a:hover {
  color: var(--ink);
  border-bottom-color: var(--orange);
}

/* Page */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.breadcrumb a:hover {
  color: var(--orange);
}

.category-hero {
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 106, 0, 0.12), transparent 50%),
    linear-gradient(135deg, #fff 0%, #f3efe8 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem 1.35rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
}

.category-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255, 106, 0, 0.08);
}

.category-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  margin: 0 0 0.35rem;
  letter-spacing: -0.03em;
  position: relative;
  z-index: 1;
}

.category-hero p {
  margin: 0;
  color: var(--muted);
  max-width: 42ch;
  position: relative;
  z-index: 1;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.chip-row {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  max-width: 100%;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.chip:hover {
  border-color: #ccc;
}

.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.sort-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.sort-label select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.55rem;
  background: #fff;
}

/* Product grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.product-card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: cardIn 0.45s ease both;
}

.product-card:nth-child(1) { animation-delay: 0.02s; }
.product-card:nth-child(2) { animation-delay: 0.06s; }
.product-card:nth-child(3) { animation-delay: 0.1s; }
.product-card:nth-child(4) { animation-delay: 0.14s; }
.product-card:nth-child(5) { animation-delay: 0.18s; }
.product-card:nth-child(6) { animation-delay: 0.22s; }
.product-card:nth-child(7) { animation-delay: 0.26s; }
.product-card:nth-child(8) { animation-delay: 0.3s; }

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.product-media {
  position: relative;
  aspect-ratio: 3 / 4;
  display: block;
  overflow: hidden;
  background: #ece8e2;
}

.product-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.product-card:hover .product-media img {
  transform: scale(1.05);
}

.badge-sale {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--sale);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  z-index: 1;
}

.product-body {
  padding: 0.75rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.product-title {
  font-size: 0.88rem;
  font-weight: 500;
  margin: 0;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.5em;
}

.badge-selection {
  display: inline-block;
  vertical-align: middle;
  margin-right: 0.3rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #c62828;
  background: #ffe8e8;
  border-radius: 3px;
  line-height: 1.2;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.price {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.12rem;
}

.sold {
  color: var(--muted);
  font-size: 0.78rem;
}

.rrp-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: #8a8a8a;
}

.rrp-help {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #cfcfcf;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

/* Temu-like Star seller badge — secret double-click unlock */
.star-seller {
  align-self: flex-start;
  margin-top: 0.15rem;
  border: 0;
  padding: 0.22rem 0.5rem;
  border-radius: 4px;
  background: linear-gradient(135deg, #6b2fd6 0%, #7c3aed 55%, #8b5cf6 100%);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: default;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.15);
  user-select: none;
  -webkit-user-select: none;
}

.star-seller::after {
  content: "";
  position: absolute;
  right: -20%;
  bottom: 0;
  width: 55%;
  height: 60%;
  background: linear-gradient(115deg, transparent, rgba(255, 255, 255, 0.35));
  transform: skewX(-20deg);
  pointer-events: none;
}

.add-btn {
  margin-top: auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 0.45rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.add-btn:hover {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.pager {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 2rem;
}

.page-btn {
  border: 1px solid var(--line);
  background: #fff;
  min-width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
}

.page-btn.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Footer */
.site-footer {
  background: #1a1a1a;
  color: #ddd;
  padding: 2.5rem 1rem 1.5rem;
  margin-top: 1rem;
}

.footer-grid {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 1.5rem;
}

.site-footer .brand-name {
  color: #fff;
}

.site-footer p {
  color: #aaa;
  font-size: 0.9rem;
  max-width: 36ch;
}

.site-footer h3 {
  color: #fff;
  font-size: 0.95rem;
  margin: 0 0 0.6rem;
}

.site-footer a {
  display: block;
  color: #aaa;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.site-footer a:hover {
  color: var(--orange);
}

.copyright {
  max-width: 1200px;
  margin: 0 auto;
  border-top: 1px solid #333;
  padding-top: 1rem;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
}

/*
 * Blended code field — looks like a quiet page control, not a “login modal”.
 * Only a plain input; submit with Enter.
 */
.code-slot {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%);
  z-index: 100;
  width: min(220px, calc(100% - 2rem));
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.code-slot[hidden] {
  display: none !important;
}

#pinForm {
  margin: 0;
}

#pinInput {
  width: 100%;
  border: 1px solid #e2e0dc;
  border-radius: 6px;
  background: #f7f5f2;
  color: #5a5a5a;
  padding: 0.45rem 0.6rem;
  font-size: 0.85rem;
  outline: none;
  box-shadow: none;
  letter-spacing: 0.04em;
}

#pinInput:focus {
  border-color: #d4d0c8;
  background: #faf9f7;
}

/* Chat panel */
.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 80;
}

.chat-backdrop[hidden] {
  display: none !important;
}

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: min(400px, 100%);
  height: 100%;
  background: #fff;
  z-index: 90;
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.chat-panel.is-open {
  transform: translateX(0);
}

.chat-panel[hidden] {
  display: none !important;
}

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.9rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #faf8f5);
}

.chat-header strong {
  display: block;
  font-family: var(--display);
}

.chat-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.sender-switch {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.sender-switch select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.2rem;
  font-size: 0.75rem;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 106, 0, 0.05), transparent 40%),
    #f6f4f1;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 2rem 1rem;
}

.msg {
  max-width: 88%;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 0.9rem;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.msg.role-a {
  align-self: flex-start;
  background: var(--chat-a);
  border-color: var(--chat-a-border);
  border-bottom-left-radius: 4px;
}

.msg.role-b {
  align-self: flex-end;
  background: var(--chat-b);
  border-color: var(--chat-b-border);
  border-bottom-right-radius: 4px;
}

.msg.mine {
  /* slight emphasis when it's "me" */
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  font-size: 0.7rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.msg-id {
  font-weight: 700;
  color: var(--ink);
}

.msg-sender {
  font-weight: 600;
}

.msg.role-a .msg-sender { color: #c2410c; }
.msg.role-b .msg-sender { color: #1d4ed8; }

.msg-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.msg-files {
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.msg-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: #0f766e;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 6px;
  padding: 0.3rem 0.45rem;
  border: 1px dashed #99f6e4;
}

.msg-file:hover {
  color: #115e59;
  border-style: solid;
}

.upload-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.8rem;
  color: var(--muted);
}

.upload-progress[hidden] {
  display: none !important;
}

.upload-progress-bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
}

.upload-progress-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--orange);
  transition: width 0.1s linear;
}

.upload-error {
  margin: 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  color: #b00020;
  background: #fff5f5;
  border-top: 1px solid #f0d0d0;
}

.upload-error[hidden] {
  display: none !important;
}

.attach-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-top: 1px solid var(--line);
  background: #faf8f5;
  font-size: 0.82rem;
}

.attach-confirm[hidden] {
  display: none !important;
}

.attach-confirm-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1;
}

.attach-confirm-label {
  color: var(--muted);
  font-size: 0.75rem;
}

.attach-confirm-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attach-confirm-size {
  color: var(--muted);
  font-size: 0.72rem;
}

.attach-confirm-actions {
  display: flex;
  gap: 0.35rem;
}

.attach-cancel-btn,
.attach-ok-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  background: #fff;
}

.attach-ok-btn {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.attach-cancel-btn:hover {
  background: #f3f1ed;
}

.attach-ok-btn:hover {
  background: var(--orange-dark);
}

.chat-composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 0.7rem;
  border-top: 1px solid var(--line);
  background: #fff;
}

.attach-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  cursor: pointer;
  color: var(--muted);
}

.attach-btn:hover {
  background: #f3f1ed;
  color: var(--ink);
}

#messageInput {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.6rem 0.9rem;
  outline: none;
  min-width: 0;
}

#messageInput:focus {
  border-color: var(--orange);
}

.send-btn {
  border: 0;
  background: var(--orange);
  color: #fff;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.6rem 1rem;
  cursor: pointer;
}

.send-btn:hover {
  background: var(--orange-dark);
}

.send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive */
@media (max-width: 960px) {
  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .menu-btn {
    display: inline-grid;
  }

  .header-inner {
    grid-template-columns: auto 1fr auto;
  }

  .search-form {
    grid-column: 1 / -1;
    order: 3;
  }

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
  }

  .add-btn {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
  }

  .cat-nav {
    gap: 0.85rem;
  }
}

@media (max-width: 380px) {
  .product-title {
    font-size: 0.85rem;
  }
}
