:root {
  --teal:   #0f766e;
  --teal-dk:#115e59;
  --gold:   #d4a017;
  --red:    #dc2626;
  --ink:    #0b1f2a;
  --muted:  #5b6b78;
  --line:   #e6ecef;
  --bg:     #f6f8fa;
  --card:   #fff;
  --shadow: 0 4px 14px rgba(15,118,110,.08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* Header */
header {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.nav { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
}
.brand .dot { color: var(--gold); }
.brand .admin-tag {
  font-family: 'Inter', sans-serif; font-size: 11px;
  background: var(--teal); color: #fff; padding: 3px 8px;
  border-radius: 999px; font-weight: 600; letter-spacing: .5px;
  margin-left: 4px;
}
.nav .actions { display: flex; gap: 10px; align-items: center; }

/* Language switcher (EN | RU) */
.lang-switch {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
}
.lang-switch button {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lang-switch button:hover { color: var(--ink); }
.lang-switch button.active {
  background: var(--teal);
  color: #fff;
}
.nav a { color: var(--muted); font-size: 14px; text-decoration: none; }
.nav a:hover { color: var(--teal); }
.btn-logout {
  padding: 7px 14px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* Login screen */
.login {
  min-height: calc(100vh - 60px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 12px 40px rgba(11,31,42,.1);
  padding: 36px; max-width: 400px; width: 100%;
}
.login-card h1 {
  font-family: 'Playfair Display', serif;
  font-size: 26px; margin: 0 0 6px;
}
.login-card p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.login-card input {
  width: 100%; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 15px; font-family: inherit; outline: none;
  transition: border-color .15s;
}
.login-card input:focus { border-color: var(--teal); }
.login-card button {
  width: 100%; margin-top: 14px;
  padding: 12px; border: 0; border-radius: 10px;
  background: var(--teal); color: #fff;
  font-weight: 600; font-size: 15px; cursor: pointer;
  font-family: inherit;
}
.login-card button:hover { background: var(--teal-dk); }
.login-hint {
  margin-top: 16px; font-size: 12px; color: var(--muted);
  background: #fffbeb; border: 1px solid #fde68a;
  padding: 10px 12px; border-radius: 8px;
}

/* Admin layout */
.admin { padding: 30px 0 80px; }
.page-head {
  display: flex; justify-content: space-between; align-items: end;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 26px;
}
.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 30px; font-weight: 700; margin: 0;
}
.page-sub { color: var(--muted); margin: 6px 0 0; font-size: 14px; }
.btn-primary {
  background: var(--teal); color: #fff; border: 0;
  padding: 11px 20px; border-radius: 10px;
  font-weight: 600; font-size: 14px; cursor: pointer;
  font-family: inherit;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary:hover { background: var(--teal-dk); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-secondary {
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  padding: 11px 18px; border-radius: 10px;
  font-weight: 500; font-size: 14px; cursor: pointer;
  font-family: inherit;
}
.btn-secondary:hover { border-color: var(--teal); color: var(--teal); }
.btn-danger {
  background: #fff; color: var(--red); border: 1px solid #fecaca;
  padding: 8px 14px; border-radius: 8px;
  font-weight: 500; font-size: 13px; cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { background: var(--red); color: #fff; }

/* Cards */
.card {
  background: var(--card); border-radius: 12px;
  box-shadow: var(--shadow); padding: 22px;
  margin-bottom: 22px;
}
.card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px; margin: 0 0 14px;
}
.manage-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 6px; flex-wrap: wrap;
}
.manage-head h2 { margin: 0; }

/* ── Collapsible cards ────────────────────────────────────── */
.card--collapsible > h2,
.card--collapsible > .manage-head {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 36px;          /* room for the chevron */
  margin-bottom: 0;
  transition: margin-bottom 0.18s;
}
/* Chevron indicator — rotates when expanded */
.card--collapsible > h2::after,
.card--collapsible > .manage-head::after {
  content: "";
  position: absolute;
  right: 6px; top: 50%;
  width: 9px; height: 9px;
  margin-top: -8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);     /* expanded — chevron points down */
  transition: transform 0.2s, border-color 0.18s, margin-top 0.18s;
}
.card--collapsible:hover > h2::after,
.card--collapsible:hover > .manage-head::after {
  border-color: var(--teal);
}
.card--collapsible.is-collapsed > h2::after,
.card--collapsible.is-collapsed > .manage-head::after {
  transform: rotate(-45deg);    /* collapsed — chevron points right */
  margin-top: -4px;
}
/* Hide everything in the card except the header when collapsed */
.card--collapsible.is-collapsed {
  padding-bottom: 22px;
}
.card--collapsible.is-collapsed > h2 { margin: 0; }
.card--collapsible.is-collapsed > *:not(h2):not(.manage-head) {
  display: none !important;
}

/* Form */
.form-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 13px; font-weight: 500; color: var(--ink);
}
.field label .req { color: var(--red); }
.field label .inline-add {
  margin-left: 8px; padding: 2px 8px; font-size: 11px;
  background: #fff; color: var(--teal);
  border: 1px solid var(--line); border-radius: 6px;
  cursor: pointer; font-family: inherit; font-weight: 500;
}
.field label .inline-add:hover { border-color: var(--teal); background: #f0fdfa; }
.field input, .field textarea, .field select {
  padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 14px; font-family: inherit;
  background: #fff; outline: none; color: var(--ink);
  transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  border-color: var(--teal);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 12px; color: var(--muted); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

#picker-map {
  height: 320px; border-radius: 10px;
  border: 1px solid var(--line); margin-top: 6px;
}

/* Image uploader */
.image-uploader {
  display: flex;
  gap: 16px;
  align-items: stretch;
  flex-wrap: wrap;
}
.image-uploader__preview {
  flex: 0 0 200px;
  width: 200px;
  aspect-ratio: 4 / 3;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  background: #f9fbfc;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
.image-uploader__preview img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.image-uploader__empty { padding: 8px; text-align: center; }
.image-uploader__controls {
  flex: 1 1 320px;
  display: flex; flex-direction: column; gap: 10px;
  min-width: 0;
}
.image-uploader__controls input[type="url"] { width: 100%; }
.image-uploader__actions {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.image-uploader__actions label.btn-secondary {
  display: inline-block; line-height: 1;
}
.image-uploader__status {
  font-size: 13px;
  color: var(--muted);
}
.image-uploader__status.err { color: var(--red); }
.image-uploader__status.ok  { color: var(--teal); }

/* Multi-select checkbox lists (used by recommendations form) */
.checkbox-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px 14px;
  max-height: 220px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfc;
}
.checkbox-list label {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--ink);
  user-select: none;
  transition: background .12s;
}
.checkbox-list label:hover { background: #fff; }
.checkbox-list input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--teal);
  margin: 0;
}
.checkbox-list .empty {
  grid-column: 1 / -1;
  text-align: center; color: var(--muted);
  padding: 12px;
}

/* Grouped variant: cities are collapsible <details> blocks. */
.checkbox-list--grouped {
  display: block;
  grid-template-columns: none;
  padding: 4px;
}
.checkbox-list--grouped details {
  border-bottom: 1px solid var(--line);
}
.checkbox-list--grouped details:last-child { border-bottom: none; }
.checkbox-list--grouped summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  border-radius: 6px;
}
.checkbox-list--grouped summary::-webkit-details-marker { display: none; }
.checkbox-list--grouped summary::marker { content: ''; }
.checkbox-list--grouped summary::before {
  content: "▶";
  font-size: 9px;
  color: var(--muted);
  transition: transform 0.15s;
  display: inline-block;
}
.checkbox-list--grouped details[open] > summary::before {
  transform: rotate(90deg);
}
.checkbox-list--grouped summary:hover { background: #fff; }
.checkbox-list--grouped .cb-group__name { color: var(--ink); }
.checkbox-list--grouped .cb-group__count {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  background: var(--line);
  padding: 1px 8px;
  border-radius: 999px;
}
.checkbox-list--grouped .cb-group__ticked {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: rgba(15,118,110,0.10);
  padding: 1px 8px;
  border-radius: 999px;
}
.checkbox-list--grouped .cb-group__items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px 14px;
  padding: 4px 10px 14px 32px;
}

@media (max-width: 560px) {
  .image-uploader__preview { width: 100%; flex-basis: 100%; }
}
.picker-hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 18px; padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* List */
.list-table { width: 100%; border-collapse: collapse; }
.list-table thead th {
  text-align: left; font-size: 12px; font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: .4px;
  padding: 12px 10px; border-bottom: 1px solid var(--line);
}
.list-table tbody td {
  padding: 14px 10px; border-bottom: 1px solid var(--line);
  font-size: 14px; vertical-align: middle;
}
.list-table tbody tr:hover { background: #f9fbfc; }
.thumb {
  width: 60px; height: 44px; border-radius: 6px;
  object-fit: cover; background: linear-gradient(135deg, #5eead4, var(--teal));
}
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.pubdot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; background: #22c55e; margin-right: 6px;
}
.pubdot.off { background: #cbd5e1; }
.empty-row td {
  text-align: center; color: var(--muted);
  padding: 40px 20px !important; font-size: 14px;
}

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--ink); color: #fff;
  padding: 14px 18px; border-radius: 10px;
  font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transform: translateY(100px); opacity: 0;
  transition: all .3s ease;
  z-index: 200; max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok  { background: #065f46; }
.toast.err { background: #991b1b; }

.hidden { display: none !important; }

@media (max-width: 720px) {
  .list-table thead { display: none; }
  .list-table tbody td { display: block; padding: 8px 10px; border: 0; }
  .list-table tbody tr {
    display: block; border: 1px solid var(--line);
    border-radius: 10px; padding: 8px; margin-bottom: 10px;
  }
  .row-actions { justify-content: flex-start; padding-top: 6px; }
}
