/* ---------- BODY ---------- */
body {
  margin: 0;
  padding-top: 25px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: large;
  background-color: #f8f8f8;
}

/* ---------- RESPONSIV STARTSIDA-BILD ---------- */
.responsive-image {
  width: 100%;
  max-width: 800px;
  height: auto;
  margin: 20px auto;
  display: block;
  border-radius: 8px;
}

/* ---------- LOGGA ---------- */
.logo {
  height: 130px;      /* standardhöjd på desktop */
  width: auto;       /* bibehåller proportioner */
}

.logo-link {
  display: flex;
  align-items: center;
  margin-right: 20px;  /* lite luft mellan logga och meny */
}

/* ---------- MENY ---------- */
/* ---------- HAMBURGERKNAPP ---------- */
.menu-toggle {
  display: none;       /* dold på desktop */
  background: none;
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
}

.menu-ram {
  position: fixed;
  top: 0;
  width: 100%;
  height: 60px;
  background-color: #05b554;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 2px solid white;
}

.menu {
  list-style: none;
  display: flex;
  gap: 30px;
  margin: 0;
  padding: 0;
}

.menu li {
  position: relative;
}

@media (min-width: 769px) {
  .menu a,
  .dropdown > a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 24px;
  }
  .menu a:hover,
  .dropdown > a:hover {
    color: #fff;
  }
}

/* ---------- DROPDOWN DESKTOP ---------- */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #05b554;
  min-width: 160px;
  z-index: 1500;
}

.dropdown:hover .dropdown-content {
  display: block;
}

.dropdown-content a {
  display: block;
  padding: 10px;
  color: white;
  text-decoration: none;
}

.dropdown-content a:hover {
  background-color: #049147;
}

/* ---------- HUVUD ---------- */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px;
}

h1,
#page-description h4 {
  text-align: center;
}

/* ---------- RECEPT-GRID ---------- */
#recipes-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

/* ---------- RECEPT-KORT ---------- */
.recipe-card {
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  overflow: hidden;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.recipe-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
}

.recipe-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 12px;
  color: #222;
}

.recipe-note {
  font-size: 0.85em;
  color: #555;
  font-style: italic;
  margin: 0 12px 12px;
  display: none;
}

/* ---------- RECEPT-TITEL & SERVINGS ---------- */
.recipe-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin: 10px 0 4px;
  text-align: center;
}

.recipe-servings {
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 12px;
  text-align: center;
}

.recipe-card .recipe-servings {
  display: none;
}

/* ---------- MODAL ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  justify-content: center;
  align-items: center;
  z-index: 2000;
  overflow-y: auto;
  padding: 0;
}

.modal-content {
  background: white;
  width: 98%;
  height: 95vh;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  gap: 20px;
  overflow-y: auto;
  position: relative;
}

.modal-content img {
  width: 45%;
  object-fit: cover;
  border-radius: 10px;
}

.modal-text {
  width: 55%;
  overflow-y: auto;
  font-size: 16px;
  line-height: 1.5;
  padding-right: 10px;
}

.modal-close-btn {
  position: absolute;
  top: 20px;
  right: 40px;
  background-color: #fff;
  border: 2px solid #05b554;
  border-radius: 6px;
  width: 100px;
  height: 40px;
  font-size: 1rem;
  font-weight: bold;
  color: #05b554;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close-btn:hover {
  background-color: #05b554;
  color: #fff;
  transform: scale(1.05);
}

/* ---------- SERVINGS-KONTROLL ---------- */
.servings-control {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

.servings-control button {
  background-color: #fff;
  border: 2px solid #05b554;
  border-radius: 6px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  font-weight: bold;
  color: #05b554;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
}

.servings-control button:hover {
  background-color: #05b554;
  color: #fff;
  transform: scale(1.1);
}

#servings-value {
  font-weight: bold;
  font-size: 18px;
  min-width: 15px;
  text-align: center;
  color: #05b554;
}

/* ---------- SÖKRUTA + TAGS HAMBURGER ---------- */
.search-tags-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 400px;
  margin: 0 auto 5px auto;
  border: 2px solid #ccc;
  border-radius: 6px;
  padding: 4px 8px;
  background: #fff;
  position: relative;
}

#recipe-search {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  padding: 8px;
  background: transparent;
}

#tags-toggle {
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
  padding: 0 6px;
  margin-left: auto;  /* högerställd */
  flex-shrink: 0;
}

/* ---------- TAG PANEL ---------- */
.tag-panel {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  display: none;
  flex-direction: column;
  gap: 10px;
  max-height: 0;
  overflow-y: auto;
  margin-top: 6px;
  background: #fff;
  padding: 0 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0,0,0,0.12);
  z-index: 9999;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.tag-panel.open {
  display: flex;
  max-height: 320px;
  padding: 12px;
}

/* ---------- TAG GROUPS ---------- */
.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-group-label {
  width: 100%;
  font-weight: bold;
  margin-bottom: 6px;
  color: #05b554;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.tag-group .filter-btn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  background-color: #fff;
  cursor: pointer;
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
  font-size: 0.9rem;
  color: black;
}

.tag-group .filter-btn:hover {
  background-color: #f0f0f0;
}

/* ---------- CLEAR ALL KNAPP ---------- */
.clear-tags-btn {
  background-color: #f8f8f8;
  border: 1px solid #05b554;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.2s ease;
}

.clear-tags-btn:hover {
  background-color: #05b554;
  color: #fff;
  transform: scale(1.05);
}

/* ---------- CATEGORY BUTTONS ---------- */
#recipe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 1px;
  justify-content: center;
}

#recipe-filters .filter-btn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background-color: #fff;
  color: #222;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  width: auto;       /* så bred som texten kräver */
  min-width: unset;
  max-width: unset;
}

#recipe-filters .filter-btn:hover {
  background-color: #f0f0f0;
}

#recipe-filters .filter-btn.active,
.tag-group .filter-btn.active {
  background-color: #05b554;
  color: #fff;
  border-color: #05b554;
}

/* ---------- FEATURED RECIPE CARDS PÅ INDEX-SIDAN ---------- */
#featured-recipes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  justify-content: center; /* centrera korten horisontellt */
  justify-items: center;   /* centrera innehållet i korten */
  margin-top: 30px;
}

#featured-recipes .recipe-card {
  width: auto;       /* kortet blir bara så brett som innehållet kräver */
  max-width: 220px;  /* begränsar kortets bredd på stora skärmar */
  background-color: white;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  overflow: hidden;
  text-align: center;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* ---------- SHOW ALL BUTTONS ---------- */
.show-all-btn {
  display: inline-block;
  padding: 12px 25px;
  background-color: #05b554;  /* grön bakgrund */
  color: white;                /* vit text */
  text-decoration: none;       /* ta bort understrykning */
  font-weight: 600;
  border-radius: 6px;
  transition: background-color 0.25s ease, transform 0.25s ease;
  margin: 15px 0;             /* lite mellanrum ovanför/under */
}

.show-all-btn:hover {
  background-color: #025d2b;  /* mörkare grön vid hover */
  transform: translateY(-3px); /* lyfter knappen lite */
}

/* ===============================
   STICKY FILTERS + SEARCH
   =============================== */
#sticky-filters-wrapper {
  position: sticky;          /* klistrar sig när man scrollar */
  top: 70px;                 /* precis under menyraden */
  background-color: #f8f8f8; /* samma som sidan */
  z-index: 900;              /* ovanför recepten men under menyn */
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #ddd; /* valfritt, snygg separation */
}

/* Gör sökrutan och filterknapparna smidigare */
#sticky-filters-wrapper .search-tags-wrapper,
#sticky-filters-wrapper #recipe-filters {
  width: 100%;
  max-width: 400px;
}

/* Knappar (kategori) centreras */
#sticky-filters-wrapper #recipe-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

/* Sökfältet + hamburgermenyn i raden */
#sticky-filters-wrapper .search-tags-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

/* Sökfältet */
#sticky-filters-wrapper #recipe-search {
  flex: 1;
  padding: 6px 10px;
  font-size: 1rem;
}

/* Tags hamburger (högerställd) */
#sticky-filters-wrapper #tags-toggle,
#sticky-filters-wrapper .burger-btn {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 20px;
  cursor: pointer;
  background: none;
  border: none;
}

/* ---------- FOOTER ---------- */
#footer {
  position: fixed;        /* alltid synlig längst ner */
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #05b554; /* samma färg som menyraden */
  color: white;
  text-align: center;
  padding: 4px 0;         /* tunn footer */
  font-size: 0.9rem;
  z-index: 1100;           /* ligger ovanför vanliga element men under modaler */
  box-shadow: 0 -2px 6px rgba(0,0,0,0.2);
}

/* Länkstil i footern */
#footer a {
  color: white;
  text-decoration: underline;
}

/* ===============================
   MOBILANPASSNING
   =============================== */
@media (max-width: 768px) {

  /* ---------- LOGGA ---------- */
  .logo {
    height: 100px;    /* mindre på mobil */
  }

  /* Huvudmeny */
  .menu-ram {
    justify-content: space-between;
    padding: 0 15px;
  }

  .menu-toggle {
    display: block;
    margin-left: auto;  /* den skjuts åt höger */
    margin-right: 15px; /* ger 12px luft från högersidan */
  }

  .menu {
    display: none;
    flex-direction: column;
    background-color: #05b554;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    padding: 10px 0;
  }

  .menu.active {
    display: flex;
  }

  .menu a {
    color: #fff;
    font-weight: bold;
    padding: 10px 15px;
    text-decoration: none;
  }

  /* Sök + taggar */
  .search-tags-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  #recipe-search {
    flex: 1;
  }

  #tags-toggle {
    margin-left: auto;
    flex-shrink: 0;
  }

  /* Kategori-knappar */
  #recipe-filters,
  .tag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
  }

  #recipe-filters .filter-btn,
  .tag-group .filter-btn {
    width: auto;
    min-width: unset;
    max-width: unset;
    display: inline-flex;
    padding: 5px 10px;
    font-size: 0.85rem;
    border-radius: 999px;
    white-space: nowrap;
  }

  .clear-tags-btn {
    width: auto;
    display: inline-flex;
    align-self: flex-start;
    padding: 5px 10px;
  }

  /* Receptkort: rubrik mindre på mobil */
  #featured-recipes .recipe-card h3,
  #recipes-container .recipe-card h2 {
    font-size: 14px; /* ändra värdet till det som känns bra */
  }

  #recipes-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;  /* valfritt, lite mindre mellanrum på mobilen */
  }

  #featured-recipes {
    grid-template-columns: repeat(2, 1fr); /* 2 kort per rad på mobil */
    gap: 15px;                             /* lite mindre mellanrum */

  }

  .modal-content {
    flex-direction: column;   /* stapla bild + text vertikalt */
    align-items: center;      /* centrera innehållet */
    text-align: center;
  }

  .modal-content img {
    width: 100%;
    height: auto;
    max-height: 35vh;  /* max 35% av skärmens höjd */
    object-fit: cover;  /* fyller hela rutan utan att förvränga */
    margin-bottom: 5px;
    border-radius: 8px;
  }

  .modal-text {
    width: 100%;             /* texten tar hela bredden */
    padding: 0 10px;         /* lite luft inifrån */
  }

  #featured-recipes .recipe-card {
    max-width: 100%;  /* korten kan växa till nästan hela kolumnen */
  }

  .recipe-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.18);
  }

  #featured-recipes .recipe-card {
    max-width: 100%;
  }

  .show-all-btn {
    padding: 10px 20px;
    font-size: 0.95rem;
  }

 #sticky-filters-wrapper {
    top: 60px;   /* fortfarande under menyn */
    padding: 6px 10px;
  }

  #sticky-filters-wrapper #recipe-filters {
    justify-content: center; /* centrera knapparna på mobil */
    gap: 6px;
  }

  #sticky-filters-wrapper .search-tags-wrapper {
    justify-content: space-between; /* sökruta till vänster, hamburgermeny till höger */
  }

  #sticky-filters-wrapper #recipe-search {
    font-size: 0.95rem;
  }

    #footer {
    font-size: 0.8rem;
    padding: 3px 0;
  }
}