:root {
    --book-page-width: 700px;
    --book-page-height: 700px;
    --book-bg: #ffffff;
    --primary-color: #281a39;
    --accent-color: #4a3b5f;
}

.cookbook-body {
    background: #f2f2f4;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
}

/* --- HEADER FIX --- */
.cookbook-body .top-nav-hero {
  max-width: 1100px !important;
  margin: 0 auto 12px !important;
  border-radius: 0 0 24px 24px !important;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  position: relative;
  width: 100%;
}

.cookbook-body .top-nav-hero-image {
  width: 100%;
  max-height: 160px !important;
  object-fit: cover;
  display: block;
}

.cookbook-body .top-nav-hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding: 10px 16px 16px;
}

.cookbook-body .top-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid #4a3b5f;
  background: #ffffff;
  color: #4a3b5f;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.04);
  transition: all 0.15s ease;
}

.cookbook-body .top-nav-button:hover {
  background: #e9e6f3;
  color: #281a39;
}

/* --- CONTAINER --- */
.cookbook-container {
    max-width: 1500px;
    margin: 16px auto 40px;
    padding: 0 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.main-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-weight: 600;
}

.book-wrapper {
    perspective: 3500px;
    margin: 20px 0 60px;
    display: flex;
    justify-content: center;
    width: 100%;
}

.book {
    position: relative;
    width: var(--book-page-width);
    height: var(--book-page-height);
    transition: transform 0.8s ease;
    transform-style: preserve-3d;
}

/* --- VIEWPORT SHIFTING --- */
.book.show-right { transform: translateX(0) !important; }
.book.show-left { transform: translateX(100%) !important; }

@media (min-width: 1450px) {
    .book {
        width: calc(2 * var(--book-page-width));
        transform: none;
    }
    .book:not(.opened) { transform: translateX(-25%); }
    .book.opened { transform: translateX(0); }
    .leaf { width: 50% !important; left: 50% !important; }
}

/* --- PERSONA --- */
.editable-word {
    background: #e8e6ef;
    padding: 0 10px;
    border-radius: 8px;
    display: inline-block;
}

.selector-header h2 {
    color: var(--primary-color);
    margin-bottom: 15px;
    text-align: center;
}

.selector-hr {
    border: none;
    border-top: 1px solid #f0eef6;
    margin-bottom: 25px;
}

.selector-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 25px;
    width: 100%;
}

.name-input-group input {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 8px;
    width: 380px;
    font-family: inherit;
    font-weight: 800;
}

.name-input-group input::placeholder {
    font-weight: 800;
    color: #333;
}

.search-filter-group { display: flex; gap: 12px; align-items: center; }
.selector-tools input { padding: 10px 15px; border: 1px solid #ccc; border-radius: 8px; width: 250px; font-family: inherit; }

.filter-icon-btn {
    width: 44px; height: 44px; background: #fff; border: 2px solid #000; border-radius: 4px;
    display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.filter-icon-btn svg { width: 28px; height: 28px; stroke: #000; }

.filter-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 10px; background: #fff; border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15); z-index: 1000; min-width: 220px; padding: 8px;
}

.filter-option {
    display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; border-radius: 8px;
    transition: background 0.2s; font-weight: 600; color: #4a3b5f; font-size: 0.9rem;
}
.filter-option:hover { background: #f0f0f5; }
.filter-option.active { background: #e8e6ef; color: var(--primary-color); }
.filter-option svg { width: 20px; height: 20px; }

/* --- STORY PAGE --- */
.page.story-page .recipe-content-wrapper { justify-content: flex-end; padding-bottom: 40px; }
.story-content-box { background: #f2f2f4; border-radius: 20px; padding: 30px; box-shadow: 0 10px 30px rgba(0,0,0,0.06); display: flex; gap: 30px; align-items: flex-start; }
.story-left-col { flex: 0 0 220px; display: flex; flex-direction: column; text-align: center; }
.story-header-small { font-size: 0.8rem; font-weight: 800; color: #000; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.story-quote { font-size: 1.2rem; font-weight: 800; color: #000; line-height: 1.3; margin-bottom: 20px; }
.story-dony-img { width: 200px; height: 200px; object-fit: cover; border-radius: 12px; margin: 0 auto; }
.story-right-col { flex: 1; }
.story-text-grey { color: #555; font-size: 0.75rem; line-height: 1.6; text-align: justify; }

/* --- WISSENSWERTES --- */
.info-page-content img { height: auto !important; max-height: 120px !important; object-fit: contain !important; background: #fff; }
.info-img-frame { flex: 1; border: 2px solid #f0eef6; padding: 4px; border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }

/* Base Leaf Logic */
.leaf { position: absolute; width: 100%; height: 100%; top: 0; left: 0; transform-origin: left; transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1); transform-style: preserve-3d; cursor: pointer; z-index: 1; }
.leaf.flipped { transform: rotateY(-180deg); }
.page { position: absolute; width: 100%; height: 100%; top: 0; left: 0; background-color: #ffffff !important; box-shadow: 0 0 10px rgba(0,0,0,0.15); backface-visibility: hidden; display: flex; flex-direction: column; overflow: hidden; border-radius: 0 15px 15px 0; transform: translateZ(0); box-sizing: border-box; }
.page.back { transform: rotateY(180deg) translateZ(1px); border-radius: 15px 0 0 15px; }
.page.front::before { content: ''; position: absolute; top: 0; left: 0; width: 40px; height: 100%; background: linear-gradient(to right, rgba(0,0,0,0.12) 0%, transparent 100%); z-index: 10; }
.page.back::before { content: ''; position: absolute; top: 0; right: 0; width: 40px; height: 100%; background: linear-gradient(to left, rgba(0,0,0,0.12) 0%, transparent 100%); z-index: 10; }

.page.cover-front { background-color: #fff !important; padding: 0; }
.cover-image-area { width: 100%; height: 380px; position: relative; overflow: hidden; }
.cover-main-img { width: 100%; height: 100%; object-fit: cover; }
.cover-content { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; z-index: 20; text-align: center; }
.cover-logo-center { width: 100px; height: auto; margin-bottom: 25px; }
.cover-brand-name { font-size: 1.8rem; color: var(--accent-color); font-weight: 700; margin-bottom: 5px; }
.cover-brand-title { font-size: 2.8rem; margin: 0; color: var(--primary-color); font-weight: 800; }
.cover-tagline { font-size: 1.25rem; margin: 10px 0 0; color: var(--accent-color); font-weight: 600; max-width: 90%; line-height: 1.4; }
.back-cover-footer { margin-top: auto; padding: 40px; text-align: center; width: 100%; box-sizing: border-box; }
.footer-hr { border: none; border-top: 2px solid #f0eef6; margin-bottom: 25px; width: 100%; }
.footer-info-text { font-size: 0.9rem; color: #666; margin-bottom: 15px; line-height: 1.6; }
.footer-logo-small { width: 50px; height: auto; opacity: 0.8; }

.recipe-content-wrapper { display: flex; flex-direction: column; height: 100%; padding: 40px; box-sizing: border-box; }
.recipe-title-header { margin: 0 0 15px 0; color: var(--primary-color); font-size: 1.5rem; font-weight: 800; text-align: center; }
.recipe-top-row { display: flex; gap: 25px; align-items: flex-start; margin-bottom: 15px; }
.recipe-img-container { flex: 0 0 200px; }
.recipe-page-img { width: 200px; height: 200px; object-fit: cover; border-radius: 12px; box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.recipe-ingredients-container { flex: 1; }
.recipe-ingredients-container h4 { margin: 0 0 8px 0; color: var(--accent-color); font-size: 1.0rem; font-weight: 800; }
.recipe-ingredients-list { margin: 0; padding-left: 15px; font-size: 0.7rem; line-height: 1.4; color: #333; column-count: 2; column-gap: 20px; }
.recipe-hr { border: none; border-top: 2px solid #f0eef6; margin: 5px 0 15px 0; }
.recipe-bottom-section h4 { margin: 0 0 8px 0; color: var(--accent-color); font-size: 1.0rem; font-weight: 800; }
.recipe-steps-text { font-size: 0.7rem; line-height: 1.5; color: #333; white-space: pre-wrap; margin: 0; }

.book-controls { display: flex; align-items: center; justify-content: center; gap: 40px; padding: 12px 40px; background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); border-radius: 50px; box-shadow: 0 5px 25px rgba(0,0,0,0.1); margin: 0 auto 50px; width: fit-content; z-index: 100; }
.nav-btn { padding: 12px 25px; background: var(--primary-color); color: white; border: none; border-radius: 30px; cursor: pointer; font-weight: 800; transition: all 0.3s ease; }
.nav-btn:hover:not(:disabled) { background: var(--accent-color); transform: translateY(-2px); }
.nav-btn:disabled { opacity: 0.2; cursor: not-allowed; }
#pageInfo { font-weight: 800; color: var(--primary-color); font-size: 1.15rem; min-width: 120px; text-align: center; }

.selector-card { width: 100%; max-width: 1100px; box-sizing: border-box; padding: 40px !important; }
.selector-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 60px; }
.selector-item { display: flex; align-items: center; gap: 15px; padding: 12px 0; border-bottom: 1px solid #f0eef8; cursor: pointer; }
.selector-item:hover { background: rgba(0,0,0,0.02); }
.selector-thumb-wrap { width: 48px !important; height: 48px !important; border-radius: 8px; overflow: hidden; flex-shrink: 0; position: relative; }
.selector-thumb { width: 100%; height: 100%; object-fit: cover; }
.selection-badge { position: absolute; inset: 0; background: #a333c8; color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.2rem; }
.selector-text { display: flex; flex-direction: column; min-width: 0; }
.selector-title { font-weight: 800; font-size: 1.05rem; color: #281a39; }
.selector-subtitle { font-size: 0.9rem; color: #4a3b5f; }

@media (max-width: 1449px) {
    .book { width: 90vw; height: 90vw; transform: none !important; left: 0 !important; }
    .recipe-content-wrapper { padding: 20px; }
    .recipe-img-container { flex: 0 0 40%; }
    .recipe-page-img { width: 100%; height: auto; aspect-ratio: 1; }
    .recipe-title-header { font-size: 1.2rem; }
    .recipe-ingredients-list { column-count: 1; font-size: 0.65rem; }
    .recipe-steps-text { font-size: 0.65rem; }
    .selector-list { grid-template-columns: 1fr; }
    .selector-controls-row { flex-direction: column; gap: 15px; }
    .name-input-group input { width: 100%; }
}

/* --- WIZARD (v33) --- */
.wizard-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: transparent; z-index: 10000;
    display: flex; justify-content: center; align-items: center;
    pointer-events: none;
}
.wizard-overlay::before {
    content: ''; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); z-index: 9999;
    pointer-events: auto;
}
.wizard-overlay.wizard-active::before { display: none; }

.wizard-box {
    background: #ffffff !important; /* Ensure solid white */
    padding: 30px; border-radius: 16px;
    max-width: 450px; text-align: center;
    box-shadow: 0 15px 50px rgba(0,0,0,0.5);
    border: 4px solid var(--primary-color);
    pointer-events: auto; position: fixed;
    z-index: 20000 !important; /* Above everything */
    bottom: 40px; /* Positioned at bottom to avoid covering middle elements */
    left: 50%; transform: translateX(-50%);
}
.wizard-box p { font-size: 1.15rem; font-weight: 600; color: #333; margin-bottom: 25px; line-height: 1.5; }

.wizard-highlight {
    position: relative !important; z-index: 10001 !important;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.7);
    outline: 4px solid #ffcc00; outline-offset: 4px;
    pointer-events: auto !important;
}

.wizard-btn { background: var(--primary-color); color: #fff; border: none; padding: 12px 30px; border-radius: 30px; font-weight: 800; cursor: pointer; transition: transform 0.2s; }
.wizard-btn:hover { transform: scale(1.05); }
.wizard-btn.secondary { background: #e8e6ef; color: #4a3b5f; }
.wizard-buttons { display: flex; justify-content: center; gap: 15px; }

.wizard-footer { margin-top: 20px; font-size: 0.85rem; color: #666; border-top: 1px solid #eee; padding-top: 15px; }
.wizard-footer label { cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }

/* Floating Restart Button */
.wizard-restart-btn {
    position: fixed; bottom: 20px; right: 20px;
    width: 50px; height: 50px;
    background: var(--primary-color);
    color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    z-index: 9000; transition: all 0.3s ease;
}
.wizard-restart-btn:hover { transform: scale(1.1) rotate(15deg); background: var(--accent-color); }
.wizard-restart-btn svg { width: 24px; height: 24px; fill: currentColor; }

.book-wrapper, .detail-card, .selector-controls-row, .cookbook-container { overflow: visible !important; }
