/*
 * Stokin B2B — ortak stil. Düzen ve bileşenler proking-template'ten; renkler Stokin mavisi.
 * Renkleri değiştirmek için sadece :root değişkenleri yeterli.
 */

/* ---------- Tokens ---------- */
:root {
  /* Kurumsal görünüm (2026-10-27): lacivert ana renk, düz köşeler, hafif gölge. Önce parlak mavi (#4184F3) ve hap şekilli butonlardı. */
  --brand: #0F2547;
  --brand-2: #1D4E9E;
  --brand-ink: #1D4E9E;
  --brand-soft: #EEF2F7;
  --dark: #0F2547;
  --ink: #1C2430;
  --ink-2: #4E5866;
  --ink-3: #8A93A0;
  --line: #E3E7EC;
  --soft: #F5F7FA;
  --white: #FFFFFF;
  --ok: #2E8B57;
  --ok-soft: #E7F5EC;
  --warn: #B26B00;
  --warn-soft: #FFF4E0;
  --err: #C62F45;
  --err-soft: #FCEBEE;

  --radius: 6px;
  --radius-sm: 4px;
  --radius-xs: 3px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 4px 12px rgba(16, 24, 40, .06);
  --wrap: 1180px;
  --gutter: 24px;
  --header-h: 72px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 12px); }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font); color: var(--ink); background: var(--soft); line-height: 1.55; -webkit-font-smoothing: antialiased; }
main { flex: 1; }
img { max-width: 100%; display: block; }
a { color: var(--brand-ink); }
h1, h2, h3 { margin: 0; line-height: 1.1; }
p { margin: 0; }
[hidden] { display: none !important; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.ico { width: 22px; height: 22px; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
h1.page-title { font-size: clamp(26px, 3vw, 32px); font-weight: 700; letter-spacing: -.01em; color: var(--dark); }
h2 { font-size: clamp(19px, 2.2vw, 22px); font-weight: 700; letter-spacing: -.005em; color: var(--dark); }
h3 { font-size: 17px; font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, opacity .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.btn-sm { padding: 7px 13px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--brand-2); }
.btn-outline { background: var(--white); color: var(--brand); border-color: var(--brand); }
.btn-outline:hover:not(:disabled) { background: var(--brand-soft); }
.btn-text { background: none; border: 0; padding: 6px 8px; color: var(--ink-2); font-weight: 600; }
.btn-text:hover { color: var(--err); }
.btn.is-busy { position: relative; color: transparent !important; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--white); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn-outline.is-busy::after { border-color: var(--brand); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
:focus-visible { outline: 2px solid var(--brand-ink); outline-offset: 2px; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 24px; height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand img { height: 44px; width: auto; max-width: 160px; object-fit: contain; }
.brand img.stokin-logo { height: 34px; }
.brand-sub { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.brand-sub b { font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub small { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav a, .nav button { text-decoration: none; font: inherit; font-weight: 600; font-size: 15px; color: var(--ink-2); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; padding: 6px 0; }
.nav a:hover, .nav button:hover { color: var(--dark); }
.nav a[aria-current="page"] { color: var(--dark); border-bottom-color: var(--dark); }
.header-tools { display: flex; align-items: center; gap: 10px; }
.lang-select { height: 38px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.cart-btn { position: relative; padding: 9px 16px; }
.cart-btn .ico { width: 20px; height: 20px; }
.cart-count { min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--white); color: var(--brand); font-size: 12px; font-weight: 800; display: inline-grid; place-items: center; }
.menu-btn { display: none; width: 44px; height: 44px; border: 0; background: none; padding: 10px; cursor: pointer; }
.menu-btn span { display: block; height: 2px; margin: 5px 0; background: var(--dark); border-radius: 2px; transition: transform .2s, opacity .2s; }
.menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Page ---------- */
.page { padding: 36px 0 72px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; }
.panel + .panel { margin-top: 20px; }
.panel h2 { margin-bottom: 16px; }
.loading { padding: 64px 0; text-align: center; color: var(--ink-3); }
.loading::before { content: ""; display: block; width: 32px; height: 32px; margin: 0 auto 12px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
.empty { grid-column: 1 / -1; padding: 48px 16px; text-align: center; color: var(--ink-2); }

/* Alerts */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14.5px; font-weight: 500; }
.alert + .alert, .alert + * { margin-top: 0; }
.alert-info { background: var(--brand-soft); color: var(--brand-ink); }
.alert-ok { background: var(--ok-soft); color: var(--ok); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert-err { background: var(--err-soft); color: var(--err); }
.alerts { display: grid; gap: 10px; margin-bottom: 20px; }
.alerts:empty { display: none; }

/* Toast */
.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast { padding: 12px 16px; border-radius: var(--radius-sm); background: var(--dark); color: var(--white); font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.err { background: var(--err); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* Forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.input, .select {
  width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); font: inherit; font-size: 16px; color: var(--ink);
}
.input:focus, .select:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.phone-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px; }

/* ---------- Login ---------- */
.auth { position: relative; flex: 1; display: grid; place-items: center; padding: 48px var(--gutter); background: linear-gradient(160deg, var(--brand-soft), var(--soft) 55%); }
.auth-card { width: min(440px, 100%); background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 36px 32px; }
.auth-brand { display: grid; justify-items: center; gap: 12px; margin-bottom: 24px; text-align: center; }
.auth-brand img { max-height: 72px; max-width: 220px; object-fit: contain; }
.auth-brand img.stokin-logo { width: 200px; height: auto; }
.auth-brand h1 { font-size: 20px; font-weight: 700; color: var(--ink); }
.auth-card .alerts { margin-bottom: 16px; }
.auth-foot { margin-top: 16px; text-align: center; }
.auth-lang { position: absolute; top: 16px; right: 16px; }
.forgot-box { margin-top: 16px; padding: 16px; border-radius: var(--radius-sm); background: var(--soft); font-size: 14.5px; color: var(--ink-2); }
.forgot-box a { font-weight: 600; }
.forgot-box p + p { margin-top: 8px; }

/* ---------- Catalog ---------- */
.toolbar { display: flex; gap: 12px; }
.search { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.search:focus-within { border-color: var(--brand-ink); box-shadow: 0 0 0 3px var(--brand-soft); }
.search .ico { color: var(--ink-3); width: 20px; height: 20px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; padding: 13px 0; font: inherit; font-size: 15px; background: transparent; color: var(--ink); }
.toolbar select { padding: 0 36px 0 14px; height: 50px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--white); font: inherit; font-size: 15px; color: var(--ink); min-width: 220px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chips:empty { display: none; }
.chip { padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--white); font: inherit; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chip:hover { border-color: var(--ink-3); color: var(--dark); }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--white); }
.chip .n { margin-left: 6px; font-weight: 500; opacity: .65; }
.chips-sub .chip { font-size: 13px; padding: 6px 13px; }
.chips-sub .chip[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-ink); color: var(--brand); }

.result-count { margin: 22px 0 14px; font-size: 14px; color: var(--ink-2); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; background: var(--white); border-radius: var(--radius-sm); border: 1px solid var(--line); padding: 14px; transition: box-shadow .15s, border-color .15s; }
.card:hover { border-color: var(--ink-3); }
.card .open { display: flex; flex-direction: column; flex: 1; padding: 0; border: 0; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.card .img { aspect-ratio: 1; min-height: 0; overflow: hidden; margin-bottom: 12px; display: grid; place-items: center; }
.card .img img { width: 100%; height: 100%; object-fit: contain; }
.card .brand-name { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); min-height: 1.5em; }
.card .name { margin-top: 2px; font-size: 15px; font-weight: 600; line-height: 1.3; color: var(--ink); }
.card .buy { margin-top: auto; padding-top: 12px; }
.price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin-bottom: 10px; }
.price b { font-size: 18px; color: var(--dark); }
.price s { font-size: 13px; color: var(--ink-3); }
.price small { flex-basis: 100%; font-size: 11.5px; color: var(--ink-3); }
.no-img { width: 56%; height: 56%; color: var(--line); }
.more { display: flex; justify-content: center; margin-top: 32px; }

/* Quantity control */
.qty { display: flex; align-items: center; height: 42px; border: 1px solid var(--brand); border-radius: var(--radius-sm); overflow: hidden; background: var(--white); }
.qty button { width: 40px; height: 100%; border: 0; background: var(--brand-soft); color: var(--brand); font-size: 20px; font-weight: 700; cursor: pointer; flex: none; }
.qty button:hover { background: var(--brand); color: var(--white); }
.qty input { flex: 1; min-width: 0; width: 100%; height: 100%; border: 0; text-align: center; font: inherit; font-weight: 700; font-size: 16px; color: var(--ink); -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty input:focus { outline: 0; background: var(--brand-soft); }
.qty.is-busy { opacity: .6; }
.add-btn { width: 100%; height: 42px; }

/* Product dialog */
dialog.product-dialog { width: min(860px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--radius); box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
dialog.product-dialog::backdrop { background: rgba(15, 37, 71, .55); }
.pd { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; padding: 28px; }
.pd-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border-radius: var(--radius-sm); border: 0; background: var(--soft); font-size: 22px; cursor: pointer; color: var(--ink-2); }
.pd-main { aspect-ratio: 1; display: grid; place-items: center; background: var(--white); }
.pd-main img { width: 100%; height: 100%; object-fit: contain; }
.pd-thumbs { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pd-thumbs button { width: 64px; height: 64px; padding: 4px; border: 2px solid var(--line); border-radius: var(--radius-sm); background: var(--white); cursor: pointer; }
.pd-thumbs button[aria-pressed="true"] { border-color: var(--brand); }
.pd-thumbs img { width: 100%; height: 100%; object-fit: contain; }
.pd-info h2 { font-size: 22px; font-weight: 700; margin: 4px 0 12px; }
.pd-info .detail { margin: 16px 0 20px; color: var(--ink-2); white-space: pre-line; }
.pd-info .qty, .pd-info .add-btn { max-width: 240px; }

/* ---------- Tables / lines ---------- */
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 10px; border-bottom: 1px solid var(--line); }
.lines td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.lines tr:last-child td { border-bottom: 0; }
.lines .num { text-align: right; white-space: nowrap; }
.line-prod { display: flex; align-items: center; gap: 12px; min-width: 0; }
.line-prod img, .line-prod .no-img { width: 52px; height: 52px; object-fit: contain; flex: none; }
.line-prod .nm { font-weight: 600; line-height: 1.3; }
.lines .qty { width: 140px; height: 38px; }
.lines .qty button { width: 34px; }

.cart-layout { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.summary { position: sticky; top: calc(var(--header-h) + 16px); }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 15px; }
.sum-row.total { margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 18px; font-weight: 800; color: var(--dark); }
.summary .note { margin-top: 10px; font-size: 12.5px; color: var(--ink-3); }
.summary .alerts { margin: 16px 0 0; }
.summary .btn-block { margin-top: 16px; }

/* Orders */
.order-list { display: grid; gap: 10px; }
.order-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 16px 20px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.order-row:hover { border-color: var(--ink-3); }
.order-row .no { font-weight: 700; color: var(--dark); }
.order-row .dt { font-size: 14px; color: var(--ink-2); }
.order-row .amt { font-weight: 700; white-space: nowrap; }
.badge { display: inline-block; padding: 4px 10px; border-radius: var(--radius-xs); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.badge-0 { background: var(--warn-soft); color: var(--warn); }
.badge-1 { background: var(--brand-soft); color: var(--brand-ink); }
.badge-2 { background: var(--err-soft); color: var(--err); }
.badge-3 { background: var(--ok-soft); color: var(--ok); }
.badge-4 { background: #FFF0E6; color: #B54708; }
.order-meta { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; color: var(--ink-2); }
.docs { display: grid; gap: 8px; }
.doc { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.doc b { color: var(--dark); }

/* Profile */
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 12px; font-size: 15px; }
.kv dt { color: var(--ink-3); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.pw-form { max-width: 420px; }

/* ---------- Footer ---------- */
.site-footer { background: var(--dark); color: rgba(255, 255, 255, .75); font-size: 14.5px; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; padding-top: 40px; padding-bottom: 28px; }
.footer-inner b { color: var(--white); }
.footer-inner a { color: inherit; text-decoration: none; }
.footer-inner a:hover { color: var(--white); }
.footer-contact { font-style: normal; line-height: 1.9; }
.footer-legal { padding-top: 16px; padding-bottom: 24px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 13px; color: rgba(255, 255, 255, .5); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .cart-layout { grid-template-columns: 1fr; }
  .summary { position: static; }
}
@media (max-width: 860px) {
  .nav {
    position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--white); border-bottom: 1px solid var(--line); box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a, .nav button { padding: 16px var(--gutter); border-top: 1px solid var(--line); border-bottom: 0; font-size: 16px; text-align: left; }
  .nav a[aria-current="page"] { box-shadow: inset 3px 0 0 var(--dark); }
  .menu-btn { display: block; }
  .header-tools { margin-left: auto; }
  .pd { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; --header-h: 64px; }
  .header-inner { gap: 10px; }
  .brand img { height: 36px; max-width: 110px; }
  .brand-sub { display: none; }
  .cart-btn .lbl { display: none; }
  .cart-btn { padding: 8px 12px; }
  .toolbar { flex-direction: column; }
  .toolbar select { min-width: 0; width: 100%; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 10px; }
  .card .name { font-size: 14px; }
  .qty button { width: 34px; }
  .panel { padding: 18px; }
  .auth-card { padding: 28px 20px; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines td { padding: 0; border: 0; }
  .lines td.prod { grid-column: 1 / -1; }
  .lines td[data-label]::before { content: attr(data-label) ": "; color: var(--ink-3); font-size: 13px; }
  .order-row { grid-template-columns: 1fr auto; }
  .order-row .amt { grid-column: 2; grid-row: 1; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
}
