/*
 * Hosted auth + account yüzeyi stilleri (feature 26-06-03 + 26-06-09; görsel
 * refactor 26-06-09). `@fastify/static` ile `/account/assets/auth.css` altından
 * servis edilir; inline <script> yasak (CSP `script-src 'self'`). Brand birincil
 * rengi view-model'den CSS custom property olarak (`--brand-primary`) gelir —
 * kabukta hex-validated, auto-escape edilmiş inline `style` ATTRIBUTE'u ile
 * override edilir (ham brand içeren inline <style> bloğu değil).
 *
 * İki kabuk: AUTH (login/register/forgot/reset — ortalanmış kart) ve ACCOUNT
 * (profil/siparişler/adresler/şifre — ortalanmış kabuk + header + sol sidebar).
 */

:root {
  /* Brand accent — mağaza başına inline `style` ile override edilir. */
  --brand-primary: #111827;
  --brand-on-primary: #ffffff;

  --c-text: #1f2430;
  --c-heading: #111521;
  --c-muted: #6b7280;
  --c-subtle: #98a2b3;
  --c-bg: #f3f4f6;
  --c-surface: #ffffff;
  --c-surface-2: #f9fafb;
  --c-border: #e6e8ec;
  --c-border-strong: #d7dae0;

  --c-error-bg: #fef3f2;
  --c-error-text: #b42318;
  --c-error-border: #fecdca;
  --c-flash-bg: #ecfdf3;
  --c-flash-text: #067647;
  --c-flash-border: #abefc6;

  /* durum pill tonları */
  --tone-success-bg: #ecfdf3;  --tone-success-text: #067647;
  --tone-info-bg:    #eff4ff;  --tone-info-text:    #1849a9;
  --tone-warning-bg: #fffaeb;  --tone-warning-text: #b54708;
  --tone-danger-bg:  #fef3f2;  --tone-danger-text:  #b42318;
  --tone-neutral-bg: #f2f4f7;  --tone-neutral-text: #475467;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-pill: 999px;
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow-raise: 0 6px 18px rgba(16, 24, 40, 0.08);

  --container: 960px;
  --side-w: 208px;
  --gutter: clamp(16px, 4vw, 32px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* --font: aktif vitrine temasının fontu (inline ezme); yoksa nötr sistem yığını. */
  font-family: var(--font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--brand-primary);
}

/* ════════════════════════════════════════════════════════════════════════════
   AUTH kabuğu (ortalanmış kart) — login / register / forgot / reset
   ════════════════════════════════════════════════════════════════════════════ */

.auth-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: var(--gutter);
}

.auth-card {
  width: 100%;
  max-width: 26rem;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-raise);
}

/* "← Mağazaya dön" — kartın üstünde, sola yaslı sade link (storefront ana sayfası). */
.auth-back {
  display: inline-block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
}

.auth-back:hover {
  color: var(--brand-primary);
}

.auth-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.75rem;
}

/* Logo/ad ana sayfaya bağlanır — tıklanır marka (mağazaya dön). */
.auth-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.auth-logo {
  max-height: 3rem;
  max-width: 100%;
  object-fit: contain;
}

.auth-store-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--c-heading);
}

.auth-title {
  margin: 0 0 1.25rem;
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  color: var(--c-heading);
  letter-spacing: -0.01em;
}

/* ── banners (auth + account ortak) ──────────────────────────────────────── */

.auth-banner {
  margin: 0 0 1rem;
  padding: 0.7rem 0.95rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
}

.auth-banner--error {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border-color: var(--c-error-border);
}

.auth-banner--flash {
  background: var(--c-flash-bg);
  color: var(--c-flash-text);
  border-color: var(--c-flash-border);
}

/* ── forms (auth + account ortak) ────────────────────────────────────────── */

.auth-form {
  display: flex;
  flex-direction: column;
}

.auth-label {
  margin: 0.85rem 0 0.3rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-heading);
}

.auth-optional {
  color: var(--c-muted);
  font-weight: 400;
}

.auth-input {
  width: 100%;
  height: 44px;
  padding: 0 0.85rem;
  font-size: 1rem;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.auth-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-primary) 18%, transparent);
}

.auth-input:disabled {
  background: var(--c-surface-2);
  color: var(--c-muted);
  cursor: not-allowed;
}

.auth-button {
  margin-top: 1.5rem;
  height: 46px;
  padding: 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--brand-on-primary);
  background: var(--brand-primary);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: filter 0.12s ease;
}

.auth-button:hover {
  filter: brightness(0.93);
}

.auth-button:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.auth-links {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.9375rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.auth-links a {
  color: var(--brand-primary);
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.account-checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.85rem;
  font-size: 0.9375rem;
}

/* ── register pazarlama (ticari ileti) onayı (feature 26-06-21) ──────────────── */

/* onay kutusu + kısa etiket (daima işaretsiz; KVKK/İYS) */
.auth-consent {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-top: 1.1rem;
  font-size: 0.875rem;
  color: var(--c-text);
  cursor: pointer;
}

.auth-consent input[type="checkbox"] {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

/* KVKK aydınlatma bilgilendirme notu (onay kutusu değil; checkout deseni). */
.auth-consent-note {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* onay metni disclosure (<details>) — plaintext, escaped */
.auth-consent-disclosure {
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.auth-consent-disclosure > summary {
  cursor: pointer;
  color: var(--c-muted);
  font-weight: 500;
}

.auth-consent-disclosure > summary:hover {
  color: var(--brand-primary);
}

.auth-consent-text {
  margin-top: 0.5rem;
  padding: 0.7rem 0.85rem;
  max-height: 12rem;
  overflow-y: auto;
  white-space: pre-wrap;
  color: var(--c-muted);
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════════════════════════════════════
   ACCOUNT kabuğu — ortalanmış kabuk + header + sol sidebar + içerik
   ════════════════════════════════════════════════════════════════════════════ */

.acc-body {
  min-height: 100vh;
}

/* ── ortalanmış kabuk (full-bleed DEĞİL) ─────────────────────────────────── */

.acc-shell {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(0.75rem, 2.5vw, 1.5rem) var(--gutter) 4rem;
}

/* ── header şeridi (container-içi: logo solda, Çıkış sağda) ───────────────── */

.acc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  padding: 1.1rem 0;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  border-bottom: 1px solid var(--c-border);
}

/* sol grup: marka (logo/ad) + "← Mağazaya dön" linki yan yana */
.acc-header-left {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
  min-width: 0;
}

.acc-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  flex-shrink: 0;
}

/* header şeridindeki "← Mağazaya dön" (page-içi `.acc-back`'ten ayrı). */
.acc-topback {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  white-space: nowrap;
}

.acc-topback:hover {
  color: var(--brand-primary);
}

.acc-logo {
  max-height: 2.25rem;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.acc-store-name {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-heading);
}

.acc-logout {
  margin: 0;
  flex-shrink: 0;
}

.acc-logout-btn {
  height: 38px;
  padding: 0 0.95rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--c-text);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.acc-logout-btn:hover {
  background: var(--c-surface-2);
  border-color: var(--c-muted);
}

.acc-logout-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

/* ── sidebar + içerik gridi ──────────────────────────────────────────────── */

.acc-layout {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: start;
}

/* ── sol dikey nav (masaüstünde sticky) ──────────────────────────────────── */

.acc-side {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  position: sticky;
  top: 1.5rem;
}

.acc-side-link {
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.acc-side-link:hover {
  color: var(--c-heading);
  background: var(--c-surface-2);
}

.acc-side-link:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.acc-side-link.is-active {
  color: var(--brand-primary);
  background: color-mix(in srgb, var(--brand-primary) 9%, transparent);
  border-left-color: var(--brand-primary);
  font-weight: 600;
}

/* ── main / page head ────────────────────────────────────────────────────── */

.acc-main {
  min-width: 0;
}

.acc-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin-bottom: 1.5rem;
}

.acc-page-title {
  margin: 0;
  font-size: clamp(1.4rem, 3.5vw, 1.85rem);
  font-weight: 700;
  color: var(--c-heading);
  letter-spacing: -0.02em;
}

.acc-page-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  width: 100%;
  font-size: 0.9375rem;
  color: var(--c-muted);
}

.acc-back {
  flex-basis: 100%;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--c-muted);
}

.acc-back:hover {
  color: var(--brand-primary);
}

/* ── cards ───────────────────────────────────────────────────────────────── */

.acc-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: clamp(1.1rem, 3vw, 1.5rem);
}

.acc-card--flush {
  padding: 0;
  overflow: hidden;
}

.acc-form-card {
  max-width: 34rem;
}

.acc-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.acc-card-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-heading);
}

.acc-card-action {
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--brand-primary);
  white-space: nowrap;
}

.acc-card-action:hover {
  text-decoration: underline;
}

.acc-meta {
  margin: 1rem 0 0;
  font-size: 0.8125rem;
  color: var(--c-subtle);
}

.acc-empty {
  margin: 0;
  color: var(--c-muted);
  font-size: 0.9375rem;
}

.acc-empty-card {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

/* ── layout grids ────────────────────────────────────────────────────────── */

.acc-grid {
  display: grid;
  gap: 1.25rem;
}

.acc-grid--2 {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: start;
}

.acc-grid--detail {
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  align-items: start;
}

.acc-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.acc-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1rem;
}

.acc-form-col {
  display: flex;
  flex-direction: column;
}

/* ── buttons / inline links ──────────────────────────────────────────────── */

.acc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 42px;
  padding: 0 1.1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
}

.acc-btn:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
}

.acc-btn--primary {
  color: var(--brand-on-primary);
  background: var(--brand-primary);
}

.acc-btn--primary:hover {
  filter: brightness(0.93);
}

.acc-btn--ghost {
  color: var(--c-text);
  background: var(--c-surface);
  border-color: var(--c-border-strong);
}

.acc-btn--ghost:hover {
  background: var(--c-surface-2);
}

.acc-more {
  display: inline-flex;
  margin-top: 1.25rem;
}

.acc-page-head .acc-btn {
  margin-left: auto;
}

.acc-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--brand-primary);
  text-decoration: none;
  cursor: pointer;
}

.acc-link:hover {
  text-decoration: underline;
}

.acc-link--danger {
  color: var(--c-error-text);
}

.acc-strong {
  font-weight: 600;
  color: var(--c-heading);
}

.acc-muted {
  color: var(--c-muted);
}

.acc-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ── status pills ────────────────────────────────────────────────────────── */

.pill {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.pill--success { background: var(--tone-success-bg); color: var(--tone-success-text); }
.pill--info    { background: var(--tone-info-bg);    color: var(--tone-info-text); }
.pill--warning { background: var(--tone-warning-bg); color: var(--tone-warning-text); }
.pill--danger  { background: var(--tone-danger-bg);  color: var(--tone-danger-text); }
.pill--neutral { background: var(--tone-neutral-bg); color: var(--tone-neutral-text); }

/* ── dashboard recent-orders list ────────────────────────────────────────── */

.acc-order-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.acc-order-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.25rem 0.75rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--c-text);
  transition: border-color 0.12s ease, background 0.12s ease;
}

.acc-order-item:hover {
  border-color: var(--c-border-strong);
  background: var(--c-surface-2);
}

.acc-order-no {
  font-weight: 600;
  color: var(--c-heading);
}

.acc-order-date {
  font-size: 0.8125rem;
  color: var(--c-muted);
}

.acc-order-item .pill {
  justify-self: start;
}

.acc-order-total {
  grid-column: 3;
  grid-row: 1 / span 2;
  align-self: center;
  font-weight: 600;
  color: var(--c-heading);
}

/* ── tables (orders list + order items) ──────────────────────────────────── */

.acc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.acc-table thead th {
  text-align: left;
  padding: 0.75rem 1.1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--c-muted);
  background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border);
}

.acc-table tbody td {
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
}

.acc-table tbody tr:last-child td {
  border-bottom: none;
}

.acc-table th.acc-num,
.acc-table td.acc-num {
  text-align: right;
}

.acc-items {
  font-size: 0.9375rem;
}

/* ── totals ──────────────────────────────────────────────────────────────── */

.acc-totals {
  margin: 0;
  padding: 1.1rem;
  border-top: 1px solid var(--c-border);
}

.acc-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.25rem 0;
  font-size: 0.9375rem;
}

.acc-totals dt,
.acc-totals dd {
  margin: 0;
}

.acc-totals dd {
  font-variant-numeric: tabular-nums;
}

.acc-totals-grand {
  margin-top: 0.4rem;
  padding-top: 0.6rem !important;
  border-top: 1px solid var(--c-border);
  font-size: 1.05rem !important;
  font-weight: 700;
  color: var(--c-heading);
}

/* ── addresses ───────────────────────────────────────────────────────────── */

.acc-address-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1.1rem;
}

.acc-address-card {
  position: relative;
  display: flex;
  flex-direction: column;
}

.acc-default {
  align-self: flex-start;
  margin-bottom: 0.6rem;
}

.acc-address-body {
  flex: 1 1 auto;
}

.acc-address-line {
  margin: 0 0 0.15rem;
  font-size: 0.9375rem;
  color: var(--c-text);
}

.acc-address-line:first-child {
  font-weight: 600;
  color: var(--c-heading);
}

.acc-address-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--c-border);
}

.acc-inline-form {
  margin: 0;
}

.acc-note {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--c-text);
}

/* ════════════════════════════════════════════════════════════════════════════
   responsive
   ════════════════════════════════════════════════════════════════════════════ */

/* iç 2-kolon gridler: sidebar main'i daralttığı için viewport ~960px altında
   tek kolona düşür (eski 860px topbar düzenine göreydi). */
@media (max-width: 960px) {
  .acc-grid--2,
  .acc-grid--detail {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  /* sidebar → üstte yatay kaydırılabilir şerit (CSS-only, JS drawer yok) */
  .acc-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
  }

  .acc-side {
    position: static;
    top: auto;
    flex-direction: row;
    gap: 0.25rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border);
    -webkit-overflow-scrolling: touch;
  }

  .acc-side-link {
    white-space: nowrap;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .acc-side-link.is-active {
    border-left-color: transparent;
    border-bottom-color: var(--brand-primary);
  }
}

@media (max-width: 640px) {
  .acc-form-row {
    grid-template-columns: 1fr;
  }

  /* tabloları mobilde kart satırlarına dönüştür (data-label ile) */
  .acc-table thead {
    display: none;
  }

  .acc-table,
  .acc-table tbody,
  .acc-table tr,
  .acc-table td {
    display: block;
    width: 100%;
  }

  .acc-table tr {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--c-border);
  }

  .acc-table tbody tr:last-child {
    border-bottom: none;
  }

  .acc-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.3rem 1.1rem;
    border: none;
    text-align: right;
  }

  .acc-table td::before {
    content: attr(data-label);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--c-muted);
    text-align: left;
  }
}
