/* MinKennel – startsidan, inloggning, registrering och redigeringsvyn.
   Mobil först: grundreglerna gäller mobilen, @media-blocken längst ner gör det bredare. */

:root {
  /* Samma färger som Hundtrimmet: mörkgrönt, guld och krämvitt */
  --bg: #f6f1e6;
  --bg-alt: #ede5d3;
  --card: #fffdf8;
  --border: #e3dccd;
  --ink: #22302a;
  --ink-muted: #56645d;
  --accent: #1d3a2c;
  --accent-hover: #2a4f3d;
  --accent-soft: #e4ebe5;
  --green: #2a4f3d;
  --green-900: #15291f;
  --gold: #c9a24a;
  --gold-light: #e0c27d;
  --gold-dark: #7a5c18; /* guld för text på ljus bakgrund, klarar WCAG-kontrast (minst 4.5:1) */
  --field-border: #857c6d; /* kant på formulärfält, minst 3:1 så fälten syns */
  --danger: #a32020;
  --radius: 14px;
  --font-head: 'Fraunces', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.2;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.brand {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--ink);
  text-decoration: none;
}

.brand small {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.7rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-left: 6px;
}

.eyebrow {
  color: var(--gold-dark);
  font-family: var(--font-body);
  font-weight: 600;
  letter-spacing: 2px;
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

/* ===== Knappar ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 11px 20px;
  border-radius: 30px;
  border: 2px solid transparent;
  text-decoration: none;
  cursor: pointer;
  min-height: 44px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--ink);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.btn-danger:hover {
  border-color: var(--danger);
}

.btn-small {
  padding: 6px 14px;
  font-size: 0.82rem;
  min-height: 36px;
}

.btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* ===== Formulär ===== */

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 14px;
}

.field label,
.field .label {
  font-size: 0.85rem;
  font-weight: 600;
}

.field .hint {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.field input,
.field textarea,
.field select {
  background: #fff;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--ink);
  width: 100%;
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.field-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.9rem;
  margin-bottom: 14px;
}

.field-check input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.slug-field {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.slug-field span {
  padding: 10px 0 10px 12px;
  color: var(--ink-muted);
  font-size: 0.95rem;
  white-space: nowrap;
}

.slug-field input {
  border: none;
  padding-left: 2px;
  min-width: 0;
}

.msg {
  font-size: 0.9rem;
  font-weight: 600;
  min-height: 1.4em;
}

.msg.error {
  color: var(--danger);
}

.msg.ok {
  color: var(--green);
}

/* ===== Små sidor: logga in / registrera ===== */

.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px;
  gap: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
}

.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}

.auth-card .lead {
  color: var(--ink-muted);
  margin-bottom: 1.4rem;
  font-size: 0.95rem;
}

.auth-card .btn-primary {
  width: 100%;
  margin-top: 6px;
}

.auth-foot {
  font-size: 0.9rem;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 16px;
}

/* ===== Startsidan ===== */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  max-width: 1100px;
  margin: 0 auto;
}

/* Mörkgrönt band högst upp (meny + startbild) */
.landing-band {
  background: var(--accent);
  color: var(--bg);
}

.landing-band .brand {
  color: var(--bg);
}

.landing-band .brand small {
  color: var(--gold-light);
}

.landing-band .eyebrow {
  color: var(--gold);
}

.landing-band .landing-hero p {
  color: #d9d4c6;
}

.landing-band .btn-primary {
  background: var(--gold);
  color: var(--green-900);
}

.landing-band .btn-primary:hover {
  background: var(--gold-light);
}

.landing-band .btn-outline {
  border-color: rgba(246, 241, 230, 0.45);
  color: var(--bg);
}

.landing-band .btn-outline:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.landing-band :focus-visible {
  outline-color: var(--gold);
}

.landing-band .landing-shot {
  border: 3px solid var(--gold);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.landing-hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 16px 48px;
  display: grid;
  gap: 32px;
}

.landing-hero h1 {
  font-size: 2.1rem;
  margin-bottom: 1rem;
}

.landing-hero p {
  color: var(--ink-muted);
  font-size: 1.05rem;
  margin-bottom: 1.4rem;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-shot {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.landing-shot iframe {
  width: 200%;
  height: 200%;
  border: 0;
  transform: scale(0.5);
  transform-origin: 0 0;
  pointer-events: none;
}

.features {
  background: var(--bg-alt);
  padding: 48px 16px;
}

.features-grid {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.feature {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature {
  border-top: 3px solid var(--gold);
}

.feature h3 {
  font-size: 1.05rem;
  margin-bottom: 0.3rem;
}

.feature p {
  color: var(--ink-muted);
  font-size: 0.92rem;
}

.price {
  max-width: 560px;
  margin: 0 auto;
  padding: 56px 16px;
  text-align: center;
}

.price h2 {
  font-size: 1.6rem;
  margin-bottom: 0.6rem;
}

.price-amount {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: 2.4rem;
  color: var(--accent);
}

.price p {
  color: var(--ink-muted);
  margin-bottom: 1.2rem;
}

.foot {
  background: var(--green-900);
  padding: 24px 16px;
  text-align: center;
  color: #d9d4c6;
  font-size: 0.85rem;
}

.foot a {
  color: var(--gold-light);
}

.foot :focus-visible {
  outline-color: var(--gold);
}

/* ===== Textsidor: villkor och integritetspolicy ===== */

.doc {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.doc h1 {
  font-size: 1.9rem;
  margin-bottom: 0.4rem;
}

.doc .updated {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: 1.6rem;
}

.doc h2 {
  font-size: 1.2rem;
  margin: 2rem 0 0.6rem;
}

.doc h3 {
  font-size: 1rem;
  margin: 1.2rem 0 0.4rem;
}

.doc p,
.doc li {
  margin-bottom: 0.7rem;
}

.doc ul,
.doc ol {
  padding-left: 1.4rem;
}

.doc .summary {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 1.6rem;
}

.doc .summary ul {
  margin-top: 0.4rem;
}

.doc table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.doc th,
.doc td {
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  padding: 8px 8px 8px 0;
}

.doc-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
}

/* ===== Redigeringsvyn ===== */

.editor-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.editor-top .brand {
  margin-right: auto;
}

.status-pill {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: #ffe9a8;
  color: #4a3a00;
}

.status-pill.live {
  background: #dcefe4;
  color: #1f4d33;
}

.editor {
  display: grid;
}

.editor-panel {
  padding: 16px;
  min-width: 0;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: thin;
}

.tab {
  flex-shrink: 0;
  background: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.tab:hover {
  background: var(--bg-alt);
}

.tab[aria-selected="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.tab .count {
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0 6px;
  font-size: 0.72rem;
  margin-left: 4px;
}

.panel h2 {
  font-size: 1.2rem;
  margin-bottom: 0.3rem;
}

.panel .lead {
  color: var(--ink-muted);
  font-size: 0.9rem;
  margin-bottom: 1.2rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 16px;
  margin-bottom: 16px;
}

legend {
  font-family: var(--font-head);
  font-weight: 800;
  padding: 0 6px;
}

.save-row {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Färgval */
.themes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
}

.theme-option input {
  position: absolute;
  opacity: 0;
}

.theme-option:has(input:checked) {
  border-color: var(--ink);
}

.theme-option:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 6px solid;
}

/* Stilval – små skisser av hur sidan ser ut */
.styles {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 420px) {
  .styles {
    grid-template-columns: repeat(3, 1fr);
  }
}

.style-option {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  position: relative;
}

.style-option input {
  position: absolute;
  opacity: 0;
}

.style-option:has(input:checked) {
  border-color: var(--ink);
}

.style-option:has(input:focus-visible) {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.style-preview {
  display: grid;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-alt);
  margin-bottom: 4px;
}

.style-preview-ljus {
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px;
}

.style-preview-ljus span:nth-child(1) {
  background: linear-gradient(var(--ink) 0 0) top / 80% 6px no-repeat, linear-gradient(var(--border) 0 0) 0 14px / 60% 4px no-repeat;
}

.style-preview-ljus span:nth-child(2) {
  background: #c9b99f;
  border-radius: 4px;
}

.style-preview-ljus span:nth-child(3) {
  display: none;
}

.style-preview-elegant {
  background: linear-gradient(rgba(20, 16, 12, 0.55), rgba(20, 16, 12, 0.55)), linear-gradient(135deg, #b89a6e, #6d5a43);
  place-content: center;
  justify-items: center;
  gap: 5px;
}

.style-preview-elegant span:nth-child(1) {
  width: 40px;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
}

.style-preview-elegant span:nth-child(2) {
  width: 80px;
  height: 8px;
  background: #fff;
}

.style-preview-elegant span:nth-child(3) {
  width: 34px;
  height: 10px;
  border: 1px solid #fff;
}

.style-preview-lekfull {
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: radial-gradient(circle at 20% 80%, #e7d3c6 0 8px, transparent 9px), radial-gradient(circle at 85% 20%, #e7d3c6 0 6px, transparent 7px), #f6ece5;
}

.style-preview-lekfull span:nth-child(1) {
  height: 26px;
  background: linear-gradient(var(--ink) 0 0) top / 80% 6px no-repeat, linear-gradient(#c97b5a 0 0) bottom left / 60% 10px no-repeat;
  border-radius: 6px;
}

.style-preview-lekfull span:nth-child(2) {
  height: 46px;
  background: #d9a88c;
  border-radius: 58% 42% 55% 45% / 50% 60% 40% 50%;
}

.style-preview-lekfull span:nth-child(3) {
  display: none;
}

/* Bildfält */
.image-field {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.image-thumb {
  width: 96px;
  height: 72px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-alt);
  border: 1px dashed var(--border);
}

.image-field input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Galleri i redigeringen */
.gallery-edit {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 6px 0 8px;
}

.gallery-edit figure {
  position: relative;
}

.gallery-edit img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.gallery-edit button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-add input[type=file] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* Valpar i redigeringen */
.puppy-rows {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.puppy-row {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 4px 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.puppy-row img,
.puppy-row .no-img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-alt);
  grid-row: span 2;
}

.puppy-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.puppy-row select {
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 0.85rem;
}

.sub-box {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.sub-box h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

/* Listor (hundar, kullar, nyheter, anmälningar) */
.item-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.item img,
.item .no-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-alt);
  flex-shrink: 0;
}

.item-text {
  flex: 1;
  min-width: 0;
}

.item-text strong {
  display: block;
}

.item-text span {
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.empty {
  color: var(--ink-muted);
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  font-size: 0.92rem;
}

.interest {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.interest.handled {
  opacity: 0.65;
}

.interest-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.interest p {
  font-size: 0.9rem;
  color: var(--ink-muted);
  white-space: pre-wrap;
}

.interest-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* Förhandsvisningen – på mobilen öppnas sidan i en ny flik i stället */
.preview {
  display: none;
}

.preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.82rem;
  color: var(--ink-muted);
}

.preview-frame {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  height: calc(100vh - 140px);
  margin: 0 auto;
  transition: width 0.2s ease;
  width: 100%;
}

.preview-frame.mobile {
  width: 390px;
}

/* Två ramar ovanpå varandra – den som är klar visas (se redigera.js) */
.preview-frame {
  position: relative;
}

.preview-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  opacity: 0;
  visibility: hidden;
}

.preview-frame iframe.front {
  opacity: 1;
  visibility: visible;
}

.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.seg button {
  background: #fff;
  border: none;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.seg button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.kennel-picker {
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

/* ===== Bredare skärmar ===== */

@media (min-width: 700px) {
  .auth-card {
    padding: 32px;
  }

  .landing-hero {
    grid-template-columns: 1fr 1fr;
    align-items: center;
    padding: 56px 24px 72px;
  }

  .landing-hero h1 {
    font-size: 2.8rem;
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .themes {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (min-width: 1100px) {
  .editor {
    grid-template-columns: 460px 1fr;
    align-items: start;
  }

  .editor-panel {
    padding: 20px 24px;
    border-right: 1px solid var(--border);
    min-height: calc(100vh - 62px);
  }

  .themes {
    grid-template-columns: repeat(3, 1fr);
  }

  .preview {
    display: block;
    position: sticky;
    top: 62px;
    padding: 16px 24px;
  }

  .open-preview-mobile {
    display: none;
  }
}
