/* ===== 1. ZMIENNE GLOBALNE I RESET ===== */
:root {
    --primary-color: #007BFF;
    --accent-color: #FFA500;
    --body-bg: #f4f7f6;
    --container-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --light-gray: #f0f0f0;
    --drawer-width: 85%;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; width: 100%; }
html { font-size: 100%; }
body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
}

/* ===== 2. GŁÓWNY KONTENER ===== */
#app-container {
    background: var(--container-bg);
    max-width: 420px;
    width: 100%;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    padding: 1.5rem 1.5rem 7rem 1.5rem; 
}

/* ===== 3. TYPOGRAFIA ===== */
h1 { font-size: 1.75rem; font-weight: 700; text-align: center; color: var(--primary-color); margin-bottom: 1.5rem; }
h2 { font-size: 1.125rem; font-weight: 700; margin-bottom: 0.75rem; }
h4 { font-size: 1rem; font-weight: 700; color: var(--text-color); margin-top: 1.5rem; margin-bottom: 0.5rem; }

/* ===== 4. GRUPY USTAWIEŃ ===== */
.setting-group { margin-bottom: 1.5rem; }
.button-group { display: flex; gap: 0.75rem; }
.choice-btn {
    flex-grow: 1;
    font-family: 'Nunito', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    background-color: var(--container-bg);
    color: var(--primary-color);
    border: 2px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-out;
}
.choice-btn:hover { background-color: var(--light-gray); }
.choice-btn.active { background-color: var(--primary-color); color: var(--container-bg); border-color: var(--primary-color); box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3); }

/* ===== 5. SUWAK ===== */
#doneness-slider { -webkit-appearance: none; width: 100%; height: 10px; background: linear-gradient(90deg, #ffb238 0%, #ffcf2a 100%); border-radius: 5px; outline: none; margin-top: 1rem; }
#doneness-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; background: var(--container-bg); border: 3px solid var(--accent-color); border-radius: 50%; cursor: pointer; margin-top: -7px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); }
.slider-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: #888; margin-top: 0.5rem; }
#doneness-preview { text-align: center; margin-top: 1rem; display: flex; justify-content: center; min-height: 170px; }
#egg-doneness-img { width: 120px; height: 160px; border: none; box-shadow: 0 4px 10px rgba(0,0,0,0.1); cursor: pointer; }

/* ===== 6. PRZYCISKI ===== */
.action-area { margin-top: 2rem; }
#start-button, #cancel-button { width: 100%; font-family: 'Nunito', sans-serif; font-size: 1.2rem; font-weight: 700; padding: 1rem; border: none; border-radius: 12px; cursor: pointer; transition: all 0.2s ease-out; }
#start-button { background-color: var(--accent-color); color: white; box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4); }
#cancel-button { background-color: var(--light-gray); color: var(--text-color); }

/* ===== 7. EKRAN MINUTNIKA ===== */
#timer-screen { display: none; flex-direction: column; align-items: center; justify-content: center; padding-top: 2rem; }
#timer-display { font-family: 'Roboto Mono', monospace; font-size: 5rem; font-weight: 300; color: var(--primary-color); margin: 2rem 0; }

/* ===== 8. WIZUALIZACJA ===== */
#egg-visualizer { width: 160px; height: 210px; position: relative; }
#boiling-egg-img { width: 100%; height: 100%; position: absolute; top: 0; left: 0; z-index: 1; }
#egg-fill { position: absolute; bottom: 0; left: 0; right: 0; width: 100%; height: 0%; background-color: var(--primary-color); opacity: 0.7; z-index: 10; transition: height 1s linear; border-radius: 50% 50% 44% 44% / 60% 60% 40% 40%; overflow: hidden; }

/* ===== 9. EFEKTY KOŃCOWE ===== */
#timer-display.finished { animation: pulse 1s infinite; }
@keyframes pulse { 0% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.05); opacity: 0.8; } 100% { transform: scale(1); opacity: 1; } }

/* ===== 10. HAMBURGER ===== */
.settings-trigger { text-align: right; margin-bottom: 0.25rem; padding-right: 0.5rem; }
#open-settings-btn { background: none; border: none; font-size: 2rem; color: var(--text-color); opacity: 0.6; cursor: pointer; line-height: 1; padding: 0.25rem; }

/* ===== 11. MODALE (OGÓLNE) ===== */
#modal-overlay, #about-modal-overlay, #privacy-modal-overlay, #custom-dialog-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(3px);
    z-index: 1000; opacity: 1; visibility: visible; transition: opacity 0.3s ease;
}
.modal-hidden { opacity: 0 !important; visibility: hidden !important; pointer-events: none; }
.modal-content {
    background: var(--container-bg); padding: 1.5rem; border-radius: 16px; width: 90%; max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); position: relative; max-height: 80vh; overflow-y: auto;
    margin: auto; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}

/* --- DRAWER (MENU BOCZNE) --- */
.side-drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: var(--drawer-width); max-width: 320px;
    background: var(--container-bg); box-shadow: -5px 0 25px rgba(0,0,0,0.2);
    z-index: 1001; transform: translateX(0); 
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex; flex-direction: column; padding: 0;
}
.modal-hidden .side-drawer { transform: translateX(100%); }

/* Elementy Drawera */
.drawer-header {
    padding: 2rem 1.5rem 1rem;
    display: flex; justify-content: space-between; align-items: center;
    flex-direction: row-reverse;
}
.drawer-header h2 { margin: 0; font-size: 1.5rem; color: var(--text-color); }
#modal-close-btn, .plain-close-btn {
    position: static; background: none; border: none; padding: 0.25rem;
    color: var(--text-color); opacity: 0.5; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
}
#modal-close-btn svg, .plain-close-btn svg { width: 28px; height: 28px; stroke-width: 2.5; }
#modal-close-btn:hover, .plain-close-btn:hover { opacity: 1; }
#about-modal-close-btn, #privacy-modal-close-btn { position: absolute; top: 10px; right: 10px; }

/* Karta Premium */
.premium-card {
    margin: 1rem; padding: 1rem;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 12px; color: #fff;
    box-shadow: 0 4px 10px rgba(255, 165, 0, 0.3);
}
.premium-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; }
.premium-header h3 { margin: 0; color: #fff; font-size: 1.1rem; }
.premium-header p { margin: 0; font-size: 0.8rem; opacity: 0.9; }
.setting-row.no-bg { background: none; padding: 0; margin: 0; display: flex; justify-content: flex-end; }
.premium-btn {
    width: 100%; margin-top: 0.5rem; padding: 0.5rem;
    background: #fff; color: #FFA500; font-weight: 700; border: none; border-radius: 6px; cursor: pointer;
}

/* Lista Menu */
.drawer-list { flex-grow: 1; overflow-y: auto; padding: 0 1rem 2rem; }
.drawer-item {
    display: flex; align-items: center; padding: 1rem 0.5rem;
    border-bottom: 1px solid #eee; cursor: pointer; color: var(--text-color);
    border-radius: 8px; /* Dodane zaokrąglenie */
}
.drawer-item:hover { background-color: #f0f4f8; color: var(--primary-color); }

.drawer-icon { 
    margin-right: 1rem; width: 24px; height: 24px; 
    display: flex; align-items: center; justify-content: center; color: #666; 
}
.drawer-icon svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 2; }
.drawer-text { flex-grow: 1; font-size: 1rem; font-weight: 600; }
.drawer-text small { display: block; font-size: 0.75rem; color: #888; font-weight: 400; margin-top: 2px; }
.drawer-divider { border: 0; border-top: 1px solid #eee; margin: 1rem 0; }
.drawer-footer { padding: 1rem; text-align: center; font-size: 0.75rem; color: #ccc; }

/* ===== 12. AKORDEON (W MODALU USTAWIEŃ) ===== */
.accordion { border-top: 1px solid var(--border-color); }
.accordion-item { border-bottom: 1px solid var(--border-color); }
.accordion-header {
    width: 100%; background: none; border: none; padding: 1rem 0.5rem;
    font-size: 1rem; font-weight: 700; font-family: 'Nunito', sans-serif;
    color: var(--text-color); text-align: left; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
}
.accordion-header::after {
    content: '+'; font-size: 1.5rem; font-weight: 300; color: var(--primary-color); transition: transform 0.2s ease-out;
}
.accordion-item.active .accordion-header::after { content: '−'; transform: translateY(-2px); }
.accordion-panel { max-height: 0; overflow: hidden; transition: max-height 0.3s ease-out, padding 0.3s ease-out; font-size: 0.9rem; line-height: 1.5; }
.accordion-item.active .accordion-panel { max-height: 400px; padding: 0.5rem 0.5rem 1.5rem 0.5rem; }
.accordion-panel ol { padding-left: 25px; margin-top: 1rem; }

/* ===== 13. PRZEŁĄCZNIK I PRZYCISKI ===== */
.setting-row { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; padding: 0.5rem; background: var(--body-bg); border-radius: 8px; }
.setting-row span { font-weight: 600; }
.action-btn { background: var(--primary-color); color: white; border: none; padding: 0.75rem 1rem; border-radius: 8px; font-weight: 700; font-family: 'Nunito', sans-serif; cursor: pointer; transition: background 0.2s; }
.action-btn:hover { background: #0056b3; }
.setting-row.multi-button { justify-content: space-around; gap: 1rem; }
.setting-row.multi-button .action-btn { flex-grow: 1; }
.action-btn.gray { background: var(--light-gray); color: var(--text-color); }
.action-btn.gray:hover { background: var(--border-color); }
.premium-unlocked #premium-unlock-row { display: none; }
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 28px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: 0.4s; border-radius: 28px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: 0.4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--primary-color); }
input:checked + .slider:before { transform: translateX(22px); }

/* ===== 15. STYLE TEKSTU W MODALACH ===== */
#about-modal-content h3, #privacy-modal-content h3 { font-family: 'Nunito', sans-serif; color: var(--text-color); margin-top: 1.5rem; margin-bottom: 0.5rem; }
#about-modal-content p, #privacy-modal-content p { font-size: 0.9rem; line-height: 1.6; margin-bottom: 1rem; }
#about-modal-content ul, #privacy-modal-content ul { padding-left: 20px; margin-bottom: 1rem; }
#about-modal-content li, #privacy-modal-content li { margin-bottom: 0.5rem; font-size: 0.9rem; }

/* ===== 17. ANIMACJA BĄBELKÓW ===== */
#egg-fill::before {
    content: ''; position: absolute; inset: 0;
    background-image: radial-gradient(circle at 25% 25%, rgba(255,255,255,0.3) 2px, transparent 3px), radial-gradient(circle at 75% 75%, rgba(255,255,255,0.3) 2px, transparent 3px), radial-gradient(circle at 20% 70%, rgba(255,255,255,0.4) 3px, transparent 4px), radial-gradient(circle at 80% 30%, rgba(255,255,255,0.4) 3px, transparent 4px), radial-gradient(circle at 50% 50%, rgba(255,255,255,0.5) 4px, transparent 5px);
    background-size: 50px 50px; animation: rise 2s linear infinite; z-index: 1; 
}
@keyframes rise { from { background-position: 0 0; } to { background-position: 0 100%; } }

/* ===== 18. BANNER COOKIE ===== */
#cookie-banner {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--container-bg); border-top: 1px solid var(--border-color);
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.07); z-index: 99;
    padding: 1rem; display: flex; align-items: center; justify-content: center; gap: 1.5rem; flex-wrap: wrap;
}
@media (min-width: 768px) { #cookie-banner { bottom: 45px; } } 
#cookie-banner p { font-size: 0.9rem; text-align: center; }
.banner-buttons .action-btn { padding: 0.75rem 1rem; }
body.cookie-consent-given #cookie-banner { display: none; }
body.cookie-consent-given #app-container { padding-bottom: 1.5rem; }
body:not(.cookie-consent-given) #app-container { padding-bottom: 7rem; }

/* ===== 20. CUSTOM DIALOG ===== */
#custom-dialog-overlay { z-index: 1100; } 
#custom-dialog-content h3 { color: var(--primary-color); text-align: center; }
#custom-dialog-content p { text-align: center; }
.premium-code-input { width: 100%; padding: 0.75rem; border: 2px solid var(--border-color); border-radius: 8px; text-align: center; display: none; }
#custom-dialog-buttons { background: none; padding: 0; display: flex; gap: 10px; width: 100%; }
#custom-dialog-buttons button { flex: 1; margin: 0; }

/* ===== 21. DESKTOP I PWA ===== */
@media (display-mode: standalone) { #app-footer { display: none; } }
@media (min-width: 768px) {
    #about-modal-content, #privacy-modal-content { max-width: 700px; }
    .side-drawer { max-width: 380px; }
}
#app-footer { display: none; }


/* ===== 22. SPECJALNE POPRAWKI DLA MENU I WZORU ===== */

/* Poprawka "Instrukcji" w Menu */
.drawer-list .accordion-item {
    border-bottom: none; /* Usuwamy kreskę oddzielającą */
    margin: 0; /* Reset marginesu */
}

.drawer-list .accordion-header {
    padding: 1rem 0.5rem; /* Domyślne paddingi */
    border-radius: 8px; /* Zaokrąglenie jak w innych elementach menu */
    color: #444;
    transition: background 0.2s;
}
/* Upewnij się, że klasa drawer-item-header nie psuje layoutu */
.drawer-item-header { 
    background: none !important; 
    border: none !important; 
}
.drawer-list .accordion-header:hover {
    background-color: #f0f4f8; /* Efekt hover jak reszta menu */
    color: var(--primary-color);
}
/* Ikona i tekst w instrukcji */
.icon-text {
    display: flex; 
    align-items: center;
    font-weight: 600; /* Dopasowanie wagi czcionki */
    font-size: 1rem;
}

/* Poprawka Stylu Wzoru (Formula Box) */
.formula-box {
    background: #f1f5f9; /* Jasne tło */
    border-left: 4px solid var(--primary-color);
    padding: 1rem;
    margin: 1.5rem 0;
    border-radius: 4px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.95rem;
    color: #2c3e50;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow-x: auto;
}
.formula-box code {
    display: block;
}
/* Lista pod wzorem */
.formula-list {
    margin-top: 1rem;
    padding-left: 1rem;
}
.formula-list li {
    margin-bottom: 0.5rem;
    color: #555;
}
.formula-list b {
    color: var(--primary-color);
}