/**
 * TCK Shop storefront — served as /static/store/css/store.css (Nginx).
 */
:root {
  --fg: #1a1a1a;
  --muted: #666;
  --border: #e5e5e5;
  --accent: #0d6efd;
  --card-radius: 12px;
  --shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  margin: 0;
  color: var(--fg);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

/* Legacy header rules — prefer .site-header (below) */
header {
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: #fff;
}

header a.logo {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04);
}

.site-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-logo {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--fg);
  letter-spacing: 0.02em;
}

.site-logo:hover {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.35rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.nav-toggle-bar {
  display: block;
  height: 2px;
  width: 1.25rem;
  margin: 0 auto;
  background: var(--fg);
  border-radius: 1px;
}

.nav-close {
  display: none;
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.25rem;
  height: 2.25rem;
  border: none;
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
  color: #666;
}

.site-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

@media (max-width: 900px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav-backdrop {
    display: block;
  }

  .site-nav-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
  }

  .site-nav {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 110;
    height: 100vh;
    width: min(320px, 88vw);
    margin: 0;
    padding: 3rem 1.25rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    background: #fff;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
  }

  .nav-close {
    display: block;
  }
}

main,
.site-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.site-main--landing {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Toast alerts — góc phải trên, tự đóng (site.js) */
.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  left: auto;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(22rem, calc(100vw - 2rem));
  pointer-events: none;
}

@media (max-width: 480px) {
  .toast-stack {
    top: 0.65rem;
    right: 0.65rem;
    left: 0.65rem;
    max-width: none;
    align-items: stretch;
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.65rem 0.85rem 1rem;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.18);
  border: 1px solid rgba(0, 0, 0, 0.06);
  font-size: 0.9rem;
  line-height: 1.45;
  color: #0f172a;
  animation: toast-slide-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  transform: translateX(0);
  opacity: 1;
  transition: transform 0.38s ease, opacity 0.38s ease;
}

.toast--exiting {
  transform: translateX(110%);
  opacity: 0;
}

@media (max-width: 480px) {
  .toast--exiting {
    transform: translateY(-120%);
  }
}

@keyframes toast-slide-in {
  from {
    transform: translateX(110%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  @keyframes toast-slide-in {
    from {
      transform: translateY(-120%);
      opacity: 0;
    }
    to {
      transform: translateY(0);
      opacity: 1;
    }
  }
}

.toast__body {
  flex: 1;
  min-width: 0;
  padding-top: 0.1rem;
}

.toast__close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  margin: -0.25rem -0.15rem -0.25rem 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.toast__close:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #0f172a;
}

.toast--success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.toast--success .toast__body {
  color: #14532d;
}

.toast--error {
  background: #fef2f2;
  border-color: #fecaca;
}

.toast--error .toast__body {
  color: #991b1b;
}

.toast--warning {
  background: #fffbeb;
  border-color: #fde68a;
}

.toast--warning .toast__body {
  color: #92400e;
}

.toast--info,
.toast--debug {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.toast--info .toast__body,
.toast--debug .toast__body {
  color: #1e3a8a;
}

.site-footer-minimal {
  background: #111;
  color: #ccc;
  padding: 1.25rem 1.5rem;
  text-align: center;
}

.site-footer-minimal-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.site-footer-copy {
  margin: 0;
  font-size: 0.875rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Legacy .messages — dùng toast trong base.html */
.messages {
  list-style: none;
  padding: 0;
}

.messages li {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 0.5rem;
  background: #e7f5ff;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 2rem;
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.sidebar ul {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.sidebar ul ul {
  padding-left: 1rem;
  margin-top: 0.25rem;
}

.sidebar a {
  text-decoration: none;
  color: var(--fg);
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.25rem 0;
}

.sidebar a.is-selected {
  font-weight: 600;
  color: var(--accent);
}

form p {
  margin: 0.5rem 0;
}

input,
textarea,
select,
button {
  width: 100%;
  max-width: 32rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

button[type="submit"] {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  max-width: 12rem;
  margin-top: 0.5rem;
}

.hero {
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: #f8f9fa;
  border-radius: var(--card-radius);
}

.product-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

@media (max-width: 800px) {
  .product-detail {
    grid-template-columns: 1fr;
  }
}

.thumb {
  max-width: 100%;
  border-radius: var(--card-radius);
  border: 1px solid var(--border);
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Product grid + cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.product-card {
  border: 1px solid var(--border);
  border-radius: var(--card-radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.product-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.product-card-media {
  display: block;
  text-decoration: none;
  color: inherit;
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f3f4f6;
}

.product-card-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 1;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--fg);
  border: 1px solid var(--border);
}

.product-card-media-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-media-inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: #cbd5e1;
  background: linear-gradient(135deg, #f1f5f9, #e2e8f0);
}

.product-card-body {
  padding: 1rem 1.1rem 1.15rem;
}

.product-card-body .product-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}

.product-card-body h3 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.product-card-body h3 a {
  text-decoration: none;
  color: var(--fg);
}

.product-card-body h3 a:hover {
  color: var(--accent);
}

.product-card-body > p {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: #444;
}

.product-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.price-text {
  font-size: 1rem;
  color: var(--fg);
}

.price-contact {
  font-size: 0.95rem;
  color: var(--accent);
}

.text-link {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
}

/* Mobile nav (site.js) */
.nav-open {
  overflow: hidden;
}

#main-nav.is-open {
  display: flex !important;
}

#nav-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}
