/* TTACart - Playwright practice e-commerce clone
   Self-contained styles. TTA-branded end-to-end checkout flow.
   No external CSS; mono+sans fonts pulled via Google Fonts link in each HTML.
   TTACart is intentionally light-mode only - parent dark theme does NOT cascade
   here because all colors below are explicit, not driven by CSS vars from the
   host site's theme.css. */

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

/* Force light color-scheme so user agent stylesheets (form controls, scrollbars)
   stay light even if the OS prefers dark. */
:root { color-scheme: light; }

:root {
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --tta-green: #10b981;
  --tta-green-strong: #0e8f70;
  --tta-green-soft: #d1fae5;
  --tta-green-bg: #e8faef;
  --ink: #181717;
  --ink-soft: #2d2d2d;
  --muted: #6b6963;
  --line: #d9d5cc;
  --line-strong: #b8b3a5;
  --surface: #ffffff;
  --error: #e02f3a;
  --footer-bg: #112016;
}

html, body { height: 100%; }
body {
  font-family: var(--mono);
  color: var(--ink);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ----------------- Top bar ----------------- */
.tta-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  min-height: 64px;
  position: relative;
}
.tta-topbar .menu-btn,
.tta-topbar .cart-btn {
  background: transparent;
  border: 0;
  padding: 6px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.tta-topbar .menu-btn svg,
.tta-topbar .cart-btn svg { width: 26px; height: 26px; }
.tta-topbar .cart-btn { position: relative; }
.cart-badge {
  position: absolute;
  top: -4px; right: -8px;
  background: var(--error);
  color: #fff;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}
.tta-brand-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}

/* ----------------- Side menu (drawer) ----------------- */
.side-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 280px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 60;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  padding: 60px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.side-menu.is-open { transform: translateX(0); }
.side-menu a {
  color: var(--tta-green-strong);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.side-menu a:hover { color: var(--tta-green); }
.side-menu .close-menu {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: 0;
  font-size: 1.5rem;
  color: var(--ink);
}
.side-menu-backdrop {
  position: fixed; inset: 0;
  background: rgba(20, 18, 14, 0.4);
  z-index: 55;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.side-menu-backdrop.is-open { opacity: 1; pointer-events: auto; }

/* ----------------- Sub-header (page title bar) ----------------- */
.sub-header {
  padding: 22px 28px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.sub-header .sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.95rem;
  background: var(--surface);
}
.sub-header .sort-wrap svg { width: 14px; height: 14px; }
.sub-header select {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 24px;
}

/* ----------------- Main flex grow ----------------- */
.main { flex: 1; padding: 24px 28px 40px; }
.container-narrow { max-width: 1280px; margin: 0 auto; }

/* ----------------- Login ----------------- */
.login-shell {
  flex: 1;
  background: var(--tta-green-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 56px;
}
.login-shell .tta-brand-title { font-size: 2rem; letter-spacing: 0.1em; margin-bottom: 28px; }
.login-card {
  background: var(--surface);
  width: min(880px, calc(100% - 32px));
  padding: 56px 100px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.login-card .field {
  margin-bottom: 18px;
}
.login-card input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 0;
  font: inherit;
  font-family: var(--mono);
  font-size: 1rem;
  background: transparent;
  color: var(--ink);
  outline: none;
}
.login-card input::placeholder { color: var(--muted); }
.login-card input:focus { border-bottom-color: var(--tta-green); }
.login-card .login-btn {
  width: 100%;
  margin-top: 30px;
  padding: 14px 18px;
  background: var(--tta-green);
  color: var(--ink);
  border: 0;
  border-radius: 6px;
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1rem;
}
.login-card .login-btn:hover { background: var(--tta-green-strong); color: #fff; }
.login-error {
  background: var(--error);
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.84rem;
  margin-bottom: 14px;
  display: none;
}
.login-error.is-visible { display: block; }
.login-hint {
  width: min(880px, calc(100% - 32px));
  background: var(--footer-bg);
  color: #fff;
  padding: 22px 100px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  font-size: 0.84rem;
}
.login-hint h4 { margin-bottom: 10px; font-family: var(--mono); }
.login-hint p { font-family: var(--mono); line-height: 1.7; }
@media (max-width: 720px) {
  .login-card, .login-hint { padding: 36px 24px; grid-template-columns: 1fr; }
}

/* ----------------- Inventory grid ----------------- */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}
@media (max-width: 900px) { .inventory-grid { grid-template-columns: 1fr; } }

.inventory-item {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.inventory-item .item-img {
  width: 200px; height: 200px;
  background: var(--tta-green-bg);
  border-radius: 6px;
  display: grid; place-items: center;
  overflow: hidden;
}
.inventory-item .item-img svg { width: 80%; height: 80%; }
.inventory-item .item-body {
  display: flex; flex-direction: column; gap: 8px;
  font-family: var(--mono);
}
.inventory-item .item-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--tta-green-strong);
}
.inventory-item .item-name a { color: inherit; }
.inventory-item .item-name a:hover { color: var(--tta-green); }
.inventory-item .item-desc { color: var(--ink); font-size: 0.9rem; line-height: 1.55; flex: 1; }
.inventory-item .item-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin-top: 10px;
}
.inventory-item .item-price { font-weight: 700; font-size: 1.05rem; }
.inventory-item .item-btn {
  padding: 9px 20px;
  border: 1px solid var(--ink);
  background: var(--surface);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--ink);
}
.inventory-item .item-btn.is-remove { color: var(--error); border-color: var(--error); }
.inventory-item .item-btn:hover { background: var(--tta-green-bg); }

/* ----------------- Inventory item detail ----------------- */
.detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 30px;
}
@media (max-width: 720px) { .detail-row { grid-template-columns: 1fr; } }
.detail-row .item-img {
  width: 100%;
  background: var(--tta-green-bg);
  border-radius: 8px;
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  padding: 24px;
}
.detail-row .item-img svg { width: 100%; height: 100%; }
.detail-body h2 {
  font-family: var(--mono);
  color: var(--tta-green-strong);
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: 14px;
}
.detail-body p { font-family: var(--mono); line-height: 1.7; margin-bottom: 18px; font-size: 0.92rem; }
.detail-body .detail-foot { display: flex; align-items: center; gap: 18px; }
.detail-body .item-price { font-family: var(--mono); font-size: 1.4rem; font-weight: 700; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--ink);
  border-radius: 4px;
  padding: 8px 16px;
  font-family: var(--mono);
  font-size: 0.9rem;
  color: var(--ink);
  margin-bottom: 18px;
}
.back-btn:hover { background: var(--tta-green-bg); }

/* ----------------- Cart ----------------- */
.cart-list { display: flex; flex-direction: column; gap: 0; }
.cart-row-head, .cart-row {
  display: grid;
  grid-template-columns: 80px 1fr 100px;
  gap: 22px;
  padding: 14px 22px;
  align-items: start;
  font-family: var(--mono);
}
.cart-row-head { border-bottom: 1px solid var(--line); font-weight: 700; }
.cart-row { border: 1px solid var(--line); border-radius: 6px; margin-bottom: 12px; padding: 22px; align-items: center; }
.cart-row .qty {
  display: inline-grid;
  place-items: center;
  width: 36px; height: 36px;
  border: 1px solid var(--ink);
  border-radius: 4px;
  font-family: var(--mono);
  font-weight: 700;
}
.cart-row .cart-desc-block .cart-name {
  font-weight: 700;
  color: var(--tta-green-strong);
  font-size: 1.05rem;
  margin-bottom: 6px;
}
.cart-row .cart-desc-block .cart-desc {
  font-size: 0.9rem;
  margin-bottom: 12px;
  line-height: 1.55;
}
.cart-row .cart-desc-block .cart-price { font-weight: 700; }
.cart-row .remove-cell { text-align: right; }
.cart-row .btn-remove {
  border: 1px solid var(--error);
  color: var(--error);
  background: transparent;
  padding: 8px 16px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.86rem;
}
.cart-row .btn-remove:hover { background: rgba(224, 47, 58, 0.08); }
.cart-actions {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}
.btn-continue, .btn-primary {
  padding: 12px 20px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.92rem;
  border: 1px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn-continue:hover { background: var(--tta-green-bg); }
.btn-primary { background: var(--tta-green); border-color: var(--tta-green); color: var(--ink); }
.btn-primary:hover { background: var(--tta-green-strong); color: #fff; }

/* ----------------- Checkout step 1 ----------------- */
.checkout-form-wrap {
  display: grid;
  place-items: center;
  padding: 40px 28px;
}
.checkout-form {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-family: var(--mono);
}
.checkout-form input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line-strong);
  padding: 10px 0;
  font: inherit;
  font-size: 0.96rem;
  outline: none;
  background: transparent;
}
.checkout-form input:focus { border-bottom-color: var(--tta-green); }
.checkout-form input::placeholder { color: var(--muted); }
.checkout-error {
  background: var(--error);
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.84rem;
  display: none;
}
.checkout-error.is-visible { display: block; }
.form-actions {
  display: flex; justify-content: space-between;
  padding: 24px 28px 0;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}

/* ----------------- Checkout step 2 (overview) ----------------- */
.summary-block {
  margin-top: 28px;
  display: grid;
  gap: 18px;
  font-family: var(--mono);
}
.summary-block h4 {
  font-weight: 700;
  margin-bottom: 6px;
  font-family: var(--mono);
}
.summary-totals { margin-top: 14px; }
.summary-totals .row { display: flex; gap: 8px; padding: 2px 0; }
.summary-totals .total-row { font-weight: 700; margin-top: 6px; }

/* ----------------- Checkout complete ----------------- */
.complete-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 60px 24px;
}
.complete-shell svg.tick {
  width: 96px; height: 96px;
  color: var(--tta-green);
  margin-bottom: 22px;
}
.complete-shell h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 1.5rem;
  margin-bottom: 14px;
}
.complete-shell p {
  font-family: var(--mono);
  color: var(--ink);
  max-width: 380px;
  line-height: 1.55;
  margin-bottom: 28px;
}

/* ----------------- Footer ----------------- */
.tta-footer {
  background: var(--footer-bg);
  color: #fff;
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 0.78rem;
  margin-top: auto;
}
.tta-footer .socials {
  display: inline-flex; gap: 12px; margin-right: auto;
}
.tta-footer .socials a {
  width: 32px; height: 32px;
  display: inline-grid; place-items: center;
  background: var(--tta-green);
  color: var(--ink);
  border-radius: 50%;
}
.tta-footer .socials a:hover { background: #fff; }
.tta-footer .socials svg { width: 16px; height: 16px; }
.tta-footer a { color: #fff; text-decoration: none; }

/* ----------------- Visual-user drift ----------------- */
body.visual-user .cart-btn { transform: translateX(8px); }
body.visual-user .btn-primary { background: #2dd4bf; border-color: #2dd4bf; }

/* ----------------- Problem-user image swap ----------------- */
body.problem-user .item-img svg.problem-swap { filter: hue-rotate(180deg) saturate(1.5); }
