@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --bg:        #F4F4F5;
  --surface:   #FFFFFF;
  --border:    #E4E4E7;
  --text:      #18181B;
  --muted:     #71717A;
  --accent:    #18181B;
  --accent-fg: #FFFFFF;
  --green:     #16A34A;
  --green-fg:  #FFFFFF;
  --red:       #DC2626;
  --amber:     #D97706;
  --radius:    12px;
  --shadow:    0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08);
}

html { font-size: 15px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Nav ──────────────────────────────────────────────── */
nav {
  background: #0F0F0F;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 20px;
  gap: 6px;
}

.nav-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 10px;
  text-decoration: none;
}

.nav-logo {
  height: 42px;
  width: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

nav a {
  color: #A1A1AA;
  text-decoration: none;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 500;
  transition: color .15s, background .15s;
  white-space: nowrap;
}
nav a:hover  { color: #fff; background: rgba(255,255,255,.08); }
nav a.active { color: #fff; background: rgba(255,255,255,.14); }

.hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  min-height: unset;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  margin-left: auto;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .2s;
  pointer-events: none;
}
.hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Legacy .brand fallback */
.brand { font-size: 15px; font-weight: 700; color: #fff; letter-spacing: -.3px; margin-right: 12px; }

/* ── Layout ───────────────────────────────────────────── */
.page { max-width: 1060px; margin: 0 auto; padding: 24px 16px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 680px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ── Card ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 14px;
}

/* ── Form ─────────────────────────────────────────────── */
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin-bottom: 5px; }

input, select, textarea {
  display: block;
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 13px;
  font-size: 14.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: #A1A1AA;
  box-shadow: 0 0 0 3px rgba(0,0,0,.06);
}

input[readonly] { background: var(--bg); color: var(--muted); cursor: default; }

.field { display: flex; flex-direction: column; gap: 5px; }
.fields { display: flex; flex-direction: column; gap: 14px; }

/* ── Buttons ──────────────────────────────────────────── */
button {
  cursor: pointer;
  border: none;
  border-radius: 9px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
button:active { transform: scale(.98); }
button:disabled { opacity: .4; cursor: not-allowed; transform: none; }

.btn-dark    { background: var(--accent); color: var(--accent-fg); }
.btn-green   { background: var(--green);  color: var(--green-fg); }
.btn-red     { background: var(--red);    color: #fff; }
.btn-ghost   { background: transparent; color: var(--muted); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-xl {
  width: 100%;
  padding: 16px;
  font-size: 16px;
  border-radius: 12px;
  letter-spacing: .2px;
}

/* ── Payment group ────────────────────────────────────── */
.pay-group { display: flex; gap: 8px; }
.pay-btn {
  flex: 1;
  padding: 11px 8px;
  background: var(--bg);
  color: var(--muted);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
}
.pay-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

/* ── Cart table ───────────────────────────────────────── */
.cart-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.cart-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--border);
}
.cart-table td { padding: 11px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cart-table tr:last-child td { border-bottom: none; }

.qty-ctrl { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 28px; height: 28px; padding: 0;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.qty-num { font-weight: 600; min-width: 20px; text-align: center; }

/* ── Total ────────────────────────────────────────────── */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 16px;
}
.total-label { font-size: 14px; font-weight: 500; color: var(--muted); }
.total-amount { font-size: 32px; font-weight: 700; letter-spacing: -1px; }

/* ── Search dropdown ──────────────────────────────────── */
.search-wrap { position: relative; }
.dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}
.dropdown.open { display: block; }
.drop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  cursor: pointer;
  font-size: 14px;
  gap: 12px;
  transition: background .1s;
}
.drop-item:hover { background: var(--bg); }
.drop-item + .drop-item { border-top: 1px solid var(--border); }
.drop-name { font-weight: 500; }
.drop-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

/* ── Stock badges ─────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
}
.badge-ok  { background: #DCFCE7; color: #15803D; }
.badge-low { background: #FEF9C3; color: #A16207; }
.badge-out { background: #FEE2E2; color: #B91C1C; }

/* ── Table ────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.data-table th:first-child { border-radius: 8px 0 0 0; }
.data-table th:last-child  { border-radius: 0 8px 0 0; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FAFAFA; }

/* ── Stat cards ───────────────────────────────────────── */
.stat-val { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.stat-lbl { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 500; }

/* ── Alert strip ──────────────────────────────────────── */
.alert-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #FEF9C3;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: #78350F;
  font-weight: 500;
}

/* ── Modal ────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: var(--bg); color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: 16px; }

/* ── Empty state ──────────────────────────────────────── */
.empty { text-align: center; padding: 36px 20px; color: var(--muted); font-size: 14px; }
.empty-icon { font-size: 32px; margin-bottom: 10px; }

/* ── Toast ────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #18181B;
  color: #fff;
  padding: 12px 22px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 999;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.2);
}
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.err  { background: var(--red); }

/* ── Divider ──────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Misc helpers ─────────────────────────────────────── */
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.fw-600 { font-weight: 600; }
.fs-13  { font-size: 13px; }
.text-muted { color: var(--muted); }
.w-full { width: 100%; }

/* ── Table scroll wrapper ─────────────────────────────── */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ══════════════════════════════════════════════════════════
   MOBILE — hamburger nav + full responsive layout
   ══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Hamburger nav ── */
  .hamburger { display: flex; }

  .nav-inner { height: 52px; padding: 0 14px; }
  .nav-logo  { height: 36px; width: 36px; }
  .nav-brand { margin-right: 6px; }

  .nav-links {
    display: none;
    position: fixed;
    top: 52px;
    left: 0; right: 0;
    background: #141414;
    flex-direction: column;
    align-items: stretch;
    padding: 8px 12px 16px;
    gap: 2px;
    border-top: 1px solid rgba(255,255,255,.07);
    box-shadow: 0 16px 40px rgba(0,0,0,.55);
    z-index: 9999;
  }
  .nav-links.is-open { display: flex; }

  nav a {
    font-size: 15px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    color: #D4D4D8;
  }
  nav a.active  { background: rgba(255,255,255,.11); color: #fff; }
  nav a:hover   { background: rgba(255,255,255,.07); color: #fff; }

  /* ── Layout ── */
  .page       { padding: 12px 12px 40px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  /* ── Inputs — prevent iOS zoom (need 16px) ── */
  input, select, textarea { font-size: 16px !important; }

  /* ── Buttons ── */
  button      { min-height: 44px; }
  .qty-btn    { min-height: 34px !important; width: 34px !important; height: 34px !important; }
  .modal-close { min-height: 38px !important; }
  .scan-btn   { min-height: 44px !important; padding: 0 14px !important; font-size: 18px !important; }

  /* ── Payment buttons ── */
  .pay-group  { flex-wrap: wrap; }
  .pay-btn    { flex: 1 1 calc(50% - 4px); }

  /* ── Remove sticky on mobile to avoid overlap ── */
  [style*="position:sticky"], [style*="position: sticky"] { position: static !important; }

  /* ── Cards ── */
  .card { padding: 14px; }

  /* ── Tables ── */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table   { min-width: 500px; }
  .cart-table   { min-width: 380px; }

  /* ── Modal ── */
  .modal         { padding: 20px 16px; }
  .modal-backdrop{ padding: 10px; }

  /* ── Stock page search ── */
  #ara { width: 100% !important; }

  /* ── Reports: filter bar stacks ── */
  .filtre-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px 14px !important;
    gap: 10px !important;
  }
  .filtre-grup { width: 100%; }
  .filtre-grup input,
  .filtre-grup select { width: 100% !important; }
  .filtre-grup .platform-bar { width: 100%; justify-content: stretch; }
  .filtre-grup .platform-bar .platform-btn { flex: 1; }

  /* ── Reports: order rows → card layout ── */
  .siparis-header { display: none !important; }
  .siparis-satir {
    display: grid !important;
    grid-template-columns: 1fr auto !important;
    grid-template-areas:
      "no    link"
      "tarih tutar"
      "kalem kalem" !important;
    row-gap: 4px;
    column-gap: 10px;
    padding: 14px !important;
    border-bottom: 1px solid var(--border);
  }
  .s-tarih { grid-area: tarih; font-size: 12px !important; }
  .s-no    { grid-area: no;    font-size: 15px !important; font-weight: 800 !important; }
  .s-id    { display: none !important; }
  .s-tutar { grid-area: tutar; text-align: right !important; font-size: 15px !important; }
  .s-kalem { grid-area: kalem; font-size: 12px !important; }
  .s-link  { grid-area: link;  }

  /* ── Reports: özet grid → 2 col ── */
  .urun-rapor-ozet { grid-template-columns: 1fr 1fr !important; }
}
