/* ============================================
   Tasty – App Styles v2
   ============================================ */

@import 'variables.css';

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Forhindre zoom ved dobbelttryk og input-fokus */
body { touch-action: manipulation; }
input, textarea, select { font-size: 16px; }

html {
  height: 100%;
  background: #C8B5A8;
}

body {
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text-dark);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 0 60px rgba(0,0,0,0.10);
}

/* ---- Skærm-container ---- */
#screen-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-height) + var(--safe-bottom));
  -webkit-overflow-scrolling: touch;
}

.screen { display: none; min-height: 100%; }
.screen.active { display: block; }

/* ---- Bottom Navigation ---- */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: calc(var(--nav-height) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--color-white);
  box-shadow: var(--shadow-nav);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  color: var(--color-text-light);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: color 0.2s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-width: 48px;
}

.nav-btn svg { width: 22px; height: 22px; stroke-width: 1.8; transition: stroke 0.2s; }

/* Aktiv: mørk afrundet baggrund */
.nav-btn.active {
  background: var(--color-accent-dark);
  color: var(--color-white);
  padding: 8px 16px;
}
.nav-btn.active svg { stroke: var(--color-white); }

/* ---- Forside Header ---- */
.home-header {
  padding: var(--space-lg) var(--space-md) var(--space-sm);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.home-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.home-header-icon {
  width: 40px;
  height: 40px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
}

.home-header-icon svg { width: 20px; height: 20px; color: var(--color-text-dark); }

.home-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  overflow: hidden;
  flex-shrink: 0;
}

/* ---- Søgefelt ---- */
.search-wrap { position: relative; }

.search-field {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--color-white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 12px 16px;
  box-shadow: var(--shadow-card);
}

.search-field svg { color: var(--color-text-light); flex-shrink: 0; width: 18px; height: 18px; }

.search-field input {
  border: none;
  background: none;
  outline: none;
  font-size: 15px;
  font-family: var(--font-sans);
  color: var(--color-text-dark);
  width: 100%;
}

.search-field input::placeholder { color: var(--color-text-light); }

/* ---- Sektion-header ---- */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-md) var(--space-sm);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-dark);
  letter-spacing: -0.3px;
}

.see-all-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-light);
  font-weight: 500;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Kategori-stribe ---- */
.categories-section { padding: var(--space-md) 0 var(--space-sm); }

.add-cat-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-light);
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.categories-scroll {
  display: flex;
  gap: var(--space-sm);
  overflow-x: auto;
  padding: 4px var(--space-md) var(--space-sm);
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.categories-scroll::-webkit-scrollbar { display: none; }

.cat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-white);
  border: none;
  border-radius: var(--radius-pill);
  padding: 8px 14px 8px 10px;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-mid);
  box-shadow: var(--shadow-card);
  transition: background 0.2s, color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.cat-pill .cat-emoji { font-size: 18px; line-height: 1; }

.cat-pill.active {
  background: var(--color-accent-dark);
  color: var(--color-white);
}

/* ---- Opskrifter Sektion ---- */
.recipes-section { padding: var(--space-sm) 0 var(--space-md); }

/* 2-kolonne gitter */
.recipes-scroll {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px var(--space-md) var(--space-md);
}

/* ---- Opskriftskort (portrait) ---- */
.recipe-card {
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-md) var(--space-sm) var(--space-md);
  min-height: 190px;
  box-shadow: var(--shadow-card);
  transition: transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.recipe-card:active { transform: scale(0.96); }

/* Cirkulær billede-wrapper */
.recipe-card-img-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 8px;
}

.recipe-card-flag {
  position: absolute;
  top: 10px;
  right: 10px;
}

.recipe-card-img-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.recipe-card-img-circle .placeholder-emoji {
  font-size: 36px;
}

/* Tekst-del */
.recipe-card-body {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.recipe-card-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
  margin-bottom: 6px;
}

/* Lys tekst på mørke/orange kort */
.recipe-card.dark-text .recipe-card-name { color: var(--color-text-dark); }
.recipe-card.light-text .recipe-card-name { color: var(--color-white); }

.recipe-card-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  font-size: 12px;
  font-weight: 500;
  opacity: 0.75;
}

.recipe-card-meta-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.recipe-card-meta-item svg { width: 12px; height: 12px; }

.recipe-card-stars {
  display: flex;
  align-items: center;
  gap: 1px;
  opacity: 0.85;
}
.recipe-card.light-text .recipe-card-stars { color: rgba(255,255,255,0.9); }
.recipe-card.dark-text  .recipe-card-stars { color: var(--olive-wood); }

/* Bogmærke-knap */
.bookmark-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}
.bookmark-btn svg { width: 14px; height: 14px; color: var(--color-text-dark); }

/* ---- Tom tilstand ---- */
.empty-state {
  text-align: center;
  padding: var(--space-xl) var(--space-md);
  color: var(--color-text-light);
  margin: 0 var(--space-md);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: var(--space-md); }
.empty-state h3 { font-size: 20px; font-weight: 700; color: var(--color-text-mid); margin-bottom: var(--space-sm); }
.empty-state p { font-size: 14px; line-height: 1.5; }

/* ---- FAB ---- */
#fab {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-accent-dark);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 99;
  transition: transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}
#fab:active { transform: scale(0.92); }
#fab svg { color: white; width: 22px; height: 22px; }

/* ---- Toast ---- */
#toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text-dark);
  color: white;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  white-space: nowrap;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Kategori Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal-sheet {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--color-white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}
.modal-overlay.open .modal-sheet { transform: translateY(0); }

/* Topbar – altid synlig øverst */
.modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-md) var(--space-sm);
  flex-shrink: 0;
}

/* Scrollbart indhold under topbar */
.modal-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 var(--space-md) calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
  flex: 1;
}

.modal-topbar h3 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0;
}

.modal-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #EDE5DE;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  color: var(--color-text-dark);
}
.modal-close-btn svg { width: 16px; height: 16px; }

.modal-sheet h3 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  text-align: center;
  letter-spacing: -0.3px;
}

.modal-field {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.modal-field input {
  flex: 1;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  font-size: 15px;
  font-family: var(--font-sans);
  outline: none;
  color: var(--color-text-dark);
  background: #F5EDE8;
}
.modal-field input:focus { border-color: var(--color-accent-dark); }

.emoji-pick {
  width: 52px;
  height: 52px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-md);
  background: #F5EDE8;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  width: 100%;
  background: var(--color-accent-dark);
  color: white;
  border: none;
  border-radius: var(--radius-pill);
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
  letter-spacing: -0.2px;
}
.btn-primary:active { opacity: 0.8; }

/* Kategori-liste i modal */
.cat-list { margin-bottom: var(--space-md); }
.cat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--color-border);
}
.cat-list-item:last-child { border-bottom: none; }
.cat-list-left { display: flex; align-items: center; gap: var(--space-sm); font-size: 15px; font-weight: 500; }
.cat-list-left span:first-child { font-size: 20px; }

.cat-list-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.cat-edit-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-light);
  padding: 6px;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}
.cat-edit-btn svg { width: 16px; height: 16px; }

.cat-delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-danger);
  padding: 6px;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}
.cat-delete-btn svg { width: 18px; height: 18px; }

/* Inline edit-tilstand */
.cat-list-item.editing {
  gap: 8px;
  flex-wrap: nowrap;
}
.cat-edit-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}
.cat-edit-name-input {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  padding: 6px 10px;
  height: 36px;
}
.cat-edit-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.cat-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  display: flex;
  -webkit-tap-highlight-color: transparent;
}
.cat-action-btn svg { width: 18px; height: 18px; }
.cat-action-btn.save { color: var(--basil-green); }
.cat-action-btn.cancel { color: var(--color-text-light); }

/* ---- Data-sektion (Eksport / Import) ---- */
.data-section {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

.data-section-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-light);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

.data-btns {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.data-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  background: #EDE5DE;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--color-text-dark);
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.data-btn:active { background: #D8CCBF; }
.data-btn svg { width: 18px; height: 18px; flex-shrink: 0; stroke: var(--color-text-mid); }

/* ---- Emoji-grid picker (inline i app.html) ---- */
