/* ============================================================
   Visit Häljeboda — adminpanel
   Samma formspråk som sajten: Epilogue + Poppins, vitt/off-white/svart.
   ============================================================ */

@font-face {
  font-family: "Epilogue";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/fonts/epilogue-var-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/poppins-400-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/fonts/poppins-500-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Poppins";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/poppins-600-latin.woff2") format("woff2");
}

:root {
  --paper:    #f4f3f1;
  --white:    #ffffff;
  --ink:      #262626;
  --ink-soft: #5f6368;
  --hair:     rgba(38, 38, 38, 0.13);
  --hair-2:   rgba(38, 38, 38, 0.07);
  --ok:       #2e7d5b;
  --err:      #b3403a;
  --accent:   #262626;

  --display: "Epilogue", "Helvetica Neue", sans-serif;
  --sans: "Poppins", "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --top-h: 4.25rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- Knappar ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid transparent;
  border-radius: 7px;
  font-family: var(--display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
}
.btn--primary { background: var(--ink); color: var(--white); }
.btn--primary:hover { background: #3c3c3c; }
.btn--primary:disabled { opacity: 0.45; cursor: default; }
.btn--ghost { background: transparent; border-color: var(--hair); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn--full { width: 100%; padding: 0.8rem 1.1rem; }
.badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
  font-weight: 600;
}

/* ---------- Inloggning ---------- */
.login {
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}
.login[hidden] { display: none; }
.login__card {
  width: min(400px, 100%);
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 14px;
  padding: clamp(1.75rem, 5vw, 2.5rem);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
}
.login__brand {
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--ink-soft);
}
.login__title {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 0.9rem;
}
.login__sub { margin-top: 0.4rem; color: var(--ink-soft); font-size: 0.9rem; }
.login__card .field { margin-top: 1.25rem; }
.login__card .btn { margin-top: 1.5rem; }
.login__error {
  margin-top: 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 7px;
  background: rgba(179, 64, 58, 0.08);
  color: var(--err);
  font-size: 0.85rem;
}
.login__back {
  display: block;
  margin-top: 1.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.85rem;
  text-decoration: none;
}
.login__back:hover { color: var(--ink); }

/* ---------- Fält ---------- */
.field { display: block; }
.field__label {
  display: block;
  font-family: var(--display);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field__hint {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}
.field__input, .field__area {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--hair);
  border-radius: 8px;
  background: var(--white);
  font-size: 0.92rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.field__area { resize: vertical; min-height: 5.5rem; line-height: 1.55; }
.field__input:focus, .field__area:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(38, 38, 38, 0.07);
}
.field.is-changed .field__input,
.field.is-changed .field__area { border-color: var(--ok); }

/* ---------- Topbar ---------- */
.app[hidden] { display: none; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-inline: clamp(1rem, 3vw, 2rem);
  background: var(--white);
  border-bottom: 1px solid var(--hair);
}
.topbar__left { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
.topbar__brand {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  white-space: nowrap;
}
.topbar__tag { color: var(--ink-soft); font-size: 0.82rem; white-space: nowrap; }
.topbar__right { display: flex; align-items: center; gap: 0.6rem; }

.langs { display: flex; gap: 2px; padding: 3px; background: var(--paper); border-radius: 8px; }
.langs__btn {
  padding: 0.4rem 0.7rem;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.langs__btn:hover { color: var(--ink); }
.langs__btn.is-active { background: var(--white); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.07); }

.saved { font-size: 0.8rem; color: var(--ok); opacity: 0; transition: opacity 0.3s; }
.saved.is-on { opacity: 1; }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 3vw, 2.5rem);
  padding: clamp(1.25rem, 3vw, 2.25rem) clamp(1rem, 3vw, 2rem) 5rem;
  max-width: 1240px;
  margin-inline: auto;
}
.sidenav {
  position: sticky;
  top: calc(var(--top-h) + 1.25rem);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.sidenav__btn {
  text-align: left;
  padding: 0.62rem 0.8rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 0.9rem;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
}
.sidenav__btn:hover { background: rgba(38, 38, 38, 0.045); color: var(--ink); }
.sidenav__btn.is-active { background: var(--ink); color: var(--white); font-weight: 500; }

/* ---------- Innehåll ---------- */
.panel { display: none; }
.panel.is-active { display: block; animation: fade 0.25s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.panel__head { margin-bottom: 1.5rem; }
.panel__head h2 {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.panel__head p { margin-top: 0.3rem; color: var(--ink-soft); font-size: 0.88rem; }

.card {
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 12px;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  margin-bottom: 1rem;
}
.card__title {
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  padding-bottom: 0.8rem;
  margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--hair-2);
}
.card .field + .field { margin-top: 1.1rem; }

/* ---------- Bilder ---------- */
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 1rem; }
.img {
  background: var(--white);
  border: 1px solid var(--hair);
  border-radius: 12px;
  overflow: hidden;
}
.img__thumb {
  aspect-ratio: 3 / 2;
  background: var(--paper) center/cover no-repeat;
  border-bottom: 1px solid var(--hair-2);
}
.img__body { padding: 0.85rem 0.9rem 1rem; }
.img__name { font-family: var(--display); font-size: 0.85rem; font-weight: 600; }
.img__hint { font-size: 0.76rem; color: var(--ink-soft); margin-top: 0.15rem; }
.img__file { display: none; }
.img__btn {
  margin-top: 0.7rem;
  width: 100%;
  padding: 0.48rem;
  border: 1px solid var(--hair);
  border-radius: 7px;
  background: var(--white);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.img__btn:hover { border-color: var(--ink); background: var(--paper); }
.img__btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 1rem);
  z-index: 200;
  padding: 0.75rem 1.15rem;
  border-radius: 9px;
  background: var(--ink);
  color: var(--white);
  font-size: 0.87rem;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease);
}
.toast[hidden] { display: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-err { background: var(--err); }

/* ---------- Responsivt ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    gap: 0.4rem;
    padding-bottom: 0.4rem;
  }
  .sidenav__btn { white-space: nowrap; border: 1px solid var(--hair); }
  .topbar { flex-wrap: wrap; height: auto; padding-block: 0.7rem; }
  .topbar__right { width: 100%; justify-content: space-between; }
}
@media (max-width: 560px) {
  .langs__btn { padding: 0.4rem 0.5rem; font-size: 0.78rem; }
  .topbar__tag { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
