/* =========================
   BASE
========================= */
body {
  font-family: sans-serif;
  margin: 0;
  padding: 0;
  background: #f4f4f4;
  color: #000;
}

html,
body {
  height: 100%;
  min-height: 100%;
}

/* =========================
   HEADER & MENUS
========================= */
header {
  background: #666;
  color: #fff;
  padding: 1em;
  text-align: center;
  font-size: 1.5em;
}

.tagline {
  font-size: 0.6em;
  color: white;
  text-align: center;
  margin: -0.6em auto 0.5em;
  opacity: 0.7;
  font-style: italic;
}

/* --- Top menu --- */
#top-menu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5em;
  background: rgba(255, 255, 255, 0.5);
  padding: 1em;
  border-radius: 10px;
}

#top-menu button {
  margin: 5px;
  padding: 0.6em 1em;
  font-size: 1em;
  border: 1px solid #aaa;
  border-radius: 5px;
  background: #ddd;
  color: #000;
  cursor: pointer;
}

#top-menu button:hover {
  background: #999;
  color: white;
}

#top-menu button[data-role="all"] {
  background: #FFD580;
  color: #000;
}

#top-menu button[data-role="search"] {
  background: #2E8B57;
  color: #fff;
}

/* --- Submenu --- */
#submenu {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 0.5em 1em 6em;
  background: #f9f9f9;
}

#submenu button {
  margin: 5px;
  padding: 0.7em 1.3em;
  font-size: 1.03em;
  border: none;
  background: #ddd;
  border-radius: 5px;
  cursor: pointer;
  color: #000 !important;
  -webkit-text-fill-color: #000 !important;
  text-decoration: none !important;
}

#submenu button:hover {
  background: #bbb;
}

/* =========================
   CONTENT
========================= */
#recipe-content {
  padding: 1em;
  max-width: 600px;
  margin: auto;
  background: #fff;
  border-top: 2px solid #ccc;
  opacity: 0;
  transition: opacity 0.2s ease-in;
}

#recipe-content.visible {
  opacity: 1;
}

#recipe-title {
  text-align: center;
}

#content {
  white-space: pre-wrap;
  line-height: 1.6;
  padding: 0 1em;
  font-size: 1em;
  color: black;
}

#content b {
  display: block;
  margin-top: 1em;
  font-weight: bold;
}

#content ol.method-list {
  padding-left: 1.4em;
  margin: 0;
}

#content ol.method-list li {
  margin-bottom: 0.8em;
  text-align: justify;
}

#recipe-image {
  max-width: 100%;
  height: auto;
  margin: 1em auto;
  border-radius: 12px;
  display: block;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* =========================
   IMAGE MODAL (FIXED)
========================= */
#image-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;

  /* IMPORTANT: no flex (Safari bug fix) */
  display: block;

  /* Allow natural sizing + scrolling if needed */
  overflow: auto;

  padding: env(safe-area-inset-top)
           env(safe-area-inset-right)
           env(safe-area-inset-bottom)
           env(safe-area-inset-left);
}

#image-modal img {
  display: block;

  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);

  width: auto;
  height: auto;

  margin: auto;

  object-fit: contain;

  border-radius: 12px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

/* =========================
   FIXED BUTTONS
========================= */
#wake-lock-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 4.5em);
  left: 1em;
  background: #444;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6em 1.5em;
  cursor: pointer;
  font-size: 1em;
  z-index: 999;
  display: none;
}

#main-menu-btn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1em);
  left: 1em;
  background: #555;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 0.6em 1.5em;
  font-size: 1em;
  cursor: pointer;
  z-index: 999;
}

#timer-box {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1em);
  right: 1em;
  background: #222;
  padding: 0.5em;
  border-radius: 10px;
  border: 1px solid #444;
  gap: 0.5em;
  display: none;
  z-index: 999;
}

#timer-btn,
#reset-timer-btn {
  background: #880808;
  color: white;
  border: none;
  padding: 0.5em 1em;
  border-radius: 8px;
  font-size: 1em;
  cursor: pointer;
}

#reset-timer-btn {
  background: #333;
}

/* =========================
   LOADING SCREEN
========================= */
#loading-screen {
  position: fixed;
  inset: 0;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: opacity 0.4s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-size: 1.6rem;
  color: #555;
  animation: pulse 1.2s infinite ease-in-out;
}

@keyframes pulse {
  0% { opacity: 0.3; }
  50% { opacity: 1; }
  100% { opacity: 0.3; }
}

/* =========================
   SCROLL CONTAINER
========================= */
#image-modal img {
  display: block;

  width: 100%;
  height: auto;

  max-width: 100%;
  max-height: 100%;

  margin: auto;

  object-fit: contain;

  border-radius: 12px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}


#ff-back-to-top:hover {
  background: rgba(0, 0, 0, 0.85);
}

/* Admin Tools button - ALWAYS pastel red */
.kt-btn.kt-btn-admin,
.kt-btn.kt-btn-admin.active {
  background-color: #f28b82 !important;
  color: #ffffff !important;
}

.kt-btn-admin:hover {
  background: #8a0018;
}