/* Wyszukiwarka */
.search-container {
    background: #e9f0e8;
    border: 2px solid #3e4a3d;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 5px 5px 0 rgba(62, 74, 61, 0.2);
}

.retro-input {
    background: #fff;
    border: 1px solid #d1c7a7;
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    border-radius: 0;
    padding: 12px;
    width: 100%;
}

.retro-input:focus {
    border-color: #3e4a3d;
    box-shadow: none;
    outline: none;
}

/* Karta Przepisu (Podgląd) */
.recipe-card {
    background: #fdfaf0;
    border: 1px solid #d1c7a7;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    padding: 20px;
}

.recipe-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(62, 74, 61, 0.15);
    border-color: #3e4a3d;
}

.recipe-stamp {
    font-family: 'Playfair Display', serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    font-size: 0.75rem;
    padding: 4px 8px;
    border: 1px solid;
    display: inline-block;
    border-radius: 3px;
}
.stamp-med { color: #2d5a27; border-color: #2d5a27; background: #e8f5e9; }
.stamp-food { color: #b8860b; border-color: #b8860b; background: #fff8e1; }

.recipe-title {
    font-family: 'Playfair Display', serif;
    color: #2c2c2c;
    font-size: 1.4rem;
    margin-top: 10px;
    margin-bottom: 10px;
    border-bottom: 1px dashed #d1c7a7;
    padding-bottom: 10px;
    line-height: 1.2;
}

.btn-details {
    margin-top: auto;
    border: 1px solid #3e4a3d;
    color: #3e4a3d;
    background: transparent;
    width: 100%;
    padding: 10px;
    font-family: 'Crimson Text', serif;
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: 0.3s;
    cursor: pointer;
}

.btn-details:hover {
    background: #3e4a3d;
    color: white;
}

/* --- MODAL GRYMUARU I ANIMACJA SCROLLA --- */
.modal-content {
    border-radius: 0 !important;
    border: 2px solid #3e4a3d !important;
    background-color: #fdfaf0 !important;
}

.recipe-modal-header {
    border-bottom: 2px solid #d1c7a7;
    background: #f4f1ea;
    padding: 20px;
    transition: all 0.3s ease-in-out; /* Animacja przejścia */
    position: sticky;
    top: 0;
    z-index: 10;
}

.grimoire-title {
    font-family: 'Playfair Display', serif;
    color: #3e4a3d;
    font-size: 2rem;
    margin: 0;
    line-height: 1.1;
    transition: font-size 0.3s ease-in-out;
}

/* Stan nagłówka po zescrollowaniu na dół */
.recipe-modal-header.scrolled {
    padding: 10px 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.recipe-modal-header.scrolled .grimoire-title {
    font-size: 1.3rem; /* Zmniejszenie tytułu */
}

.alchemical-tag {
    display: inline-block;
    background: #e9f0e8;
    border: 1px solid #a3b899;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin-top: 8px;
    margin-right: 5px;
    color: #2d5a27;
}

/* AKORDEONY ZWIJANE (Zastosowanie, Alchemia, itp.) */
details.grimoire-details {
    background: #fff;
    border: 1px solid #d1c7a7;
    margin-bottom: 10px;
    border-radius: 4px;
    overflow: hidden;
}

details.grimoire-details > summary {
    background: #f4f1ea;
    padding: 12px 20px;
    font-family: 'Playfair Display', serif;
    font-size: 1.1rem;
    color: #3e4a3d;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
    border-bottom: 1px solid transparent;
    transition: background 0.3s;
}

details.grimoire-details > summary::-webkit-details-marker {
    display: none;
}

details.grimoire-details > summary:hover {
    background: #e9f0e8;
}

details.grimoire-details[open] > summary {
    border-bottom: 1px solid #d1c7a7;
}

.details-content {
    padding: 20px;
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    line-height: 1.6;
    color: #444;
}

.details-highlight {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
    padding: 15px;
}

.details-warning {
    background: #ffebee;
    border-left: 3px solid #f44336;
    padding: 15px;
}

/* RYTUAŁ PRZYGOTOWANIA - Nowy Wygląd */
.ritual-step {
    display: flex;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e0d8c3;
    padding: 15px;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.03);
}

.ritual-number {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #b8860b;
    font-weight: bold;
    line-height: 1;
    margin-right: 15px;
    padding-right: 15px;
    border-right: 1px solid #e0d8c3;
    display: flex;
    align-items: center;
}

.ritual-text {
    font-family: 'Crimson Text', serif;
    font-size: 1.1rem;
    color: #333;
    line-height: 1.5;
}

/* Składniki */
.ingredient-li {
    margin-bottom: 15px;
    border-bottom: 1px dashed #e0d8c3;
    padding-bottom: 10px;
    font-family: 'Crimson Text', serif;
}

/* Tooltipy Kontekstowe */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background-color: #a3b899;
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: help;
    margin-left: 5px;
    vertical-align: middle;
    font-family: Arial, sans-serif;
}

.info-tooltip .tooltip-text {
    visibility: hidden;
    width: 240px;
    background-color: #3e4a3d;
    color: #fdfaf0;
    text-align: left;
    border-radius: 4px;
    padding: 10px;
    position: absolute;
    z-index: 1055;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 0.9rem;
    font-weight: normal;
    line-height: 1.3;
    font-family: 'Crimson Text', serif;
}

.info-tooltip:hover .tooltip-text,
.info-tooltip:active .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Specjalna poprawka dla dymka w prawym górnym rogu (animowany nagłówek) */
#modalOriginTooltipIcon .tooltip-text {
    left: auto;
    right: 0;
    transform: none; /* Wyłącza środkowanie */
}

/* Przesunięcie małego "trójkącika" dymka, aby wskazywał na ikonkę */
#modalOriginTooltipIcon .tooltip-text::after {
    left: auto;
    right: 12px;
}

/* --- SKŁADNIKI W JEDNEJ LINII --- */
.ingredient-details-row {
    display: flex;
    justify-content: space-between; /* To rozpycha elementy do lewej i prawej krawędzi */
    align-items: flex-start;
    font-size: 0.95rem;
    color: #666;
    margin-top: 5px;
    width: 100%;
}

.ingredient-role {
    text-align: left;
}

.ingredient-action {
    text-align: right;
}

/* --- KIERUNKOWE DYMKI (ŻEBY NIE UCIEKAŁY ZA EKRAN) --- */

/* Pytajnik w Rolach (po lewej stronie ekranu) otwiera dymek w prawo */
.ingredient-role .info-tooltip .tooltip-text {
    left: -10px;
    transform: none;
}
.ingredient-role .info-tooltip .tooltip-text::after {
    left: 15px;
    margin-left: 0;
}

/* Pytajnik w Działaniu (po prawej stronie ekranu) otwiera dymek w lewo */
.ingredient-action .info-tooltip .tooltip-text {
    left: auto;
    right: -10px;
    transform: none;
}
.ingredient-action .info-tooltip .tooltip-text::after {
    left: auto;
    right: 15px;
    margin-left: 0;
}

/* Pytajnik w nagłówku przepisu (po prawej stronie) otwiera się w lewo */
#modalOriginTooltipIcon .tooltip-text {
    left: auto !important;
    right: 0 !important;
    transform: none !important;
}
#modalOriginTooltipIcon .tooltip-text::after {
    left: auto !important;
    right: 10px !important;
    margin-left: 0 !important;
}

/* --- ZWIJANE PODROZDZIAŁY WEWNĄTRZ GŁÓWNYCH AKORDEONÓW --- */
details.grimoire-subdetails {
    background: transparent;
    border: none;
    border-bottom: 1px dashed #d1c7a7;
    margin-bottom: 5px;
}

details.grimoire-subdetails:last-child {
    border-bottom: none;
}

details.grimoire-subdetails > summary {
    padding: 10px 0;
    font-family: 'Crimson Text', serif;
    font-size: 1.05rem;
    color: #3e4a3d;
    font-weight: bold;
    cursor: pointer;
    list-style: none;
    transition: color 0.2s;
}

details.grimoire-subdetails > summary::before {
    content: "► ";
    font-size: 0.8rem;
    color: #b8860b;
    display: inline-block;
    transition: transform 0.2s;
    margin-right: 5px;
}

details.grimoire-subdetails[open] > summary::before {
    transform: rotate(90deg);
}

details.grimoire-subdetails > summary::-webkit-details-marker {
    display: none;
}

details.grimoire-subdetails > summary:hover {
    color: #2d5a27;
}

.subdetails-content {
    padding: 0 0 15px 20px;
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    color: #444;
    line-height: 1.5;
}

/* ===== Przepisy z Siedziby Kwiatownika (z sieci) ===== */
/* Źródło przepisu: na karcie (pod tytułem) i w nagłówku grymuaru */
.recipe-source { font-size: .88rem; color: var(--kw-muted, #6b6255); margin: -4px 0 12px; font-family: 'Crimson Text', serif;
    overflow-wrap: anywhere; }
.recipe-source i { color: var(--kw-sage, #8a9a5b); }
.recipe-source a { color: var(--kw-green, #2d5a27); font-weight: 600; text-decoration: underline; text-decoration-color: var(--kw-gold-light, #d1b880);
    text-underline-offset: 2px; }
.recipe-source a:hover { color: var(--kw-gold, #9a7b2f); }
.recipe-source-more { font-size: .8rem; background: var(--kw-line-soft, #ebe4cf); border-radius: 10px; padding: 0 6px; margin-left: 2px; }
.recipe-source-modal { flex-basis: 100%; order: 5; margin: 2px 0 0; font-size: .95rem; }

.web-badge {
    font-size: 0.75rem; color: #2f5d8a; border: 1px solid #9db8d3; background: #eef4fa;
    padding: 1px 8px; border-radius: 10px; margin: 0 6px; white-space: nowrap;
}
.alchemical-tag.web-tag { background: #eef4fa; border-color: #9db8d3; color: #2f5d8a; }

/* Wzmianki o przepisach (seria siedziba_wzmianki): przepis opisany na stronie, ale bez pelnego wykonania */
.lead-badge {
    font-size: 0.75rem; color: #8a6116; border: 1px dashed #d4b46a; background: #fbf3df;
    padding: 1px 8px; border-radius: 10px; margin: 0 6px; white-space: nowrap;
}
.recipe-card.recipe-card-lead { border-style: dashed; }
.alchemical-tag.lead-tag { background: #fbf3df; border-color: #d4b46a; color: #8a6116; }
/* Dymek-ciekawostka Wu Xing / Galen (przepisy lecznicze) - po najechaniu, dotknieciu albo z klawiatury */
.alchemical-tag.tradition-tag { position: relative; cursor: help; background: #f6f1e4; border-color: #cdbb8c; color: #6b5626; }
.tradition-tag .tooltip-text {
    visibility: hidden; opacity: 0; transition: opacity .2s; position: absolute; z-index: 1056; top: 130%; right: 0;
    width: 280px; max-width: 80vw; background: #3e4a3d; color: #fdfaf0; text-align: left; border-radius: 4px; padding: 10px;
    font-size: .9rem; line-height: 1.35; font-family: 'Crimson Text', serif; white-space: normal; box-shadow: 0 4px 14px rgba(0,0,0,.2);
}
.tradition-tag .tooltip-text small { color: #d7d2bf; }
.tradition-tag:hover .tooltip-text, .tradition-tag:focus .tooltip-text, .tradition-tag:focus-within .tooltip-text {
    visibility: visible; opacity: 1;
}
.lead-notice { margin: 0 0 14px; padding: 10px 14px; background: #fbf7ec; border: 1px dashed #d4b46a;
    border-left: 4px solid #d4b46a; color: #5b4a2c; font-family: 'Crimson Text', serif; font-size: 1.02rem; }
.lead-notice p { margin: 0 0 6px; }
.lead-notice-title { font-family: 'Playfair Display', serif; font-weight: bold; color: #8a6116; }
.lead-notice .recipe-facts { margin: 6px 0 0; color: #5b4a2c; }
.lead-quote { margin: 8px 0 0; padding: 4px 0 4px 10px; border-left: 2px solid #d4b46a; font-style: italic;
    color: #6d5c3d; word-break: break-word; }
.lead-steps .ritual-text { font-style: italic; color: #8a6116; }
.origin-filter .btn.active { background: #3e4a3d; color: #fdfaf0; border-color: #3e4a3d; }
.recipe-description { font-family: 'Crimson Text', serif; font-size: 1.1rem; color: #444; margin-bottom: 10px; }
.recipe-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 8px; color: #3e4a3d; }
.recipe-facts a, .ingredient-plant-link { color: #2d5a27; text-decoration: underline dotted; }
.recipe-tags { margin-bottom: 12px; }
.recipe-sources { margin: 0; padding-left: 18px; }
.recipe-sources li { margin-bottom: 4px; word-break: break-word; }

/* Uwaga pod opracowaniem z Siedziby Kwiatownika (interpretacja tradycyjna, nie porada medyczna) */
.enrich-note { margin: 12px 0 0; padding: 8px 12px; font-size: 0.85rem; color: #6d5c3d; background: #fbf7ec;
    border-left: 3px solid #d1c7a7; font-style: italic; }
.stamp-dye { color: #6a1b9a; border-color: #6a1b9a; background: #f3e5f5; }
.stamp-cosm { color: #ad1457; border-color: #ad1457; background: #fce4ec; }

/* ~1300 kart: przegladarka rysuje tylko te, ktore sa blisko ekranu (szybsze przewijanie na telefonie) */
.recipe-wrapper { content-visibility: auto; contain-intrinsic-size: auto 300px; }
.btn-details.is-loading { opacity: 0.7; cursor: progress; }

/* Stronicowanie Przepiśnika (static/js/recipes.js: stronicuj) */
.recipe-wrapper.kw-ponad { display: none !important; }
.kat-filter .btn.active { background-color: #3e4a3d; color: #fdfaf0; border-color: #3e4a3d; }
.warn-list { margin: 4px 0 0; padding-left: 18px; }
.warn-list li { margin-bottom: 4px; }
