/* Silveria Panel — minimal, mobile-first styles */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #e2e5e9;
  --brand: #b08d57;      /* jewelry gold accent */
  --brand-ink: #8a6d3f;
  --danger: #c0392b;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
  position: relative;
}
/* Wrapper is invisible to layout on desktop, so links/user flow in the bar
   exactly as before; on mobile it becomes a dropdown panel (see media query). */
.nav-collapse { display: contents; }
/* Hamburger button — hidden on desktop, shown under 600px. */
.nav-toggle {
  display: none;
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.3rem;
  line-height: 1;
  padding: .25rem .55rem;
  color: var(--ink);
  cursor: pointer;
}
.brand, .login-logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: .2px;
}
.brand span, .login-logo span { color: var(--brand); }
.mainnav { display: flex; gap: 1rem; margin-left: 1rem; flex: 1; }
.mainnav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.mainnav a:hover { color: var(--ink); }
.user { display: flex; align-items: center; gap: .6rem; margin-left: auto; }
.user-name { font-size: .9rem; color: var(--muted); }

/* --- Layout --- */
.container { max-width: 960px; margin: 0 auto; padding: 1.5rem 1rem; }
.center { text-align: center; }
.muted { color: var(--muted); }

/* --- Buttons --- */
.btn-primary, .btn-ghost {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  padding: .6rem 1rem;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand-ink);
  width: 100%;
}
.btn-primary:hover { background: var(--brand-ink); }
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--line);
  padding: .4rem .8rem;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--muted); }

/* --- Alerts --- */
.alert { padding: .7rem .9rem; border-radius: 8px; margin-bottom: 1rem; font-size: .92rem; }
.alert-error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6c0; }

/* --- Login --- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
}
.login-logo { display: block; text-align: center; font-size: 1.5rem; margin-bottom: 1.5rem; }
.login-card label { display: block; font-size: .85rem; color: var(--muted); margin: .8rem 0 .3rem; }
.login-card input {
  width: 100%;
  font: inherit;
  padding: .65rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.login-card input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.login-card .btn-primary { margin-top: 1.4rem; }

/* --- Home cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
}
a.card { text-decoration: none; color: inherit; transition: border-color .15s, transform .05s; display: block; }
a.card:hover { border-color: var(--brand); }
a.card:active { transform: translateY(1px); }
.card h2 { margin: 0 0 .3rem; font-size: 1.05rem; }
.card p { margin: 0; color: var(--muted); font-size: .9rem; }
.card-soon .tag {
  display: inline-block;
  margin-top: .7rem;
  font-size: .72rem;
  color: var(--brand-ink);
  background: #f6efe4;
  padding: .15rem .5rem;
  border-radius: 999px;
}

/* --- Alerts (success) --- */
.alert-ok { background: #e7f6ec; color: #1e7e46; border: 1px solid #bfe6cd; }

/* --- Products list --- */
.container.wide { max-width: 1200px; }
.page-head { display: flex; align-items: center; gap: .6rem; }
.page-head h1 { font-size: 1.4rem; }
.count {
  font-size: .8rem; color: var(--brand-ink); background: #f6efe4;
  padding: .1rem .55rem; border-radius: 999px; vertical-align: middle;
}
.filters { display: flex; gap: .6rem; margin: 1rem 0 1.2rem; flex-wrap: wrap; }
.filters input[type="search"] {
  flex: 1; min-width: 180px; font: inherit; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 8px;
}
.filters select {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; background: #fff;
}
.btn-primary.auto { width: auto; }
.empty { padding: 2rem 0; text-align: center; }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .9rem; }
table.grid th, table.grid td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.grid th { background: #fafbfc; color: var(--muted); font-weight: 600; font-size: .8rem; }
table.grid th.num, table.grid td.num { text-align: right; }
table.grid tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #faf7f1; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; }
table.grid.products { table-layout: auto; width: 100%; }
/* Product name: single line, ellipsis so it never forces the table wider. */
.name { max-width: 360px; }
.name-text { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.variant { display: block; color: var(--muted); font-size: .78rem; }

/* Pagination bar */
.pager-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; flex-wrap: wrap; }
.pager-bar.bottom { justify-content: flex-end; }
.range-info { font-size: .85rem; }
.pager { display: flex; gap: .3rem; flex-wrap: wrap; }
.pg {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 .55rem;
  border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; color: var(--ink); font-size: .9rem; background: var(--surface);
}
.pg:hover { border-color: var(--brand); }
.pg.current { background: var(--brand); color: #fff; border-color: var(--brand-ink); }
.pg.disabled { color: var(--muted); opacity: .5; pointer-events: none; }
.pg.gap { border: 0; background: transparent; pointer-events: none; padding: 0 .2rem; }

/* Responsive column hiding — keep essentials (thumb, name, gerçek stok, durum). */
@media (max-width: 1150px) { table.grid .col-lg { display: none; } }
@media (max-width: 860px)  { table.grid .col-md { display: none; } }
@media (max-width: 560px)  { table.grid .col-sm { display: none; } .name { max-width: 190px; } }
.thumb-cell { width: 46px; }
.thumb { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.thumb-empty { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); background: #f4f5f7; }

table.grid th.center, table.grid td.center { text-align: center; }

/* Channel matrix state chips */
.ch { display: inline-block; font-size: .74rem; padding: .12rem .5rem; border-radius: 999px; white-space: nowrap; }
.ch-on { background: #e7f6ec; color: #1e7e46; }
.ch-off { background: #fef3e2; color: #b26a00; }
.ch-no { background: #f1f1f3; color: #9aa1ab; }

.section-title { margin-top: 2rem; font-size: 1.15rem; }
.section-title .count { font-size: .75rem; }

.badge { font-size: .72rem; padding: .12rem .5rem; border-radius: 999px; text-transform: capitalize; }
.badge-aktif { background: #e7f6ec; color: #1e7e46; }
.badge-pasif { background: #f1f1f3; color: #6b7280; }

/* --- Product edit --- */
.back { display: inline-block; color: var(--muted); text-decoration: none; margin-bottom: 1rem; }
.back:hover { color: var(--ink); }
.edit-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.edit-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.edit-head h1 { font-size: 1.2rem; margin: 0 0 .2rem; }
.hint { background: #f6efe4; border: 1px solid #e8dcc6; color: var(--brand-ink); padding: .6rem .8rem; border-radius: 8px; font-size: .85rem; }
.edit-form { margin-top: 1rem; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .9rem; }
.edit-form label { display: block; font-size: .85rem; color: var(--muted); }
.edit-form input[type="number"], .edit-form input[type="text"] {
  width: 100%; font: inherit; margin-top: .3rem; padding: .55rem .7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.edit-form input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }
.edit-form label.check { display: flex; align-items: center; gap: .5rem; margin: 1.1rem 0; color: var(--ink); font-size: .95rem; }
.edit-form label.check input { width: auto; margin: 0; }
.edit-form label.full { margin-top: .4rem; }
.form-actions { display: flex; gap: .7rem; align-items: center; margin-top: 1.4rem; }

/* --- Stock count (mobile) --- */
.container.narrow { max-width: 520px; }
.sayim h1 { font-size: 1.4rem; }
#scanner-wrap { margin: 1rem 0; }
#reader { width: 100%; border-radius: var(--radius); overflow: hidden; background: #000; }
#reader:empty { min-height: 0; }
.scan-controls { display: flex; gap: .6rem; margin-top: .7rem; }
.manual { display: flex; gap: .6rem; margin: 1rem 0; }
.manual input {
  flex: 1; font: inherit; padding: .6rem .7rem; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: 8px;
}
.scan-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem; margin-top: 1rem;
}
.scan-card-head { display: flex; gap: .9rem; align-items: center; }
.scan-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.scan-name { font-weight: 600; }
.scan-stock { margin: 1rem 0 .3rem; color: var(--muted); }
.scan-stock strong { color: var(--ink); font-size: 1.1rem; }
.count-label { display: block; font-size: .85rem; color: var(--muted); margin-top: .6rem; }
.count-label input {
  width: 100%; font: inherit; font-size: 1.3rem; text-align: center; margin-top: .3rem;
  padding: .6rem; border: 1px solid var(--line); border-radius: 8px;
}
.count-label input:focus { outline: 2px solid var(--brand); border-color: var(--brand); }

@media (max-width: 600px) {
  .nav-toggle { display: block; }

  /* Collapsed by default; drops down below the bar when .nav-open is set. */
  .nav-collapse {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow);
    padding: .25rem 1rem 1rem;
    z-index: 30;
  }
  .topbar.nav-open .nav-collapse { display: flex; }

  .mainnav {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 0;
    flex: none;
  }
  .mainnav a {
    padding: .8rem .2rem;
    border-bottom: 1px solid var(--line);
    font-size: 1rem;
  }
  .user {
    margin: .8rem 0 0;
    justify-content: space-between;
  }
}
