/* assets/styles.css — Light & Fresh Cookbook Theme
   - Minimalistische lichte UI
   - Zachte schaduwen, ronde hoeken
   - Heldere focus-states en goede contrasten
*/

:root{
  /* Kleurenpalet (licht, fris) */
  --bg:            #fffdfa;       /* bijna-wit, warm */
  --surface:       #ffffff;       /* kaarten/velden */
  --ink:           #1f2937;       /* primaire tekst */
  --muted:         #6b7280;       /* secundaire tekst */
  --line:          #e5e7eb;       /* borders */
  --accent:        #2e7d32;       /* vers groen */
  --accent-ink:    #ffffff;
  --accent-soft:   #e8f5e9;       /* lichtgroene tint */
  --accent-soft-2: #c8e6c9;
  --ok:            #16a34a;       /* knalgroen OK */
  --danger:        #e11d48;       /* framboosrood */
  --card-shadow:   rgba(16, 24, 40, .08);
  --card-shadow-2: rgba(16, 24, 40, .12);
  --radius-lg:     16px;
  --radius-md:     12px;
  --radius-sm:     10px;
}

*{ box-sizing:border-box }
html,body{
  margin:0; padding:0; height:100%;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a{ color: var(--accent); text-decoration: none }
a:hover{ text-decoration: underline }

.container{ max-width: 1100px; margin: 0 auto; padding: 20px }

/* Simpel: onder elk <li> wat ruimte (ook de laatste) */
ol > li {
  margin-bottom: 0.5rem; /* pas aan naar wens */
}


/* -----------------------------------------
   Header
----------------------------------------- */
.header{
  display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;
  margin-bottom: 18px;
}
.logo{
  font-weight: 800; font-size: 20px; display:flex; align-items:center; gap:10px;
}
.logo span, .logo a{ color: var(--ink); text-decoration:none }

/* -----------------------------------------
   Knoppen (basis + varianten)
----------------------------------------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  background: var(--accent); color: var(--accent-ink);
  border: none; padding: 10px 14px; border-radius: var(--radius-md);
  font-weight: 700; cursor: pointer; box-shadow: 0 6px 16px var(--card-shadow);
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease, color .12s ease;
}
.btn:hover{ transform: translateY(-1px); box-shadow: 0 10px 24px var(--card-shadow-2); }
.btn:active{ transform: translateY(0); }
.btn:focus-visible{ outline: 3px solid var(--accent-soft-2); outline-offset: 2px; }

.btn.secondary{
  background: #ecf2ff; color: #1e3a8a;
  border: 1px solid #dbe3ff;
}
.btn.secondary:hover{ background: #e3ecff; }

.btn.danger{ background: var(--danger); color:#fff; }
.btn.ok{ background: var(--ok); color:#fff; }

/* Kleine/ghost/icon varianten voor compacte acties (bijv. ingrediënten) */
.btn.small{ padding: 6px 10px; border-radius: var(--radius-sm); font-size: 14px; box-shadow: 0 2px 8px var(--card-shadow); }
.btn.ghost{
  background: #f7fbff; color:#0b5394; border: 1px solid #deecff;
}
.btn.ghost:hover{ background:#eef6ff }
.btn.icon{ display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.icon-plus{ width:16px; height:16px; }

/* Kleine “state” outlines */
.btn.secondary:focus-visible{ outline: 3px solid #cfe1ff }
.btn.danger:focus-visible{ outline: 3px solid #ffd1db }
.btn.ok:focus-visible{ outline: 3px solid #bbf7d0 }

/* -----------------------------------------
   Zoeken
----------------------------------------- */
.searchbar{ display:flex; gap:10px; margin: 8px 0 14px; align-items:center }
.searchbar input[type=search]{
  flex:1; font-size: 18px; padding: 16px 18px;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 2px 10px var(--card-shadow);
}
.searchbar input[type=search]::placeholder{ color: #9ca3af }
.searchbar input[type=search]:focus{ outline: 3px solid var(--accent-soft); border-color: #cfe8d0 }

/* -----------------------------------------
   Helpertekst / meta
----------------------------------------- */
.helper{ color: var(--muted); font-size: 14px; margin: 6px 2px 12px }
.meta{ display:flex; gap:10px; color: var(--muted); font-size: 13px }

/* -----------------------------------------
   Grid & Cards
----------------------------------------- */
.grid{ display:grid; gap:16px; grid-template-columns: repeat(auto-fill, minmax(240px,1fr)) }

.card{
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: 0 10px 30px var(--card-shadow);
  display:flex; flex-direction:column; text-decoration:none;
  transition: transform .08s ease, box-shadow .12s ease, border-color .12s ease;
}
.card:hover{ transform: translateY(-2px); box-shadow: 0 14px 34px var(--card-shadow-2); border-color:#e3e6ec; }
.card img{ width:100%; height:160px; object-fit:cover; background:#f4f6fa }
.card .p{ padding: 14px }
.card h3{ margin: 0 0 6px; font-size: 18px }

.tags{ margin-top: 8px; display:flex; gap:8px; flex-wrap:wrap }
.tag{
  background: #eef6ff; color:#0b5394; border: 1px solid #deecff;
  border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight:600;
}

/* -----------------------------------------
   Formulieren
----------------------------------------- */
.form{
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: 0 10px 30px var(--card-shadow);
}
.form .row{ display:flex; gap:12px; flex-wrap:wrap }

.form input,
.form textarea,
.form input[type=number],
.form input[type=url]{
  width:100%; padding:12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: 0 2px 8px var(--card-shadow);
}
.form input:focus,
.form textarea:focus{ outline: 3px solid var(--accent-soft); border-color: #cfe8d0 }

label{ display:block; font-weight:700; margin: 12px 0 6px }

fieldset{
  border:1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px; margin: 12px 0; background: #fafcff;
}

/* Ingredient invoer in formulieren (niet de weergavelijst in recipe view) */
.ingredients{ display:grid; gap:10px }
.ing-row{
  display:grid; grid-template-columns: 2fr 1fr 1fr 2fr auto; gap:8px; align-items:center;
}
.ing-row .del{
  background: transparent; border: 1px dashed #cbd5e1; color:#475569;
  border-radius: var(--radius-sm); padding:8px; cursor:pointer;
}
.ing-row .del:hover{ background:#f8fafc }

/* -----------------------------------------
   Recipe View
----------------------------------------- */

/* Header: afbeelding links, tekst rechts */
.recipe-head {
  display: grid;
  grid-template-columns: 320px 1fr;  /* vaste breedte afbeelding + flexibele tekst */
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
.recipe-hero img {
  width: 100%;
  height: auto;
  border-radius: 12px;   /* afgeronde hoeken */
  display: block;
  object-fit: cover;     /* netjes bij rare verhoudingen */
}

/* Meta-chips onder beschrijving (gebruik .meta, .tag of eigen classes naar wens)
   -> je HTML gebruikt <span class="meta-chip">; style optioneel hier toevoegen:
*/
.meta-chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 10px; border:1px solid var(--line); border-radius:999px;
  background:#fff; color:var(--muted); font-size:.9rem;
}
.recipe-meta{ display:flex; gap:12px; flex-wrap:wrap; color: var(--muted) }

/* Actieknoppen onder header */
.recipe-actions{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:12px;
}
.recipe-actions .btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:44px;
}

/* Kookmodus */
.cookmode-row{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 10px 12px;
  border:1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin-bottom: 16px;
  box-shadow: 0 6px 20px var(--card-shadow);
}
.cookmode-text{ display:flex; flex-direction:column; gap:2px; }
.cookmode-title{ font-weight:600; }
.cookmode-sub{ font-size: .85rem; color: var(--muted); }
.cookmode-sub[data-state="on"]{ color: #0f7a3a; }

/* Toggle switch */
.switch{ position: relative; display:inline-flex; align-items:center; }
.switch input{
  opacity:0; width:0; height:0; position:absolute;
}
.switch .slider{
  width: 44px;
  height: 26px;
  background: #d1d5db;
  border-radius: 999px;
  position: relative;
  transition: background .2s ease;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
}
.switch .slider::before{
  content:"";
  position:absolute;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: transform .2s ease;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.switch input:checked + .slider{
  background: #4ade80;
}
.switch input:checked + .slider::before{
  transform: translateX(18px);
}
.switch input:focus-visible + .slider{
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

/* Content: instructies (breder) + ingrediënten (smaller) */
.recipe-content.two-col{
  display: grid;
  grid-template-columns: 1.6fr 1fr; /* instructies breder */
  gap: 16px;
  align-items: start;
}

/* Panels & lists */
.panel{
  background: var(--surface); border:1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px var(--card-shadow);
}
.list{
  background: var(--surface); border-radius: var(--radius-lg);
  overflow:hidden;
}
.list-header{
  display:flex; gap:10px; align-items:center; padding:12px; border-bottom:1px solid var(--line);
  background: #fbfeff;
}
.list-header.ingredients-header{
  justify-content: space-between;
  flex-wrap: wrap;
}
.servings-control{
  display:flex;
  align-items:center;
  gap:8px;
  margin-left:auto;
}
.servings-control .btn{
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
}
.servings-display{
  font-weight:600;
  color: var(--muted);
}
.list-header input[type=text]{
  flex:1; padding:10px; border-radius: var(--radius-sm); border:1px solid var(--line);
  background: var(--surface); color: var(--ink);
}
.list-header input[type=text]:focus{ outline: 3px solid var(--accent-soft); border-color:#cfe8d0 }
.list-items{ padding: 8px }

/* Richtext binnen instructies */
.richtext p{ margin: 0 0 .6em; }
.richtext ul, .richtext ol{ padding-left: 1.2em; margin: .2em 0 .6em; }

/* Ingrediënten-rij (weergave) */
.ingredients .list-items .ing-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: 0 2px 8px var(--card-shadow);
  margin-bottom: 8px;
}
.ingredients .ing-check{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.ingredients .ing-check-input{
  width: 18px;
  height: 18px;
  cursor: pointer;
}
.ingredients .ing-name{
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ingredients .ing-row.is-checked .ing-name{
  text-decoration: line-through;
  opacity: 0.6;
}
.ingredients .ing-qty{
  font-weight: 600;
}
.ingredients .ing-sep{
  margin: 0 6px;
  color: var(--muted);
}

/* Add-to-list knop bij een ingrediënt */
.add-to-list.btn{ /* gebruik samen met .btn.small.ghost.icon in HTML */
  min-width: 36px;
}
.icon-plus{ width:16px; height:16px; }

/* -----------------------------------------
   Generieke list items (shopping list e.d.)
----------------------------------------- */
.item{
  display:flex; gap:10px; align-items:center; padding: 10px 12px;
  border-bottom: 1px dashed #e6e9ef;
}
.item:last-child{ border-bottom:none }
.item .name{ flex:1 }
.item.checked .name{ opacity:.55; text-decoration: line-through }

/* Toegankelijkheid: focus voor clickables binnen lists */
.item button{
  border: 1px solid var(--line);
  background: #f7fbff; color:#0b5394; border-radius: var(--radius-sm);
  padding: 6px 10px; cursor:pointer;
}
.item button:hover{ background:#eef6ff }
.item button:focus-visible{ outline: 3px solid #deecff; outline-offset:2px }

/* -----------------------------------------
   Footer
----------------------------------------- */
footer{ margin-top: 18px; color: var(--muted); font-size: 14px }

/* -----------------------------------------
   Responsive layout tweaks
----------------------------------------- */
@media (min-width: 820px){
  /* Je kunt dit laten staan of de vaste 320px behouden; beiden zijn oké */
  .recipe-head{ grid-template-columns: 320px 1fr; }
}

@media (max-width: 819px){
  .recipe-content.two-col{ grid-template-columns: 1fr; }
}

@media (max-width: 819px){
  .recipe-form .row{
    flex-direction: column;
    gap: 14px;
  }

  .recipe-form .row > div{
    flex: 1 1 100%;
    min-width: 0;
  }

  .recipe-form .ing-row{
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .recipe-form .ing-row > div{
    width: 100%;
  }

  .recipe-form .ing-row > div:nth-child(3),
  .recipe-form .ing-row > div:nth-child(4),
  .recipe-form .ing-row > div:nth-child(5){
    grid-column: 1 / -1;
  }

  .recipe-form .ing-row > div:last-child{
    justify-content: flex-start;
  }

  .recipe-form .ing-row .btn.inline{
    width: 100%;
    justify-content: center;
  }
}

/* -----------------------------------------
   Compacte boodschappenlijst (custom UX)
----------------------------------------- */
.sl-row{
  display:flex; align-items:center; gap:10px;
  padding:6px 10px;
  border:1px solid #e5e7eb; border-radius:10px;
  background:#fff;
}
.sl-toggle { margin:0; }
.sl-toggle input[type="checkbox"]{
  width:18px; height:18px; cursor:pointer;
}

.sl-main{ flex:1; min-width:0; }
.sl-title{
  font-weight:600; line-height:1.2;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
  font-size:0.95rem;
}
.sl-sub{ color:#6b7280; font-size:0.8rem; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.sl-delete { margin:0; }

.sl-row.is-checked .sl-title{
  text-decoration: line-through;
  opacity: .7;
}

/* -----------------------------------------
   Kleine visuele touches
----------------------------------------- */
.card:hover img{ filter: saturate(1.05) }

/* ==== Recipe View — Mobile fixes ==== */
@media (max-width: 819px){
  /* 1) Header stapelen en hero beperken in hoogte */
  .recipe-head{
    grid-template-columns: 1fr;   /* stack */
    gap: 14px;
  }
  .recipe-hero{
    width: 100%;
  }
  .recipe-hero img{
    width: 100%;
    height: auto;
    max-height: 38vh;             /* voorkom supergrote foto */
    aspect-ratio: 4 / 3;          /* geeft stabiele hoogte op mobile */
    object-fit: cover;
    border-radius: 12px;
  }

  /* 2) Voorkom overflow van titel/omschrijving */
  .recipe-intro{ min-width: 0; }
  .recipe-title{
    font-size: 1.35rem;
    line-height: 1.2;
    word-break: break-word;
    overflow-wrap: anywhere;
    margin: 2px 0 8px;
  }
  .recipe-desc{
    overflow-wrap: anywhere;
    word-break: break-word;
    font-size: .98rem;
  }
  .recipe-meta{ gap: 8px; }

  .recipe-actions{
    flex-direction: column;
    align-items: stretch;
  }
  .recipe-actions .btn{
    width: 100%;
  }

  /* 3) Inhoud: één kolom op mobiel */
  .recipe-content.two-col{ grid-template-columns: 1fr; }

  /* 4) Ingrediëntenrij: nette uitlijning tekst + knop */
  .ingredients .list-items .ing-row{
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
  }
  .ingredients .ing-name{
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;   /* tekst blijft binnen scherm */
  }
  .add-to-list.btn{
    flex: 0 0 auto;            /* knop krimpt niet mee met tekst */
    align-self: center;
    padding: 6px 10px;         /* iets compacter op mobiel */
  }
  .icon-plus{ width: 16px; height: 16px; }

  /* 5) Lijsten iets compacter op mobiel */
  .list-items{ padding: 6px; }
}

/* Extra veiligheid ook buiten mobile: zorg dat intro kan krimpen */
.recipe-intro{ min-width: 0; }
.recipe-title{ word-break: break-word; overflow-wrap: anywhere; }
.recipe-desc{ overflow-wrap: anywhere; }

/* ==== Mobiele navigatie (hamburger) ==== */
.header{ position: relative; }

/* Standaard: toggle verbergen op desktop, nav inline */
.nav-toggle{ display:none; background:transparent; border:0; padding:8px; border-radius:12px; }
.nav-toggle:focus-visible{ outline:3px solid var(--accent-soft-2); outline-offset:2px; }

/* Mobiel weergave */
@media (max-width: 819px){
  .nav-toggle{ display:inline-flex; align-items:center; justify-content:center; }
  .nav{
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: none;              /* dicht standaard */
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    width: min(92vw, 340px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 40px var(--card-shadow-2);
    z-index: 20;
  }
  .nav.is-open{ display: flex; }
  .nav .btn{ width: 100%; justify-content: flex-start; } /* knoppen full-width in menu */
  .nav-greet{ margin: 2px 4px 6px; }
}

/* Desktop behoudt je huidige layout */
@media (min-width: 820px){
  .nav{ display:flex; align-items:center; gap:10px; }
}

/* ==== Boodschappenlijst: invoerbalk + sectie-afstand ==== */

/* 1) Invoerbalk (de <form class="bar"> bovenaan) */
.bar{
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 18px 18px 18px;            /* <-- geeft lucht rondom de balk */
}

.bar input{
  flex: 1 1 260px;                /* groeit mee, breekt netjes naar nieuwe regel */
  min-width: 160px;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px var(--card-shadow);
}

.bar .btn{
  flex: 0 0 auto;                 /* knop houdt z’n maat */
}

/* 2) Afstand tussen secties (Algemeen, Ma–Zo) */
#list-container{
  display: grid;
  gap: 16px;                      /* <-- ruimte tussen de sectie-panelen */
}

.panel.section{
  margin: 0;                      /* vertrouw op de grid-gap hierboven */
}

/* Iets meer lucht binnen de lijst */
.panel.section .list-items{
  padding: 10px;                  /* was 8px: oogt iets ruimer */
}

/* Ingrediënten/boodschappenrij blijft compact en netjes */
.sl-row,
.ingredients .list-items .ing-row{
  margin-bottom: 8px;
}

/* Mobile finetune */
@media (max-width: 819px){
  .bar{ gap: 8px; margin: 15px 15px 15px 15px; }
  #list-container{ gap: 14px; }
  .sl-row{
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .sl-title,
  .sl-sub{
    white-space: normal;
    word-break: break-word;
  }
  .sl-delete .btn{
    padding: 6px 10px;
    min-width: 34px;
  }
}

.invoerbalk {
	margin-bottom: 15px;
}

/* Overlay */
.ai-loading[hidden] { display: none !important; }
.ai-loading {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.08), rgba(0,0,0,.18));
  backdrop-filter: blur(2px);
}

/* Doosje */
.ai-loading-box {
  display: flex; gap: 14px; align-items: center;
  background: var(--card-bg, #fff);
  color: var(--fg, #111);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
}

/* Spinner (pure CSS) */
.ai-spinner {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 3px solid rgba(0,0,0,.15);
  border-top-color: currentColor;
  animation: ai-spin .9s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-loading-text { line-height: 1.15; }
.ai-loading-text .ai-sub {
  font-size: 12px; opacity: .75; margin-top: 2px;
}

/* Skeletons voor resultatenlijst */
.inspo-skeletons { display: grid; gap: 12px; }
.inspo-skel {
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px; padding: 12px; background: var(--card-bg, #fff);
}
.inspo-skel .bar { height: 12px; border-radius: 6px; margin: 8px 0;
  background: linear-gradient(90deg, rgba(0,0,0,.06), rgba(0,0,0,.12), rgba(0,0,0,.06));
  background-size: 200% 100%; animation: skel 1.2s ease-in-out infinite;
}
.inspo-skel .bar.short { width: 40%; }
.inspo-skel .bar.mid   { width: 70%; }
.inspo-skel .bar.long  { width: 96%; }
@keyframes skel { 0% {background-position: 200% 0} 100% {background-position: -200% 0} }
