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

* { box-sizing: border-box; }

:root {
  --ink: #1d2233;
  --muted: #656b82;
  --bg: #f2f3f5;
  --panel: #ffffff;
  --border: #e2e4ea;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --danger: #b3432f;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
}

h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 1rem;
}

.admin {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr) 420px;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.admin__sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .8rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin__brand {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin: 0 0 .5rem;
}

.admin__sidebar hr { border: none; border-top: 1px solid var(--border); margin: .4rem 0; }

.admin__previewLink { font-size: .85rem; color: var(--accent); text-decoration: none; font-weight: 500; }
.admin__previewLink:hover { text-decoration: underline; }

.qr-block { border: 1px solid var(--border); border-radius: 10px; padding: .9rem; background: #fbfbfc; }
.qr-block .field { margin-bottom: .6rem; }
.qr-block input[type="text"] { font-size: .78rem; padding: .45rem .55rem; }
.qr-holder { display: flex; justify-content: center; background: #fff; border-radius: 8px; padding: .5rem; }
.qr-holder svg { width: 100%; max-width: 140px; height: auto; display: block; }
.qr-url { font-size: .72rem; color: var(--muted); word-break: break-all; text-align: center; margin: .5rem 0; font-family: monospace; }

.admin__back { margin-top: auto; font-size: .82rem; color: var(--muted); text-decoration: none; }
.admin__back:hover { color: var(--ink); }

.status { font-size: .82rem; min-height: 1.2em; color: var(--accent); margin: 0; }
.status.error { color: var(--danger); }

/* ---------- Main form ---------- */
.admin__main {
  padding: 2rem 2.25rem;
  max-width: 720px;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.4rem 1.5rem;
}

.panel__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.panel__head h2 { margin-bottom: 0; }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; font-size: .85rem; }
.field:last-child { margin-bottom: 0; }
.field > span { font-weight: 500; color: var(--muted); }

input[type="text"], input[type="number"], select {
  font-family: inherit;
  font-size: .9rem;
  padding: .55rem .7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
input[type="text"]:focus, input[type="number"]:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

input[type="file"] { font-size: .82rem; }

.field--color { flex-direction: row; align-items: center; justify-content: space-between; }
.field--color input[type="color"] {
  width: 44px; height: 30px; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }

.logo-preview {
  display: none;
  height: 56px;
  width: 56px;
  object-fit: contain;
  margin-top: .4rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fafafb;
}

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 8px;
  padding: .6rem 1rem;
  border: 1px solid transparent;
  cursor: pointer;
}
.btn--block { width: 100%; }
.btn--small { padding: .4rem .75rem; font-size: .8rem; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { background: #275c4e; }
.btn--ghost { background: #fff; border-color: var(--border); color: var(--ink); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--danger { background: #fff; border-color: var(--border); color: var(--danger); }
.btn--danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------- Menu editor ---------- */
.hint { font-size: .78rem; color: var(--muted); margin: -.4rem 0 0; line-height: 1.4; }

.lang-pills { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.lang-pill {
  font-size: .8rem; font-weight: 600; padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--ink); cursor: pointer;
}
.lang-pill.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.add-lang-row { display: flex; gap: .5rem; }
.add-lang-row input { flex: 1; }
.panel hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.field__lang {
  display: inline-block; font-size: .7rem; font-weight: 700; color: var(--accent);
  background: #eaf2ef; border-radius: 5px; padding: 1px 6px; margin-left: .3rem; text-transform: uppercase;
}

.item__toggle { margin-bottom: .5rem; }
.checkbox-label { display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); cursor: pointer; }
.checkbox-label input { width: 15px; height: 15px; flex-shrink: 0; }

.category {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: .9rem;
  background: #fbfbfc;
}
.category:last-child { margin-bottom: 0; }
.category__head { display: flex; gap: .6rem; align-items: center; margin-bottom: .7rem; }
.category__head .cat-name { flex: 1; font-weight: 600; }

.items { display: flex; flex-direction: column; gap: .6rem; margin-bottom: .6rem; }

.item {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .7rem .8rem;
}
.item__row { display: flex; gap: .5rem; align-items: center; margin-bottom: .45rem; }
.item__row:last-child { margin-bottom: 0; }
.item__row input[type="text"], .item__row textarea { flex: 1; }
.item__row textarea { min-height: 46px; resize: vertical; font-family: inherit; font-size: .85rem; padding: .5rem .6rem; border: 1px solid var(--border); border-radius: 8px; }
.item .it-name { font-weight: 600; }
.item__media { display: flex; gap: .5rem; align-items: center; }
.item__media input[type="file"] { flex: 1; font-size: .78rem; }
.item-thumb { height: 32px; width: 32px; border-radius: 6px; object-fit: cover; border: 1px solid var(--border); display: none; flex-shrink: 0; }

.subrows { display: flex; flex-direction: column; gap: .35rem; margin: .3rem 0; }
.subrow { display: grid; grid-template-columns: 1fr 1fr auto; gap: .4rem; }
.subrow input { font-size: .82rem; padding: .4rem .55rem; }
.subrow-add-wrap { display: flex; gap: .5rem; margin-bottom: .3rem; }

.item__footer { display: flex; justify-content: flex-end; margin-top: .4rem; }

/* ---------- Preview (right column) ---------- */
.admin__preview {
  background: var(--panel);
  border-left: 1px solid var(--border);
  padding: 2rem 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone {
  background: #14161c;
  border-radius: 32px;
  padding: 14px 10px;
  box-shadow: 0 24px 48px -28px rgba(20, 22, 28, .55);
  position: relative;
  width: min(300px, 90%);
}
.phone iframe {
  width: 100%;
  aspect-ratio: 9 / 19.5;
  border: none;
  border-radius: 20px;
  background: #000;
  display: block;
}
.phone__notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 14px;
  border-radius: 8px;
  background: #14161c;
  border: 1px solid #2a2d36;
}

.admin__previewHint { font-size: .78rem; color: var(--muted); margin-top: 1rem; line-height: 1.4; text-align: center; max-width: 220px; }

@media (max-width: 1320px) {
  .admin { grid-template-columns: 220px minmax(0, 1fr); }
  .admin__preview { display: none; }
}

@media (max-width: 720px) {
  .admin { grid-template-columns: 1fr; }
  .admin__sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .admin__sidebar > * { flex: 1 1 auto; }
  .admin__back { flex-basis: 100%; }
}
