:root {
  --red: #c8102e;
  --red-dark: #a00c24;
  --ink: #222;
  --ink-soft: #666;
  --line: #e2e2e2;
  --bg: #f2f2f2;
  --white: #fff;
  --green: #2e7d32;
  --amber: #b8860b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

/* ---------- ust bar: firma adi + bakiye + cikis ---------- */
.topbar {
  background: var(--red);
  color: var(--white);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 14px;
}
.topbar .brand-logo { height: 46px; filter: brightness(0) invert(1); }
.topbar .right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.topbar .balance { font-weight: 700; }
.topbar .fx-rates { font-weight: 600; font-variant-numeric: tabular-nums; }
.topbar .link-inline {
  background: none; border: none; color: var(--white); text-decoration: underline;
  cursor: pointer; font-size: 13px; padding: 0;
}
.topbar .lang-select {
  background: rgba(255,255,255,.15); color: var(--white); border: 1px solid rgba(255,255,255,.5);
  border-radius: 4px; padding: 4px 6px; font-size: 13px;
}
.topbar .lang-select option { color: var(--ink); }
.topbar button#logout {
  background: none;
  border: 1px solid rgba(255,255,255,.5);
  color: var(--white);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}

/* ---------- ikinci sira: logo + nav ikonlari ---------- */
.navbar {
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.navbar .logo { font-size: 20px; font-weight: 800; color: var(--red); }
.navbar nav { display: flex; gap: 8px; flex-wrap: wrap; }
.navbar nav button {
  background: var(--bg);
  border: 1px solid transparent;
  padding: 10px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.navbar nav button.active { background: var(--white); border-color: var(--red); color: var(--red); }

main { max-width: 1200px; margin: 0 auto; padding: 20px; }

/* ---------- giris ---------- */
.login-box {
  max-width: 380px;
  margin: 70px auto;
  background: var(--white);
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.1);
}
.login-box h2 { margin-top: 0; color: var(--red); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 4px; text-transform: uppercase; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  font-size: 15px;
  font-family: inherit;
}
.btn {
  background: var(--red);
  color: var(--white);
  border: none;
  padding: 11px 18px;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.btn.full { width: 100%; }
.btn:hover { background: var(--red-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondary { background: var(--white); color: var(--red); border: 1px solid var(--red); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { background: var(--white); color: var(--red); border: 1px solid var(--red); }
.btn.danger:hover { background: var(--red); color: var(--white); }
.error { color: var(--red); font-size: 14px; margin-bottom: 12px; }

/* ---------- arama ---------- */
.search-row { display: flex; gap: 10px; margin-bottom: 18px; }
.search-row input { flex: 1; padding: 12px 16px; border: 1px solid var(--line); border-radius: 6px; font-size: 15px; background: var(--white); }
.result-count { font-weight: 700; color: var(--ink-soft); margin-bottom: 14px; font-size: 14px; }

/* ---------- urun kartlari ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--white);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  cursor: pointer;
}
.card .qty-row { cursor: default; }
.card .sku-badge { font-family: monospace; font-size: 13px; font-weight: 700; color: var(--red); }
.card .name { font-weight: 700; font-size: 14px; line-height: 1.3; min-height: 36px; }
.card .oem-box { border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px; }
.card .oem-box .label { font-size: 10px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; }
.card .oem-box .codes { font-family: monospace; font-size: 12px; margin-top: 2px; }
.card .image-wrap { height: 110px; display: flex; align-items: center; justify-content: center; background: #fafafa; border-radius: 4px; overflow: hidden; }
.card .image-wrap img { max-width: 100%; max-height: 100%; }
.card .image-wrap .placeholder { color: #ccc; font-size: 12px; }

.price-block { position: relative; }
.price-block .final { font-size: 19px; font-weight: 800; color: var(--red); cursor: help; }
.price-block .gross { font-size: 12px; color: var(--ink-soft); text-decoration: line-through; margin-left: 6px; }
.price-tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  z-index: 20;
  background: #222;
  color: var(--white);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  white-space: nowrap;
  margin-bottom: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.price-block:hover .price-tooltip { display: block; }
.price-tooltip .row { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; }
.price-tooltip .row.hl { color: #ffd166; font-weight: 700; }

.qty-row { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.qty-row .stepper { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 4px; }
.qty-row .stepper button { background: var(--bg); border: none; width: 28px; height: 34px; cursor: pointer; font-size: 16px; }
.qty-row .stepper input { width: 44px; text-align: center; border: none; font-size: 14px; }
.qty-row .btn { flex: 1; }

/* ---------- sepet ---------- */
.cart-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 8px; overflow: hidden; }
.cart-table th { text-align: left; background: var(--bg); padding: 10px 12px; font-size: 12px; text-transform: uppercase; color: var(--ink-soft); }
.cart-table td { padding: 12px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
.cart-table .thumb { width: 50px; height: 50px; object-fit: contain; background: #fafafa; border-radius: 4px; }
.cart-table .sku { font-family: monospace; font-size: 12px; color: var(--ink-soft); }
.cart-table input.qty { width: 60px; padding: 6px; border: 1px solid var(--line); border-radius: 4px; text-align: center; }
.cart-table .del { color: var(--red); cursor: pointer; font-size: 13px; background: none; border: none; text-decoration: underline; }

.summary-box { max-width: 340px; margin-left: auto; margin-top: 16px; background: var(--white); border-radius: 8px; padding: 16px; }
.summary-box .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-box .row.total { font-size: 18px; font-weight: 800; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.note-box { margin-top: 16px; }
.note-box textarea { width: 100%; min-height: 60px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; font-family: inherit; }

/* ---------- siparisler ---------- */
.order-row {
  background: var(--white);
  padding: 14px 16px;
  border-radius: 6px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
}
.order-row .grow { flex: 1; }
.order-row .date { font-size: 12px; color: var(--ink-soft); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.badge.PENDING { background: #fff3cd; color: #856404; }
.badge.CONFIRMED { background: #d4edda; color: #155724; }
.badge.CANCELLED { background: #f8d7da; color: #721c24; }

.status-cell { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
}
.icon-btn.confirm { background: #28a745; }
.icon-btn.confirm:hover { background: #218838; }
.icon-btn.cancel { background: #dc3545; }
.icon-btn.cancel:hover { background: #c82333; }

.empty { text-align: center; color: var(--ink-soft); padding: 50px 0; }

/* ---------- uyumlu arac modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto; z-index: 100;
}
.modal-box {
  background: var(--white); border-radius: 8px; padding: 24px;
  max-width: 900px; width: 100%; max-height: calc(100vh - 80px); overflow-y: auto;
  position: relative;
}
.modal-box h3 { margin-top: 0; display: flex; justify-content: space-between; align-items: center; }
.modal-box .close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--ink-soft); }

/* ---------- iletisim penceresi ---------- */
.contact-layout { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.contact-logo { max-width: 220px; max-height: 100px; }
.contact-rows { display: flex; flex-direction: column; gap: 14px; flex: 1; min-width: 220px; }
.contact-row { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.contact-icon { font-size: 18px; }
.fitment-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fitment-table th { text-align: left; background: var(--bg); padding: 8px 10px; }
.fitment-table td { padding: 7px 10px; border-top: 1px solid var(--line); }
.link-btn { background: none; border: none; color: var(--red); text-decoration: underline; cursor: pointer; font-size: 12px; padding: 0; text-align: left; }

/* ---------- urun detay penceresi (Alper tarzi) ---------- */
.modal-box.wide { max-width: 1000px; }
.modal-box .detail-close { position: absolute; top: 16px; right: 16px; z-index: 1; }
.detail-layout { display: flex; gap: 24px; flex-wrap: wrap; }
.detail-image { flex: 0 0 280px; display: flex; align-items: center; justify-content: center; background: #fafafa; border-radius: 6px; min-height: 220px; }
.detail-image img { max-width: 100%; max-height: 260px; }
.detail-image .placeholder { color: #ccc; }
.detail-info { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 14px; }
.detail-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.detail-table th { background: var(--red); color: var(--white); text-align: left; padding: 10px 12px; font-weight: 700; }
.detail-table td { padding: 9px 12px; border-top: 1px solid var(--line); }
.detail-table td:first-child { color: var(--ink-soft); width: 40%; }

/* ---------- admin (yonetim) ---------- */
.admin-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 8px; overflow: hidden; margin-bottom: 20px; }
.admin-table th { text-align: left; background: var(--bg); padding: 10px 12px; font-size: 12px; text-transform: uppercase; color: var(--ink-soft); }
.admin-table td { padding: 10px 12px; border-top: 1px solid var(--line); font-size: 14px; }
.admin-table input { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 13px; }
.form-panel { background: var(--white); border-radius: 8px; padding: 18px; margin-bottom: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
