/* ====================================================================
   The Nook Cafe — Yönetim Paneli (Light, sade)
   ==================================================================== */

:root {
  --bg: #fbf9f4;
  --bg-soft: #f5f2eb;
  --surface: #ffffff;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-soft: rgba(0, 0, 0, 0.05);

  --ink: #1c1a17;
  --ink-soft: #57544f;
  --ink-mute: #8e8a82;

  --accent: #5fb8a4;          /* mint — logo primary */
  --accent-soft: #a8dcd0;
  --accent-bg: #eaf6f2;

  --accent-2: #dda77b;        /* tan — logo secondary */
  --accent-2-soft: #ebc4a3;
  --accent-2-bg: #fbf0e6;

  --ok: #2f8f5e;
  --warn: #b87a14;
  --danger: #b8423f;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 1px rgba(0,0,0,0.03);
  --shadow: 0 8px 24px -12px rgba(0,0,0,0.12), 0 2px 6px -2px rgba(0,0,0,0.04);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
               "Segoe UI", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body { min-height: 100dvh; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }

/* ---------- Login --------------------------------------------------- */
.login-wrap {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: 24px;
}
.login-card {
  width: min(400px, 100%);
  padding: 32px 30px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.login-card__logo {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #ffffff;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 18px;
}
.login-card h1 {
  font-size: 22px;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  font-weight: 600;
}
.login-card p.sub {
  color: var(--ink-soft);
  margin: 0 0 24px;
  font-size: 14px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}
.input, textarea.input, select.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input:focus {
  border-color: var(--accent-soft);
  box-shadow: 0 0 0 3px rgba(95, 184, 164, 0.18);
}
textarea.input { resize: vertical; min-height: 90px; }

select.input {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='none' stroke='%231c1a17' stroke-width='1.5' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--hairline);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s var(--ease), border-color 0.12s var(--ease);
  font-weight: 500;
  font-size: 14px;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: scale(0.98); }
.btn--primary {
  background: var(--ink);
  color: #fbf9f4;
  border-color: var(--ink);
}
.btn--primary:hover { background: #2a2622; border-color: #2a2622; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--ink-soft); }
.btn--ghost:hover { background: var(--bg-soft); color: var(--ink); }
.btn--danger { color: var(--danger); border-color: rgba(184,66,63,0.25); }
.btn--danger:hover { background: rgba(184,66,63,0.06); }
.btn--full { width: 100%; }
.btn--sm { padding: 6px 12px; font-size: 13px; }

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  font-size: 14px;
  border: 1px solid var(--hairline);
}
.alert--error { background: #fdf2f1; border-color: rgba(184,66,63,0.25); color: #76211f; }
.alert--success { background: #f0f8f3; border-color: rgba(47,143,94,0.25); color: #1f5a3a; }
.alert--info { background: var(--bg-soft); color: var(--ink-soft); }

.login-help {
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-mute);
}

/* ---------- Shell --------------------------------------------------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100dvh; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
}

.side {
  background: var(--surface);
  border-right: 1px solid var(--hairline-soft);
  padding: 22px 14px 14px;
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.side__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: 12px;
}
.side__brand .topbar__logo {
  width: 32px; height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #ffffff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.side__brand b { font-weight: 600; letter-spacing: -0.005em; font-size: 14px; }
.side__brand small {
  color: var(--ink-mute);
  font-size: 11px;
  display: block;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.side__nav { display: flex; flex-direction: column; gap: 2px; }
.side__link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.12s var(--ease), color 0.12s var(--ease);
}
.side__link:hover { color: var(--ink); background: var(--bg-soft); text-decoration: none; }
.side__link.active {
  background: var(--bg-soft);
  color: var(--ink);
}
.side__link svg { width: 18px; height: 18px; opacity: 0.7; }
.side__link.active svg { opacity: 1; color: var(--accent); }
.side__group {
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 14px 14px 6px;
  font-weight: 500;
}
.side__bottom {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid var(--hairline-soft);
  font-size: 13px;
  display: flex; align-items: center; justify-content: space-between;
}
.side__bottom > div { line-height: 1.3; }
.side__bottom small { color: var(--ink-mute); font-size: 12px; }
.side__bottom a.icon-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--bg-soft);
  display: grid; place-items: center;
  color: var(--ink-soft);
}
.side__bottom a.icon-btn:hover { background: #ebe7de; color: var(--ink); }
.side__bottom a.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Main ---------------------------------------------------- */
.main {
  padding: 28px clamp(18px, 4vw, 36px) 48px;
  max-width: 1200px;
  width: 100%;
}
.topline {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 22px;
}
.topline h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
  margin: 0;
  font-weight: 600;
}
.topline p {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.topline__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Mobile bar */
.mobile-bar {
  display: none;
  align-items: center; justify-content: space-between;
  padding: 14px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--hairline-soft);
  position: sticky; top: 0; z-index: 20;
}
@media (max-width: 880px) {
  .mobile-bar { display: flex; }
  .main { padding-top: 0; padding-left: 0; padding-right: 0; }
  .main > :not(.mobile-bar) { padding-left: 18px; padding-right: 18px; }
  .main > .items-grid,
  .main > .stats {
    padding-left: 18px; padding-right: 18px;
  }
}

/* ---------- Stats --------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  padding: 18px;
}
.stat__label {
  font-size: 13px;
  color: var(--ink-mute);
  font-weight: 500;
}
.stat__value {
  font-size: 32px;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin-top: 4px;
  color: var(--ink);
}
.stat__hint {
  color: var(--ink-mute);
  font-size: 12px;
  margin-top: 2px;
}

/* ---------- Toolbar (search/filter) -------------------------------- */
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 18px;
}
.toolbar .input { padding: 8px 12px; font-size: 14px; }
.toolbar__search { flex: 1; min-width: 200px; }

/* ---------- Items grid (card view) --------------------------------- */
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.item-card {
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.item-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.item-card__media {
  aspect-ratio: 16/10;
  background: var(--bg-soft) center/cover no-repeat;
  position: relative;
}
.item-card__media--placeholder {
  display: grid; place-items: center;
  color: var(--ink-mute);
  background: linear-gradient(180deg, #f7f3eb, #ece6da);
}
.item-card__badges {
  position: absolute; left: 10px; top: 10px;
  display: flex; gap: 6px; flex-wrap: wrap;
}
.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--hairline);
  color: var(--ink-soft);
}
.badge--ok { color: var(--ok); border-color: rgba(47,143,94,0.3); background: #f0f8f3; }
.badge--off { color: var(--ink-mute); }

.item-card__body {
  padding: 12px 14px 0;
  display: flex; flex-direction: column;
  gap: 4px;
  flex: 1;
}
.item-card__title {
  font-weight: 600;
  line-height: 1.3;
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}
.item-card__meta {
  color: var(--ink-mute);
  font-size: 12px;
}
.item-card__price {
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
  font-size: 15px;
}
.item-card__actions {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px;
  margin-top: auto;
}

/* ---------- Switch -------------------------------------------------- */
.switch {
  display: inline-flex; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.switch input { display: none; }
.switch__track {
  width: 34px; height: 20px;
  background: #d8d3c7;
  border-radius: 999px;
  position: relative;
  transition: background 0.2s var(--ease);
}
.switch__track::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch__track { background: var(--ok); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch__label { font-size: 13px; color: var(--ink-soft); }

/* ---------- Form layouts ------------------------------------------- */
.card-form {
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-lg);
  padding: 22px;
}
.card-form h3 {
  margin: 0 0 16px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.005em;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 720px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
}

.image-pick {
  display: flex; gap: 14px; align-items: flex-start;
}
.image-pick__preview {
  width: 120px; height: 120px;
  border-radius: var(--radius-md);
  background: var(--bg-soft) center/cover no-repeat;
  border: 1px dashed var(--hairline);
  display: grid; place-items: center;
  color: var(--ink-mute);
  flex-shrink: 0;
  font-size: 12px;
}
.image-pick__hint { font-size: 12px; color: var(--ink-mute); margin-top: 6px; }
.btn-file { position: relative; overflow: hidden; }
.btn-file input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

.form-footer {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 20px;
}

/* ---------- Empty / muted ------------------------------------------ */
.empty {
  padding: 50px 20px;
  text-align: center;
  color: var(--ink-mute);
  border: 1px dashed var(--hairline);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 14px;
}
.muted { color: var(--ink-mute); }

/* ---------- Çoklu dil giriş satırı --------------------------------- */
.lang-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}
.lang-pair .field { margin-bottom: 14px; }
.lang-flag {
  display: inline-block;
  margin-right: 6px;
  filter: saturate(1.1);
}
@media (max-width: 720px) {
  .lang-pair { grid-template-columns: 1fr; gap: 8px; }
  .lang-pair .field { margin-bottom: 8px; }
}

/* Kategori/menü liste satırı (TR + EN + sort + actions) */
.cat-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline-soft);
}
.cat-row__inputs {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 240px;
  flex-wrap: wrap;
}
.cat-row__inputs > .input {
  flex: 1;
  min-width: 140px;
}
.cat-row__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
@media (max-width: 600px) {
  .cat-row__inputs > .input { min-width: 100%; }
  .cat-row__inputs > .input[name="sort_order"] { max-width: 90px; min-width: 90px; }
}

/* ---------- Skeleton / shimmer ------------------------------------ */
.skeleton {
  position: relative;
  background-color: #eee6d6;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  background-position: -200% 0;
  animation: shimmer 1.4s linear infinite;
  color: transparent !important;
  border-color: transparent !important;
}
.skeleton * { visibility: hidden !important; }
.sk-line {
  display: block;
  height: 12px;
  border-radius: 6px;
  background-color: #eee6d6;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.4s linear infinite;
}
.sk-line + .sk-line { margin-top: 8px; }
.sk-line--lg { height: 22px; }
.sk-line--sm { height: 10px; }
.sk-card {
  background: var(--surface);
  border: 1px solid var(--hairline-soft);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sk-card__media {
  aspect-ratio: 16/10;
  background-color: #eee6d6;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.4s linear infinite;
}
.sk-card__body { padding: 14px; }

@keyframes shimmer {
  0%   { background-position: -150% 0; }
  100% { background-position: 250% 0; }
}

.item-card__media.is-loading {
  background-color: #eee6d6;
  background-image: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: shimmer 1.4s linear infinite;
}
.item-card__media.is-ready { animation: img-in 0.35s var(--ease); }
@keyframes img-in { from { opacity: 0; } to { opacity: 1; } }

/* Switch loading state */
.switch.is-busy { opacity: 0.6; pointer-events: none; }

/* ---------- Top progress bar -------------------------------------- */
#nook-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: var(--accent);
  z-index: 9999;
  opacity: 0;
  transition: width 0.3s ease, opacity 0.3s ease;
  pointer-events: none;
}
#nook-progress.active { opacity: 1; }
#nook-progress.done   { width: 100% !important; opacity: 0; }

/* ---------- Icon button (top header right) ------------------------- */
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--ink-soft);
  cursor: pointer;
}
.icon-btn:hover { background: #ebe7de; color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
