/* --- DOSTĘP I UDOSTĘPNIANIE: strona gościa (udostepnienie.html), okno właściciela i pasek trybu udostępnienia
       w index.html (js/smartdom_udostepnianie.js, js/smartdom_udostepnienie_gosc.js) --- */

/* ---------------- strona gościa */
body.udo-strona {
    margin: 0; min-height: 100vh; background: #15181c; color: #f2f2f2;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px;
}
.udo-gosc { max-width: 520px; margin: 0 auto; padding: 16px; box-sizing: border-box; }
.udo-karta { background: #22272e; border-radius: 14px; padding: 18px 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35); text-align: center; }
.udo-karta h1 { font-size: 20px; margin: 10px 0; }
.udo-karta h2 { font-size: 17px; margin: 0 0 10px; text-align: left; }
.udo-duza-ikona { font-size: 44px; opacity: 0.85; margin-top: 6px; }
.udo-koniec .udo-duza-ikona { color: #ff8a80; }
.udo-naglowek { display: flex; flex-direction: column; gap: 4px; text-align: left; margin-bottom: 14px; }
.udo-naglowek b { font-size: 19px; }
.udo-naglowek span { font-size: 14px; opacity: 0.8; }
.udo-naglowek .udo-czas { color: #ffd54a; opacity: 1; }
.udo-info { background: #3b3f8f; border-radius: 8px; padding: 10px; text-align: left; }
.udo-element { border-top: 1px solid #39404a; padding: 14px 0 6px; }
.udo-akcje { display: flex; flex-direction: column; gap: 10px; }
.udo-wybor { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.udo-wybor span { flex: 1 1 100%; text-align: left; font-size: 14px; opacity: 0.85; }
.udo-wybor input { width: 110px; min-height: 44px; font-size: 18px; border-radius: 8px; border: 1px solid #555; background: #15181c; color: #fff; padding: 0 8px; }
.udo-btn {
    min-height: 52px; padding: 10px 18px; border: 0; border-radius: 12px; background: #2e7d32; color: #fff;
    font-size: 18px; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.udo-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.udo-btn:focus-visible { outline: 3px solid #00ccff; outline-offset: 2px; }
.udo-btn.udo-duzy { min-height: 120px; font-size: 24px; border-radius: 18px; background: #1565c0; }
.udo-btn.udo-drugi { background: #555c66; }
.udo-btn.udo-trwa { opacity: 0.6; }
.udo-btn.udo-ok { background: #43a047; box-shadow: 0 0 0 4px rgba(67, 160, 71, 0.4); }
.udo-wybor .udo-btn { min-width: 60px; }
.udo-pin { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }
.udo-pin input { width: 150px; min-height: 52px; font-size: 26px; letter-spacing: 6px; text-align: center; border-radius: 10px; border: 1px solid #555; background: #15181c; color: #fff; }
.udo-blad { color: #ff8a80; font-weight: 600; }
.udo-stopka { margin-top: 18px; font-size: 13px; opacity: 0.7; }
.udo-alarm { margin: 6px 0 12px; padding: 16px; border-radius: 12px; font-size: 18px; font-weight: 600; background: #39404a; text-align: left; }
.udo-alarm.uzbrojony { background: #1b5e20; }
.udo-alarm.wylaczony { background: #455a64; }
.udo-alarm.alarm { background: #b3261e; animation: udo-miga 1s infinite alternate; }
@keyframes udo-miga { from { filter: brightness(1); } to { filter: brightness(1.35); } }
.udo-potwierdz { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1400; }
.udo-potwierdz .udo-karta { max-width: 420px; width: 100%; }
.udo-przyciski { display: flex; gap: 12px; justify-content: center; margin-top: 12px; }
.udo-przyciski .udo-btn { flex: 1; }
.udo-toast {
    display: none; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1500;
    max-width: calc(100vw - 32px); box-sizing: border-box; padding: 12px 18px; border-radius: 10px; background: #2e7d32; color: #fff;
}
.udo-toast.blad { background: #b3261e; }

/* ---------------- tryb udostępnienia w pełnym interfejsie (index.html) */
.udo-pasek {
    position: sticky; top: 0; z-index: 1050; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    padding: 8px 12px; background: #3b3f8f; color: #fff; font-size: 14px;
}
.udo-pasek b { flex: 1 1 auto; }
.udo-pasek .control-button { width: auto; min-height: 34px; padding: 4px 12px; font-size: 13px; }
body.udo-tryb #ustawienia, body.udo-tryb #przycisk-wyloguj, body.udo-tryb #przycisk-claude, body.udo-tryb #microphone,
body.udo-tryb .settings-button, body.udo-tryb #udostepnianie_wiersz, body.udo-tryb #chmura_wiersz,
body.udo-tryb a[href="domofon.html"], body.udo-tryb #powiadomienia_przycisk, body.udo-tryb .ekr-rutyny { display: none !important; }
body.udo-podglad .control-button[data-query], body.udo-podglad .control-slider { pointer-events: none !important; opacity: 0.4; }
body.udo-podglad .detail-controls .control-button, body.udo-podglad .detail-controls .control-slider,
body.udo-podglad .detail-controls select, body.udo-podglad .detail-controls input { pointer-events: none !important; opacity: 0.4; }

/* ---------------- okno właściciela "Dostęp i udostępnianie" */
.udo-zakladki { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.udo-zakladki button {
    flex: 1 1 auto; min-height: 40px; padding: 6px 10px; border-radius: 20px; border: 0; background: rgba(128, 128, 128, 0.2); color: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.udo-zakladki button.wybrana { background: rgba(128, 128, 128, 0.35); box-shadow: 0 0 0 1px var(--sd-akcent, #00ccff) inset; }
.udo-kafelki { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.udo-kafel {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 12px; min-height: 96px; text-align: left;
    border: 0; border-radius: var(--sd-promien-sekcji, 12px); background: var(--karta-tlo-wiersza, rgba(128, 128, 128, 0.14)); color: inherit; cursor: pointer;
}
.udo-kafel i { font-size: 22px; color: var(--sd-akcent, #00ccff); filter: drop-shadow(0 0 5px var(--sd-akcent, #00ccff)); }
.udo-kafel b { font-size: 15px; }
.udo-kafel span { font-size: 12px; opacity: 0.8; }
.udo-kafel.szablon i { color: #ffd54a; }
.udo-podsumowanie { padding: 10px 12px; border-radius: 8px; background: #1f3a2a; font-size: 15px; line-height: 1.4; }
.udo-ostrzezenie { padding: 8px 10px; border-radius: 8px; background: #5d3a00; font-size: 14px; }
.udo-urzadzenia { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; border: 1px solid #555; border-radius: 6px; padding: 6px 10px; }
.chmura-formularz label.udo-wiersz-zaznacz { flex-direction: row; align-items: center; gap: 8px; }
.chmura-formularz label.udo-wiersz-zaznacz input { width: 22px; min-height: 22px; height: 22px; flex: 0 0 auto; }
.udo-dni { display: flex; flex-wrap: wrap; gap: 4px; }
.udo-dni label { flex-direction: row !important; align-items: center; gap: 2px !important; padding: 2px 6px; border: 1px solid #555; border-radius: 6px; }
.udo-dni input { width: 18px !important; min-height: 18px !important; height: 18px; }
.udo-godziny { display: flex; gap: 8px; }
.udo-godziny label { flex: 1; }
.udo-qr { display: flex; justify-content: center; }
.udo-qr canvas { width: 220px; height: 220px; image-rendering: pixelated; border-radius: 6px; }
.udo-grupa { margin-top: 12px; }
.udo-grupa > summary, .udo-grupa > h4 { font-weight: 600; margin: 6px 0; cursor: pointer; }
.udo-stan { font-size: 12px; padding: 2px 8px; border-radius: 10px; background: #555; }
.udo-stan.aktywne { background: #2e7d32; }
.udo-stan.zaplanowane, .udo-stan.poza_harmonogramem { background: #3b3f8f; }
.udo-historia { flex: 1 1 100%; font-size: 13px; opacity: 0.9; padding-left: 8px; }

body.light-mode .udo-kafel, body.light-mode .udo-zakladki button { color: inherit; }
body.light-mode .udo-podsumowanie { background: #e3f4e6; color: #1a1a1a; }
body.light-mode .udo-ostrzezenie { background: #fff0d0; color: #1a1a1a; }

/* ---------------- ETAP 8: kod domofonu i powiadomienia (strona gościa), okna harmonogramu i szablony (okno właściciela) */
.udo-kod { margin: 4px 0 10px; font-size: 40px; font-weight: 700; letter-spacing: 10px; font-variant-numeric: tabular-nums; color: #ffd54a; text-align: center; }
.udo-push .udo-akcje { flex-direction: row; flex-wrap: wrap; }
.udo-push .udo-btn { flex: 1 1 140px; background: #1565c0; }
.udo-okna { display: flex; flex-direction: column; gap: 8px; }
.udo-okno { display: flex; flex-direction: column; gap: 6px; padding: 8px; border: 1px solid #555; border-radius: 8px; }
.udo-okno-gora { display: flex; align-items: center; gap: 8px; }
.udo-okno-gora b { flex: 1 1 auto; font-size: 13px; opacity: 0.85; }
.udo-okno-usun { width: auto !important; min-height: 30px !important; padding: 2px 10px !important; }
.udo-szablon-akcje { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.udo-szablon-akcje .control-button { width: auto; min-height: 30px; padding: 2px 8px; font-size: 12px; }
.udo-kafel-box { display: flex; flex-direction: column; }
.udo-kod-tworcy { font-weight: 700; letter-spacing: 3px; color: #ffd54a; }
body.light-mode .udo-kod-tworcy { color: #8a5a00; }
