/* EFRAN ERP — dark theme, mobil uyumlu */

:root {
  --bg: #0f1419;
  --bg-elevated: #161d27;
  --bg-elevated-2: #1c2533;
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8edf4;
  --muted: #8b98a8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  --font: system-ui, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --tap-min: 48px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, rgba(59, 130, 246, 0.12), transparent),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  display: flex;
  min-height: 100dvh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100dvh;
  z-index: 40;
  overflow: hidden; /* scroll'u nav içinde tut */
}

.sidebar__brand {
  margin-bottom: 1.5rem;
}

.sidebar__logo {
  display: block;
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1.35rem;
}

.sidebar__sub {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  min-height: 0; /* flex + overflow için gerekli */
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 0.9rem;
  border-radius: 12px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
  background: var(--bg-elevated-2);
  text-decoration: none;
}

.nav-link.is-active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(59, 130, 246, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.nav-link--muted {
  color: var(--muted);
  font-weight: 500;
}

.sidebar__footer {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 35;
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.menu-toggle {
  display: none;
}

.topbar__title {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.main-content {
  padding: 1.25rem;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.page-enter {
  animation: pageIn 0.22s ease-out;
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid--2 {
  grid-template-columns: 1fr 1fr;
}

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card--spaced {
  margin-top: 1rem;
}

.card__title {
  margin: 0 0 1rem;
  font-size: 1.1rem;
}

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

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.row--gap {
  gap: 0.75rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field--grow {
  flex: 1;
  min-width: 0;
}

.field__label {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.field--inline {
  flex-direction: row;
  align-items: center;
}

.input {
  min-height: 44px;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  width: 100%;
}

.input--lg {
  min-height: var(--tap-min);
  font-size: 1.05rem;
}

.input:focus {
  outline: 2px solid rgba(59, 130, 246, 0.45);
  outline-offset: 0;
}

.input--readonly {
  opacity: 0.85;
  background: rgba(255, 255, 255, 0.03);
}

.toggle {
  flex-direction: row;
  align-items: center;
  gap: 0.65rem;
}

.toggle input {
  width: 1.15rem;
  height: 1.15rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 1rem;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text);
  background: var(--bg-elevated-2);
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-hover));
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn--secondary {
  background: var(--bg-elevated-2);
  border-color: var(--border);
}

.btn--danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
}

.btn--lg {
  min-height: var(--tap-min);
  padding: 0 1.1rem;
}

.btn--sm {
  min-height: 34px;
  padding: 0 0.65rem;
  font-size: 0.9rem;
  border-radius: 10px;
}

.stok-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
}

.btn--xl {
  min-height: 52px;
  font-size: 1.05rem;
  padding: 0 1.25rem;
}

.btn--grow {
  flex: 1;
}

.btn--block {
  width: 100%;
}

.icon-btn {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated-2);
  color: var(--text);
  font-size: 1.25rem;
  cursor: pointer;
}

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

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
}

.scanner-wrap {
  min-height: 220px;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin: 0.75rem 0;
}

/* Quagga: video/canvas oranını bozmayın — transform/scale kullanmayın */
.scanner-viewport {
  position: relative;
  background: #0a0a0a;
  overflow: hidden;
  border-radius: inherit;
}

.scanner-quagga-host {
  max-height: 300px;
  overflow: hidden;
  background: #000;
  line-height: 0;
}

.scanner-quagga-host video,
.scanner-quagga-host canvas {
  width: 100%;
  height: auto;
  display: block;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.scanner-frame {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -50%);
  width: min(97%, 480px);
  height: clamp(102px, 34vw, 188px);
  max-height: 58%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.52);
  overflow: hidden;
  box-sizing: border-box;
}

.scanner-hint {
  position: absolute;
  bottom: 0.65rem;
  left: 0.75rem;
  right: 0.75rem;
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
  z-index: 3;
}


.print-area {
  padding: 1rem;
  background: #fff;
  color: #111;
  border-radius: 12px;
  max-width: 420px;
}

.print-area__meta {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.mono {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.data-table th,
.data-table td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.data-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.data-table .num {
  text-align: right;
}

.data-table .empty {
  text-align: center;
  color: var(--muted);
  padding: 2rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.flash-stack {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flash {
  margin: 0;
  padding: 0.65rem 1rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
}

.flash--success {
  background: rgba(34, 197, 94, 0.15);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.35);
}

.flash--error {
  background: rgba(239, 68, 68, 0.12);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.inline-form {
  display: inline-flex;
  margin: 0;
  align-items: center;
  vertical-align: middle;
}

.inline-form .input--compact {
  max-width: 12rem;
}

.input--compact {
  min-height: 40px;
  padding: 0.35rem 0.6rem;
  font-size: 0.95rem;
}

.btn--compact {
  min-height: 38px;
  padding: 0 0.75rem;
  font-size: 0.9rem;
}

.toolbar {
  margin-bottom: 1rem;
}

.toolbar__filters {
  align-items: flex-end;
}

.stok-liste__search {
  min-width: min(100%, 18rem);
}

.stok-liste__search-actions {
  flex-shrink: 0;
  gap: 0.5rem;
}

.ham-row-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  white-space: normal;
}

.pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.pill--ok {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.pill--muted {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
}

.pill--warn {
  background: rgba(251, 191, 36, 0.18);
  color: #fcd34d;
}

.card--compact {
  padding: 0.75rem 1rem;
}

.stok-takip-ozet {
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.stok-takip-ozet__item {
  flex: 1 1 8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stok-takip-grup {
  margin-bottom: 1rem;
}

.stok-takip-grup__title {
  margin-bottom: 0.5rem;
}

.data-table--compact th,
.data-table--compact td {
  padding: 0.5rem 0.65rem;
}

.stok-takip-row--yok {
  opacity: 0.85;
}

.stok-takip-secim__grup {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}

.stok-takip-secim__kumas {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  cursor: pointer;
}

.stok-takip-secim__renkler {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
  padding-left: 1.5rem;
}

.stok-takip-secim__renk {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.stok-takip-secim__renk input:disabled + span {
  opacity: 0.45;
}

.small {
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.5rem;
  border-radius: 8px;
  background: var(--bg-elevated-2);
  font-size: 0.85rem;
  color: var(--muted);
}

.batch-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.batch-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--tap-min);
}

.batch-list .batch-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.batch-list .batch-row__barkod {
  font-weight: 600;
  word-break: break-all;
}

.batch-list .batch-row__kunye {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.batch-list li:last-child {
  border-bottom: none;
}

.batch-list button {
  min-height: 40px;
  min-width: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

/* Toast */
.toast-root {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: min(420px, calc(100vw - 2rem));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
  animation: toastIn 0.2s ease;
}

.toast--ok {
  border-color: rgba(34, 197, 94, 0.35);
}

.toast--err {
  border-color: rgba(239, 68, 68, 0.45);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Auth */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.auth-card__header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.auth-card__logo {
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 1.5rem;
}

.auth-card__hint {
  color: var(--muted);
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
}

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

.auth-card__footer {
  margin-top: 1.25rem;
  text-align: center;
}

.auth-card__footer a {
  color: var(--muted);
  font-size: 0.9rem;
}

@media print {
  body * {
    visibility: hidden;
  }
  #print-area,
  #print-area * {
    visibility: visible;
  }
  #print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    box-shadow: none;
  }
}

/* Modal — listeden seç */
.modal[hidden] {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0.75rem;
}

@media (min-width: 600px) {
  .modal {
    align-items: center;
  }
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
}

.modal__dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 520px;
  max-height: min(88dvh, 640px);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  animation: pageIn 0.2s ease-out;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.modal__title {
  margin: 0;
  font-size: 1.1rem;
}

.pick-loading {
  text-align: center;
  padding: 1rem;
}

.pick-list {
  flex: 1;
  min-height: 120px;
  max-height: min(50dvh, 360px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.pick-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.75rem;
  align-items: center;
  width: 100%;
  padding: 0.85rem 0.9rem;
  min-height: var(--tap-min);
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease;
}

.pick-row:last-child {
  border-bottom: none;
}

.pick-row:hover:not(:disabled) {
  background: var(--bg-elevated-2);
}

.pick-row:disabled,
.pick-row--in-batch {
  opacity: 0.45;
  cursor: not-allowed;
}

.pick-row__main {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.pick-row__barkod {
  font-family: ui-monospace, Consolas, monospace;
  font-weight: 700;
  font-size: 1rem;
}

.pick-row__meta {
  font-size: 0.85rem;
  color: var(--muted);
}

.pick-row__metre {
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

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

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-backdrop:not([hidden]) {
    display: block;
  }
}

.modal__dialog--pdf {
  max-width: min(960px, 100%);
  max-height: min(92dvh, 900px);
  min-height: 320px;
}

.pdf-preview-frame {
  width: 100%;
  min-height: min(65dvh, 520px);
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

/* --- ERP ana sayfa (dashboard) --- */
.dashboard-intro {
  margin-bottom: 1.25rem;
}

.dashboard-section__title {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.dashboard-section--spaced {
  margin-top: 1.5rem;
}

.dashboard-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dashboard-kpi {
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dashboard-kpi__label {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
}

.dashboard-kpi__value {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dashboard-empty {
  margin: 0.5rem 0 0;
}

.dashboard-last-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.dashboard-last-card .card__title {
  font-size: 1rem;
}

.dashboard-dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  font-size: 0.92rem;
}

.dashboard-dl dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
}

.dashboard-dl dd {
  margin: 0;
}

.dashboard-last-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 0;
}
