/* ==========================================================================
   MARSTRON - account, cart, checkout and order pages
   Loaded after pages.css by common/header.html. Uses the tokens in style.css.
   ========================================================================== */

/* --- Header: account + cart --- */
.nav-cart-link { position: relative; color: #1e293b; }
.nav-cart-link .cart-counter[hidden] { display: none; }
.cart-counter { min-width: 18px; width: auto; padding: 0 4px; border-radius: var(--radius-pill); }

.account-menu { position: relative; }
.account-menu > summary { list-style: none; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 200px; z-index: 1100;
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg); padding: 8px; display: flex; flex-direction: column;
}
.account-dropdown a, .account-dropdown button {
  display: block; width: 100%; text-align: left; padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; color: var(--text-main); background: none; border: none;
  font-family: inherit; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.account-dropdown a:hover, .account-dropdown button:hover { background: var(--light-bg); color: var(--oneplus-red); }
.account-dropdown form { margin: 0; }
.account-dropdown hr { border: none; border-top: 1px solid var(--border-light); margin: 6px 0; }
.btn-login-nav {
  font-size: 13px; font-weight: 700; color: var(--text-main); padding: 8px 14px;
  border-radius: var(--radius-pill); border: 1px solid var(--border-light); transition: var(--transition);
  white-space: nowrap;
}
.btn-login-nav:hover { border-color: var(--oneplus-red); color: var(--oneplus-red); }
.mobile-logout-btn {
  width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 14px 24px;
  background: none; border: none; font-family: inherit; font-size: 15px; font-weight: 600;
  color: var(--oneplus-red); cursor: pointer; text-align: left;
}

/* --- Shared shop layout --- */
.shop-page { max-width: 1240px; margin: 0 auto; padding: 36px 28px 90px; min-height: 60vh; }
.shop-page.is-narrow { max-width: 880px; }
.shop-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 28px; }
.shop-eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--oneplus-red);
  margin-bottom: 6px; display: block;
}
.shop-title { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--text-main); line-height: 1.1; }
.shop-sub { font-size: 14px; color: var(--text-muted); margin-top: 6px; }
.shop-crumbs { font-size: 12px; color: var(--text-light); }
.shop-crumbs a:hover { color: var(--oneplus-red); }

.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 28px; align-items: start; }
.shop-card {
  background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-sm);
}
.shop-card + .shop-card { margin-top: 20px; }
.shop-card-title {
  font-size: 16px; font-weight: 800; letter-spacing: -0.2px; margin-bottom: 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.shop-card-title small { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.shop-sticky { position: sticky; top: 96px; }

/* --- Buttons --- */
.btn-shop {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 50px; padding: 0 28px;
  border-radius: var(--radius-pill); border: none; font-family: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer; transition: var(--transition); text-decoration: none; white-space: nowrap;
}
.btn-shop.is-block { width: 100%; }
.btn-shop.is-sm { height: 38px; padding: 0 16px; font-size: 12px; }
.btn-shop-red { background: var(--oneplus-red); color: #fff; }
.btn-shop-red:hover:not(:disabled) { background: var(--oneplus-red-hover); box-shadow: 0 10px 25px rgba(235, 0, 40, 0.3); transform: translateY(-1px); }
.btn-shop-dark { background: var(--dark-primary); color: #fff; }
.btn-shop-dark:hover:not(:disabled) { background: var(--oneplus-red); }
.btn-shop-ghost { background: #fff; color: var(--text-main); border: 1px solid var(--border-light); }
.btn-shop-ghost:hover:not(:disabled) { border-color: var(--text-main); }
.btn-shop-danger { background: #fff; color: #b91c1c; border: 1px solid #fecaca; }
.btn-shop-danger:hover:not(:disabled) { background: #fef2f2; }
.btn-shop:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-shop:focus-visible, .qty-stepper button:focus-visible, .choice-card:focus-within, .link-btn:focus-visible {
  outline: 2px solid var(--oneplus-red); outline-offset: 2px;
}
.link-btn {
  background: none; border: none; padding: 0; font-family: inherit; font-size: 12px; font-weight: 700;
  color: var(--text-muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--oneplus-red); }
.text-link { color: var(--oneplus-red); font-weight: 700; }
.text-link:hover { text-decoration: underline; }

/* --- Auth pages --- */
.auth-shell {
  max-width: 1040px; margin: 48px auto 90px; padding: 0 24px;
  display: grid; grid-template-columns: 1fr 1fr; border-radius: var(--radius-lg); overflow: hidden;
  border: 1px solid var(--border-light); box-shadow: var(--shadow-lg); background: #fff;
}
.auth-brand {
  background: radial-gradient(circle at 20% 15%, rgba(235, 0, 40, 0.35), transparent 55%), var(--dark-primary);
  color: #fff; padding: 48px 44px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-brand h2 { font-size: 34px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; margin: 16px 0 12px; }
.auth-brand p { color: #cbd5e1; font-size: 14px; line-height: 1.6; max-width: 340px; }
.auth-perks { list-style: none; display: flex; flex-direction: column; gap: 14px; font-size: 13px; color: #e2e8f0; }
.auth-perks li { display: flex; gap: 12px; align-items: center; }
.auth-perks span {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, 0.08);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #ff4766; font-weight: 800;
}
.auth-panel { padding: 48px 44px; display: flex; flex-direction: column; justify-content: center; }
.auth-panel h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.6px; }
.auth-panel .shop-sub { margin-bottom: 28px; }
.auth-form { display: flex; flex-direction: column; gap: 18px; }
.auth-form[hidden] { display: none; }
.auth-form .form-grid { gap: 18px; }
.auth-foot { margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border-light); font-size: 13px; color: var(--text-muted); text-align: center; }
.auth-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.auth-row a { color: var(--text-muted); font-weight: 600; }
.auth-row a:hover { color: var(--oneplus-red); }
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 64px; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none;
  font-family: inherit; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase;
  color: var(--text-muted); cursor: pointer; padding: 8px;
}
.pw-toggle:hover { color: var(--oneplus-red); }
.auth-steps { display: flex; gap: 8px; margin-bottom: 24px; }
.auth-steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--border-light); transition: background 0.3s; }
.auth-steps span.is-done { background: var(--oneplus-red); }

/* --- Cart --- */
.cart-line {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 18px; align-items: center;
  padding: 18px 0; border-bottom: 1px solid #f1f5f9;
}
.cart-line:first-child { padding-top: 0; }
.cart-line:last-child { border-bottom: none; padding-bottom: 0; }
.cart-line-media { width: 96px; height: 96px; border-radius: var(--radius-md); background: var(--light-bg); overflow: hidden; display: block; }
.cart-line-media img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-name { font-size: 15px; font-weight: 700; color: var(--text-main); line-height: 1.35; }
.cart-line-name:hover { color: var(--oneplus-red); }
.cart-line-price { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.cart-line-price strong { font-size: 15px; font-weight: 800; }
.cart-line-price s { font-size: 12px; color: var(--text-light); }
.cart-line-actions { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.cart-line-total { font-size: 17px; font-weight: 800; text-align: right; white-space: nowrap; }
.save-chip {
  font-size: 10px; font-weight: 800; color: #047857; background: #ecfdf5; padding: 2px 8px;
  border-radius: var(--radius-pill); letter-spacing: 0.3px;
}
.qty-stepper {
  display: inline-flex; align-items: center; border: 1px solid var(--border-light);
  border-radius: var(--radius-pill); overflow: hidden; background: #fff;
}
.qty-stepper button {
  width: 34px; height: 34px; border: none; background: none; font-size: 16px; font-weight: 700;
  color: var(--text-main); cursor: pointer; transition: background 0.2s;
}
.qty-stepper button:hover:not(:disabled) { background: var(--light-bg); }
.qty-stepper button:disabled { color: var(--text-light); cursor: not-allowed; }
.qty-stepper output, .qty-stepper span { min-width: 30px; text-align: center; font-size: 13px; font-weight: 800; }
.cart-line.is-busy { opacity: 0.5; pointer-events: none; }

/* --- Summary --- */
.sum-rows { display: flex; flex-direction: column; gap: 12px; font-size: 13px; color: var(--text-muted); }
.sum-row { display: flex; justify-content: space-between; gap: 12px; }
.sum-row strong { color: var(--text-main); font-weight: 700; }
.sum-row.is-save strong, .sum-row.is-save { color: #047857; }
.sum-total {
  display: flex; justify-content: space-between; align-items: baseline; margin-top: 16px; padding-top: 16px;
  border-top: 1px dashed var(--border-light); font-size: 15px; font-weight: 800;
}
.sum-total span:last-child { font-size: 24px; letter-spacing: -0.5px; }
.sum-note { font-size: 12px; color: var(--text-light); margin: 14px 0 18px; line-height: 1.5; }
.trust-mini { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid #f1f5f9; font-size: 12px; color: var(--text-muted); font-weight: 600; }
.trust-mini div { display: flex; gap: 10px; align-items: center; }
.trust-mini span[aria-hidden] { color: var(--oneplus-red); }

/* --- Checkout --- */
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.choice-card {
  position: relative; display: block; padding: 16px 16px 16px 46px; border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md); cursor: pointer; transition: border-color 0.2s, background 0.2s; background: #fff;
}
.choice-card:hover { border-color: #cbd5e1; }
.choice-card input { position: absolute; left: 16px; top: 18px; accent-color: var(--oneplus-red); width: 16px; height: 16px; }
.choice-card:has(input:checked) { border-color: var(--oneplus-red); background: var(--oneplus-red-soft); }
.choice-card strong { display: block; font-size: 13px; font-weight: 800; color: var(--text-main); margin-bottom: 4px; }
.choice-card span { display: block; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.choice-grid.is-stack { grid-template-columns: 1fr; }
.add-address-box { margin-top: 16px; padding-top: 20px; border-top: 1px dashed var(--border-light); }
.add-address-box[hidden] { display: none; }
.add-address-box .form-grid { gap: 14px; }
.add-address-box .form-control { height: 44px; }
.mini-lines { display: flex; flex-direction: column; gap: 14px; max-height: 300px; overflow-y: auto; padding-right: 4px; margin-bottom: 18px; }
.mini-line { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 12px; align-items: center; font-size: 13px; }
.mini-line img { width: 52px; height: 52px; border-radius: var(--radius-sm); object-fit: cover; background: var(--light-bg); }
.mini-line-name { font-weight: 700; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-line small { display: block; color: var(--text-light); font-size: 11px; margin-top: 2px; }
.mini-line b { font-weight: 800; white-space: nowrap; }
.alert-box {
  padding: 14px 16px; border-radius: var(--radius-md); font-size: 13px; font-weight: 600; margin-bottom: 20px;
  background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca;
}
.alert-box.is-warn { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-box a { text-decoration: underline; }

/* --- Empty state --- */
.shop-empty { text-align: center; padding: 70px 24px; max-width: 480px; margin: 0 auto; }
.shop-empty-icon {
  width: 84px; height: 84px; margin: 0 auto 22px; border-radius: 50%; background: var(--light-bg);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.shop-empty h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 8px; }
.shop-empty p { font-size: 14px; color: var(--text-muted); margin-bottom: 26px; }

/* --- Orders --- */
.order-list { display: flex; flex-direction: column; gap: 16px; }
.order-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius-lg); overflow: hidden; transition: var(--transition); }
.order-card:hover { box-shadow: var(--shadow-md); }
.order-card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px;
  padding: 16px 22px; background: #f8fafc; border-bottom: 1px solid var(--border-light);
}
.order-meta { display: flex; flex-wrap: wrap; gap: 28px; font-size: 12px; color: var(--text-muted); }
.order-meta b { display: block; color: var(--text-main); font-size: 14px; font-weight: 800; margin-top: 2px; }
.order-no { font-family: var(--font-mono); }
.order-card-body { padding: 18px 22px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; background: #f1f5f9; color: #334155;
}
.status-pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.is-ok { background: #ecfdf5; color: #047857; }
.status-pill.is-wait { background: #fffbeb; color: #b45309; }
.status-pill.is-move { background: #eff6ff; color: #1d4ed8; }
.status-pill.is-bad { background: #fef2f2; color: #b91c1c; }

.order-hero {
  background: var(--dark-primary); color: #fff; border-radius: var(--radius-lg); padding: 28px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px; margin-bottom: 20px;
}
.order-hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; font-family: var(--font-mono); }
.order-hero p { color: #94a3b8; font-size: 13px; margin-top: 4px; }
.order-hero-pills { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; font-size: 12px; color: #94a3b8; }
.order-hero-pills div { display: flex; align-items: center; gap: 8px; }

.timeline { list-style: none; position: relative; padding-left: 26px; display: flex; flex-direction: column; gap: 18px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--border-light); }
.timeline li { position: relative; }
.timeline li::before {
  content: ''; position: absolute; left: -26px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 3px solid var(--oneplus-red);
}
.timeline li:last-child::before { background: var(--oneplus-red); }
.timeline strong { display: block; font-size: 13px; font-weight: 800; text-transform: capitalize; }
.timeline span { font-size: 12px; color: var(--text-muted); }

/* --- Success --- */
.success-mark {
  width: 88px; height: 88px; margin: 0 auto 24px; border-radius: 50%; background: #ecfdf5; color: #059669;
  display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 800;
  box-shadow: 0 0 0 10px rgba(16, 185, 129, 0.08);
}
.success-mark.is-wait { background: #fffbeb; color: #b45309; box-shadow: 0 0 0 10px rgba(245, 158, 11, 0.1); }
.receipt {
  max-width: 440px; margin: 0 auto 28px; text-align: left; border: 1px solid var(--border-light);
  border-radius: var(--radius-md); padding: 18px 20px; background: #f8fafc;
}

/* --- Product details: buy actions --- */
.pdp-buy-row { display: flex; flex-direction: column; gap: 10px; }
.pdp-buy-row .btn-shop, .pdp-dealer-btn { border-radius: 14px; height: 48px; font-size: 13px; font-weight: 800; }
.pdp-qty-row { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* --- Loading --- */
.shop-loading { text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 13px; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border-light); border-top-color: var(--oneplus-red);
  margin: 0 auto 12px; animation: shopSpin 0.8s linear infinite;
}
@keyframes shopSpin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
  .btn-shop, .order-card { transition: none; }
}

/* --- Responsive --- */
/* Make room for cart + account in the header; "Warranty Registration" stays in the nav links. */
@media (min-width: 993px) and (max-width: 1280px) {
  .btn-warranty-nav { display: none; }
  .nav-actions { gap: 10px; }
}
@media (max-width: 1024px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-sticky { position: static; }
}
@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; margin-top: 24px; }
  .auth-brand { padding: 32px 28px; gap: 20px; }
  .auth-brand h2 { font-size: 26px; }
  .auth-perks { display: none; }
  .auth-panel { padding: 32px 28px; }
}
@media (max-width: 640px) {
  .shop-page { padding: 24px 16px 70px; }
  .shop-title { font-size: 26px; }
  .shop-card { padding: 18px; border-radius: var(--radius-md); }
  .auth-shell { padding: 0; margin: 0 0 60px; border-radius: 0; border-left: none; border-right: none; }
  .cart-line { grid-template-columns: 76px minmax(0, 1fr); }
  .cart-line-media { width: 76px; height: 76px; }
  .cart-line-total { grid-column: 2; text-align: left; }
  .choice-grid { grid-template-columns: 1fr; }
  .order-meta { gap: 18px; }
  .order-hero-pills { align-items: flex-start; }
  .btn-login-nav { display: none; }
}

/* --- Product cards: wishlist heart + add to cart --- */
.wish-btn {
  position: absolute; top: 10px; right: 10px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border-light);
  background: rgba(255, 255, 255, 0.92); color: #475569; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); transition: transform 0.15s, color 0.2s, background 0.2s;
}
.wish-btn svg, .pdp-wish-btn svg {
  width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round;
}
.wish-btn:hover { color: var(--oneplus-red); transform: scale(1.08); }
.wish-btn.is-active, .pdp-wish-btn.is-active { color: var(--oneplus-red); }
.wish-btn.is-active svg, .pdp-wish-btn.is-active svg { fill: currentColor; }
.wish-btn:disabled, .card-cart-btn:disabled { opacity: 0.6; cursor: progress; }
.wish-btn:focus-visible, .card-cart-btn:focus-visible { outline: 2px solid var(--oneplus-red); outline-offset: 2px; }
.mini-card .wish-btn { top: 8px; right: 8px; width: 32px; height: 32px; }

.card-cart-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 14px; border-radius: 6px; border: none; cursor: pointer;
  background: var(--oneplus-red); color: #fff; font-family: inherit; font-size: 13px; font-weight: 700;
  transition: background 0.2s, transform 0.15s;
}
.card-cart-btn:hover:not(:disabled) { background: var(--oneplus-red-hover); transform: translateY(-1px); }
.card-cart-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.card-cart-btn .card-cart-done { display: none; }
.card-cart-btn.is-done { background: #047857; }
.card-cart-btn.is-done .card-cart-label, .card-cart-btn.is-done svg { display: none; }
.card-cart-btn.is-done .card-cart-done { display: inline; }
.mini-card .card-cart-btn { width: 100%; margin-top: 8px; padding: 8px 10px; font-size: 12px; }

.pdp-wish-btn { border-radius: 14px; height: 46px; font-size: 13px; font-weight: 800; }
.pdp-wish-btn.is-active { border-color: #fecdd3; background: #fff1f2; }

/* --- Wishlist page --- */
.wish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.wish-oos { display: block; margin-top: 8px; font-size: 12px; font-weight: 700; color: #b91c1c; }

@media (max-width: 640px) {
  .wish-btn { width: 32px; height: 32px; top: 8px; right: 8px; }
  .card-cart-btn { padding: 8px 10px; }
  .card-cart-btn .card-cart-label { display: none; }   /* icon-only on small cards */
  .card-cart-btn.is-done .card-cart-done { font-size: 11px; }
  .wish-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}
