/* ============================================================================
   BabyDarling — Stok & Sipariş Takip web panel. Mobile-first responsive CSS.
   Mor -> pembe gradient tema (#7C3AED -> #EC4899), mobil görünümle uyumlu.
   ============================================================================ */
:root {
  --primary: #6D28D9;
  --accent: #EC4899;
  --grad: linear-gradient(135deg, #7C3AED, #EC4899);
  --bg: #F7F4FB;
  --ink: #1F2937;
  --muted: #6B7280;
  --line: #E5E7EB;
  --card: #FFFFFF;
  --radius: 16px;
  --shadow: 0 4px 16px rgba(17, 12, 46, 0.06);
  --nav-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; }
.material-icons { vertical-align: middle; line-height: 1; }

/* -------------------------------------------------- Boot / spinner */
.boot { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.spinner {
  display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  border: 2.5px solid rgba(124, 58, 237, 0.25); border-top-color: var(--primary);
  animation: spin 0.8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------- Buttons & inputs */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; padding: 10px 16px; font-size: 14px;
  font-weight: 700; cursor: pointer; background: #EEE; color: var(--ink);
  font-family: inherit; transition: filter .15s, background .15s, opacity .15s;
  line-height: 1.1;
}
.btn .material-icons { font-size: 18px; }
.btn:hover { filter: brightness(0.97); }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; color: var(--primary); border: 1.5px solid rgba(109,40,217,.4); }
.btn.ghost.danger { color: #DC2626; border-color: rgba(220,38,38,.4); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.icon-btn {
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  width: 38px; height: 38px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; transition: background .15s;
}
.icon-btn:hover { background: rgba(0,0,0,.05); }
.icon-btn.danger { color: #DC2626; }

.inp {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 14px; font-family: inherit; color: var(--ink);
  background: #fff; outline: none; transition: border-color .15s;
}
.inp:focus { border-color: var(--primary); }
textarea.inp { resize: vertical; min-height: 54px; }
select.inp { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 38px; }
.inp.search { background: var(--bg); border-color: transparent; }
.field { display: block; margin-bottom: 14px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); }
.hint.center { text-align: center; margin: 6px 0 14px; }

/* -------------------------------------------------- Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: var(--grad); }
.login-card { background: #fff; border-radius: 22px; padding: 34px 28px; width: 100%; max-width: 380px;
  box-shadow: 0 20px 50px rgba(17,12,46,.25); text-align: center; }
.login-logo { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto 14px; display: flex;
  align-items: center; justify-content: center; background: var(--grad); color: #fff; }
.login-logo .material-icons { font-size: 34px; }
.login-card h1 { font-size: 21px; margin: 0 0 4px; font-weight: 800; }
.login-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-err { background: #FEE2E2; color: #B91C1C; padding: 10px 12px; border-radius: 10px; font-size: 13px; }

/* -------------------------------------------------- Shell / layout */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--grad); color: #fff; display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; position: sticky; top: 0; z-index: 30; }
.topbar .hamburger { display: none; background: rgba(255,255,255,.15); border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; }
.brand-ico { font-size: 26px; }
.brand { flex: 1; min-width: 0; }
.brand-title { font-weight: 800; font-size: 16px; }
.brand-sub { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { background: rgba(255,255,255,.15); border: none; color: #fff; display: inline-flex;
  align-items: center; gap: 5px; padding: 8px 12px; border-radius: 10px; cursor: pointer;
  font-family: inherit; font-weight: 600; font-size: 13.5px; }
.logout-btn:hover { background: rgba(255,255,255,.25); }
.logout-btn .material-icons { font-size: 18px; }

.body { flex: 1; display: flex; position: relative; }
.sidebar { width: var(--nav-w); background: #fff; border-right: 1px solid var(--line); padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  border: none; background: transparent; cursor: pointer; font-family: inherit; font-size: 14.5px;
  font-weight: 600; color: var(--muted); text-align: left; transition: background .15s, color .15s; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.on { background: linear-gradient(135deg, rgba(124,58,237,.12), rgba(236,72,153,.12)); color: var(--primary); }
.nav-item .material-icons { font-size: 21px; }

.content { flex: 1; min-width: 0; padding: 20px 24px 40px; overflow-y: auto; }
.scrim { display: none; }

.bottomnav { display: none; }

/* -------------------------------------------------- Sections */
.view { max-width: 1100px; margin: 0 auto; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-head h2 { flex: 1; font-size: 20px; font-weight: 800; margin: 0; }
.toolbar { margin-bottom: 14px; }
.toolbar.col { display: flex; flex-direction: column; gap: 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip { flex-shrink: 0; border: none; background: var(--bg); color: var(--ink); padding: 8px 14px;
  border-radius: 20px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip.on { background: var(--primary); color: #fff; }

.empty { text-align: center; color: var(--muted); padding: 40px 10px; font-size: 15px; }
.empty.big { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--muted); }
.empty.big .material-icons { color: var(--primary); }

/* -------------------------------------------------- Image box */
.img-box { background: #EDE9FE; overflow: hidden; flex-shrink: 0; display: flex;
  align-items: center; justify-content: center; }
.img-box img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-ph { color: rgba(109,40,217,.5); }

/* -------------------------------------------------- Cards (list rows) */
.card-list { display: flex; flex-direction: column; gap: 10px; }
.row-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; display: flex; align-items: center; gap: 12px; }
.row-mid { flex: 1; min-width: 0; }
.row-title { font-weight: 800; font-size: 15px; color: var(--ink); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.row-title.sm { font-size: 14px; font-weight: 600; }
.row-sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-sub.strong { font-weight: 600; -webkit-line-clamp: 1; }
.row-sub.err { color: #DC2626; }
.row-actions { display: flex; gap: 4px; flex-shrink: 0; }
.pill { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700; }
.pill.ok { background: #DCFCE7; color: #15803D; }
.pill.bad { background: #FEE2E2; color: #B91C1C; }

/* Stok kontrol */
.stok-num { font-size: 13px; font-weight: 700; margin-top: 4px; }
.stok-btns { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.stok-btns .btn { min-width: 92px; }
.preview { display: flex; align-items: center; justify-content: space-between; padding: 12px;
  border-radius: 12px; }
.preview-val { font-size: 20px; font-weight: 900; }
.kv { display: flex; align-items: center; justify-content: space-between; }
.uyari { color: #DC2626; font-size: 12.5px; margin-top: 6px; }
.uyarilar { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }

/* -------------------------------------------------- Order card */
.order-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px; }
.order-head { display: flex; align-items: center; gap: 10px; }
.badge { padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.sep { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.order-items { display: flex; align-items: center; gap: 10px; }
.order-note { margin-top: 8px; background: #FFF7ED; color: #9A3412; font-size: 12.5px;
  padding: 8px 10px; border-radius: 8px; }
.timeline { display: flex; align-items: flex-start; margin: 16px 0 4px; }
.tl-col { display: flex; flex-direction: column; align-items: center; width: 80px; flex-shrink: 0; }
.tl-dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #D1D5DB; display: flex;
  align-items: center; justify-content: center; }
.tl-dot .material-icons { font-size: 15px; color: #fff; }
.tl-dot .material-icons.tl-cur { font-size: 9px; }
.tl-label { font-size: 10.5px; line-height: 1.1; text-align: center; margin-top: 4px; color: var(--muted);
  font-weight: 500; }
.tl-label.on { color: var(--ink); font-weight: 700; }
.tl-line { flex: 1; height: 3px; background: var(--line); border-radius: 2px; margin-top: 11px; }
.tl-line.on { background: #3B82F6; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.stok-ozet { margin: 8px 0; padding: 8px 10px; background: var(--bg); border-radius: 8px;
  font-size: 13px; display: flex; flex-direction: column; gap: 3px; }

/* -------------------------------------------------- Kanal grid */
.kanal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.kanal-card { background: var(--card); border-radius: 18px; box-shadow: var(--shadow); padding: 14px;
  cursor: pointer; display: flex; flex-direction: column; transition: transform .12s, box-shadow .12s; }
.kanal-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(17,12,46,.1); }
.kanal-top { display: flex; align-items: flex-start; justify-content: space-between; }
.kanal-menu { display: flex; gap: 2px; }
.kanal-go { display: flex; align-items: center; gap: 4px; margin-top: 10px; color: var(--primary);
  font-size: 12.5px; font-weight: 700; }
.kanal-go .material-icons { font-size: 16px; }
.clamp { -webkit-line-clamp: 3; min-height: 36px; }
.kanal-detay { margin-top: 20px; }
.detay-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.detay-head h3 { margin: 0; font-size: 18px; }

/* -------------------------------------------------- Modal / dialog */
.modal-overlay { position: fixed; inset: 0; background: rgba(17,12,46,.45); display: flex;
  align-items: center; justify-content: center; padding: 16px; z-index: 100; backdrop-filter: blur(2px); }
.modal-panel { width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; }
.dialog { background: #fff; border-radius: 20px; padding: 22px; }
.dialog h3 { margin: 0 0 14px; font-size: 18px; font-weight: 800; }
.dialog p { margin: 0 0 10px; font-size: 14px; line-height: 1.5; white-space: pre-line; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-dialog .inp { margin: 0; }
.wide-dialog { max-width: 560px; }
.modal-panel:has(.wide-dialog) { max-width: 560px; }
.upload-img { position: relative; width: fit-content; margin: 0 auto; cursor: pointer; }
.upload-spin { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.6); border-radius: 16px; }
.guide-row { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line);
  border-radius: 12px; padding: 12px; margin-bottom: 14px; }
.form-section-title { font-weight: 800; font-size: 15px; margin: 18px 0 10px; }
.form-section-title:first-of-type { margin-top: 0; }
.kalemler { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.kalem-card { border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; }
.kalem-row { display: flex; align-items: center; gap: 10px; }
.kalem-row .inp.adet { width: 76px; text-align: center; flex-shrink: 0; }
.kalem-info { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* Trash */
.trash-dialog { max-width: 460px; }
.trash-list { display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.trash-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg); }

/* -------------------------------------------------- Snackbar */
#snackbar { position: fixed; left: 50%; bottom: -80px; transform: translateX(-50%); z-index: 200;
  background: #16A34A; color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px;
  font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: bottom .3s ease; max-width: 90vw; }
#snackbar.show { bottom: 24px; }
#snackbar.err { background: #DC2626; }

/* -------------------------------------------------- Responsive: mobile */
@media (max-width: 820px) {
  .topbar .hamburger { display: inline-flex; align-items: center; justify-content: center; }
  .logout-btn span:last-child { display: none; }
  .logout-btn { padding: 8px; }
  .sidebar { position: fixed; top: 0; left: 0; bottom: 0; z-index: 50; width: 260px;
    transform: translateX(-100%); transition: transform .25s ease; padding-top: 70px; }
  .nav-open .sidebar { transform: translateX(0); box-shadow: 8px 0 30px rgba(0,0,0,.2); }
  .nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 45; }
  .content { padding: 16px 14px calc(72px + env(safe-area-inset-bottom)); }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    border: none; background: transparent; cursor: pointer; font-family: inherit; color: var(--muted);
    padding: 6px 2px; border-radius: 10px; }
  .bn-item.on { color: var(--primary); }
  .bn-item .material-icons { font-size: 23px; }
  .bn-label { font-size: 10.5px; font-weight: 600; max-width: 72px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap; }
  .section-head { flex-wrap: wrap; }
  .section-head h2 { font-size: 18px; }
  .stok-btns { flex-direction: column; }
  .stok-btns .btn { min-width: 84px; }
  .kanal-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
}

@media (min-width: 821px) {
  .topbar .hamburger { display: none; }
}
