/* ============================================================
   CLICKHALLO — style.css
   Wspólny arkusz stylów dla całego projektu.

   Używany przez (link rel="stylesheet" href="/style.css"):
     index.php, family_login.php, register.php,
     password_reset.php, password_new.php, verify_email.php,
     family_dashboard.php, windows_settings.php, dashboard.php,
     regulamin.php, polityka-prywatnosci.php

   Panel admina używa osobnej sekcji: .admin-layout { … }
   i nie ładuje tego pliku (admin_*.php mają własny <style>
   zastąpiony przez style-admin.css — osobny krok).
   ============================================================ */


/* ─────────────────────────────────────────
   1. RESET
   ───────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}


/* ─────────────────────────────────────────
   2. DESIGN TOKENS
   ───────────────────────────────────────── */
:root {
    /* kolory główne */
    --purple:      #7c3aed;
    --purple-dark: #4c1d95;
    --purple-pale: #c4b5fd;
    --purple-hover: #6d28d9;

    /* tło */
    --bg:          #0a0a2e;
    --bg2:         #0d1b4b;
    --bg-radial:   radial-gradient(ellipse at center, var(--bg) 0%, var(--bg2) 50%, #1a0a3e 100%);

    /* tekst */
    --text:        rgba(255, 255, 255, 0.9);
    --muted:       rgba(255, 255, 255, 0.55);
    --muted-dim:   rgba(255, 255, 255, 0.35);

    /* ramki / powierzchnie */
    --border:      rgba(255, 255, 255, 0.12);
    --card-bg:     rgba(255, 255, 255, 0.05);
    --card-border: rgba(196, 181, 253, 0.18);

    /* stany semantyczne */
    --color-ok:      #86efac;
    --color-ok-bg:   rgba(34, 197, 94, 0.15);
    --color-ok-bd:   rgba(34, 197, 94, 0.3);

    --color-warn:    #fde68a;
    --color-warn-bg: rgba(251, 191, 36, 0.15);
    --color-warn-bd: rgba(251, 191, 36, 0.3);

    --color-err:     #fca5a5;
    --color-err-bg:  rgba(220, 38, 38, 0.12);
    --color-err-bd:  rgba(220, 38, 38, 0.3);

    --color-sleep:   #a5b4fc;
    --color-sleep-bg: rgba(99, 102, 241, 0.15);
    --color-sleep-bd: rgba(99, 102, 241, 0.3);

    --color-life:    #67e8f9;
    --color-life-bg: rgba(34, 211, 238, 0.15);
    --color-life-bd: rgba(34, 211, 238, 0.3);

    /* typografia */
    --font-body:    'Inter', sans-serif;
    --font-display: 'Sora', sans-serif;

    /* nav */
    --nav-h: 60px;
}


/* ─────────────────────────────────────────
   3. BAZOWE ELEMENTY
   ───────────────────────────────────────── */
html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-radial);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Efekt gwiazd — nakładka na body */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at  8% 15%, rgba(255,255,255,0.70) 0%, transparent 100%),
        radial-gradient(1px 1px at 25% 55%, rgba(255,255,255,0.40) 0%, transparent 100%),
        radial-gradient(1px 1px at 48%  8%, rgba(255,255,255,0.60) 0%, transparent 100%),
        radial-gradient(1px 1px at 68% 75%, rgba(255,255,255,0.30) 0%, transparent 100%),
        radial-gradient(1px 1px at 88% 35%, rgba(255,255,255,0.50) 0%, transparent 100%),
        radial-gradient(1px 1px at 18% 88%, rgba(255,255,255,0.40) 0%, transparent 100%),
        radial-gradient(1px 1px at 78% 12%, rgba(255,255,255,0.60) 0%, transparent 100%),
        radial-gradient(1px 1px at 42% 48%, rgba(255,255,255,0.30) 0%, transparent 100%),
        radial-gradient(1px 1px at 58% 28%, rgba(255,255,255,0.50) 0%, transparent 100%),
        radial-gradient(1px 1px at 12% 65%, rgba(255,255,255,0.40) 0%, transparent 100%),
        radial-gradient(1px 1px at 35% 92%, rgba(255,255,255,0.30) 0%, transparent 100%),
        radial-gradient(1px 1px at 92% 60%, rgba(255,255,255,0.50) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--purple-pale); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { font-weight: 700; }


/* ─────────────────────────────────────────
   4. NAWIGACJA — górny pasek (publiczne + auth)
   ───────────────────────────────────────── */
nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: rgba(10, 10, 46, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
    padding: 0 24px;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.3rem;
    color: var(--purple-pale);
    text-decoration: none;
    letter-spacing: -0.5px;
}

.nav-brand:hover { text-decoration: none; }

/* Linki desktopowe */
.nav-links {
    display: flex;
    gap: 8px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    color: var(--muted);
    transition: color .2s;
}

.nav-links a:hover { color: var(--text); text-decoration: none; }

.nav-links .btn-nav-outline {
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.nav-links .btn-nav-outline:hover {
    border-color: var(--purple-pale);
    color: var(--purple-pale);
}

.nav-links .btn-nav {
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    font-weight: 600;
    border: 1px solid rgba(196, 181, 253, 0.3);
}

.nav-links .btn-nav:hover {
    background: linear-gradient(135deg, var(--purple-hover), var(--purple-dark));
    color: #fff;
    text-decoration: none;
}

/* Panel prawy (dashboard / settings nav) */
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user {
    font-size: 0.85rem;
    color: var(--muted);
}

/* Hamburger */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    border-radius: 8px;
    transition: background .2s;
}

.nav-hamburger:hover { background: rgba(255, 255, 255, 0.08); }

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--purple-pale);
    border-radius: 2px;
    transition: transform .3s, opacity .3s;
}

.nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Menu mobilne */
.nav-mobile {
    display: none;
    position: fixed;
    top: var(--nav-h);
    left: 0; right: 0;
    background: rgba(10, 10, 46, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    z-index: 99;
    padding: 16px 24px 24px;
    flex-direction: column;
    gap: 8px;
    transform: translateY(-10px);
    opacity: 0;
    transition: transform .25s ease, opacity .25s ease;
}

.nav-mobile.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
}

.nav-mobile a {
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 10px;
    color: var(--muted);
    transition: color .2s, background .2s;
}

.nav-mobile a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); text-decoration: none; }

.nav-mobile .btn-nav-outline {
    border: 1px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.nav-mobile .btn-nav {
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    font-weight: 700;
    text-align: center;
    border: 1px solid rgba(196, 181, 253, 0.3);
    margin-top: 4px;
}

@media (max-width: 768px) {
    .nav-links    { display: none; }
    .nav-hamburger { display: flex; }
}


/* ─────────────────────────────────────────
   5. PRZYCISKI — system
   ───────────────────────────────────────── */

/* Główny (gradientowy) */
.btn-primary {
    display: inline-block;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    padding: 16px 36px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-display);
    text-decoration: none;
    border: 1px solid rgba(196, 181, 253, 0.3);
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.4);
    transition: transform .15s, box-shadow .15s;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 50px rgba(124, 58, 237, 0.6);
    color: #fff;
    text-decoration: none;
}

/* Drugorzędny (szklany) */
.btn-secondary {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    padding: 16px 36px;
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

.btn-secondary:hover {
    border-color: var(--purple-pale);
    background: rgba(196, 181, 253, 0.08);
    text-decoration: none;
}

/* Submit (formularz centrowany) */
.btn-submit {
    display: block;
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 14px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: var(--font-display);
    cursor: pointer;
    margin-top: 28px;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.4);
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 50px rgba(124, 58, 237, 0.6);
}

/* Mały przycisk akcji (w kartach) */
.btn-action {
    display: inline-block;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: opacity .2s;
    white-space: nowrap;
}

.btn-action:hover { opacity: 0.85; color: #fff; text-decoration: none; }

/* Powrót / neutralny */
.btn-back {
    display: inline-block;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s;
    cursor: pointer;
}

.btn-back:hover { background: rgba(255, 255, 255, 0.14); text-decoration: none; }

/* Wyloguj */
.btn-logout {
    display: inline-block;
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s;
    cursor: pointer;
}

.btn-logout:hover { background: rgba(239, 68, 68, 0.3); text-decoration: none; }

/* Niebezpieczny */
.btn-danger {
    display: inline-block;
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.btn-danger:hover { background: rgba(239, 68, 68, 0.22); border-color: rgba(239, 68, 68, 0.65); }

/* Ikona (mały, borderowany) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.btn-icon:hover { background: rgba(255, 255, 255, 0.14); }

.btn-icon.danger {
    color: var(--color-err);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-icon.danger:hover { background: rgba(239, 68, 68, 0.15); }

/* Zapisz / Anuluj (formularze inline) */
.btn-save {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
}

.btn-save:hover { opacity: 0.85; }

.btn-cancel {
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s;
}

.btn-cancel:hover { background: rgba(255, 255, 255, 0.1); }

/* Kopiuj link */
.btn-copy {
    padding: 8px 14px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .2s;
}

.btn-copy:hover { opacity: 0.85; }

/* Zaproś */
.btn-invite {
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity .2s;
    align-self: flex-end;
}

.btn-invite:hover { opacity: 0.85; }

/* Dodaj okno (dashed) */
.btn-add-window {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 12px;
    background: rgba(124, 58, 237, 0.15);
    color: var(--purple-pale);
    border: 1px dashed rgba(196, 181, 253, 0.4);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .2s;
}

.btn-add-window:hover { background: rgba(124, 58, 237, 0.25); }
.btn-add-window:disabled { opacity: 0.4; cursor: not-allowed; }

/* Zarządzaj oknami (link w karcie) */
.btn-manage-windows {
    display: inline-block;
    margin-top: 14px;
    padding: 10px 18px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #fff;
    border: 1px solid rgba(196, 181, 253, 0.3);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity .2s;
}

.btn-manage-windows:hover { opacity: 0.85; text-decoration: none; color: #fff; }

/* Reset link seniora */
.btn-reset-link {
    display: block;
    width: 100%;
    padding: 11px 16px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.12);
    color: var(--color-err);
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}

.btn-reset-link:hover { background: rgba(239, 68, 68, 0.22); border-color: rgba(239, 68, 68, 0.65); }

/* Usuń członka rodziny */
.btn-delete-member {
    background: none;
    border: none;
    color: var(--color-err);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 6px;
}

.btn-delete-member:hover { color: #ef4444; }

/* Zgoda (duży przycisk) */
.btn-consent {
    display: block;
    width: 100%;
    margin-top: 28px;
    padding: 18px;
    border: none;
    border-radius: 16px;
    background: radial-gradient(circle at 35% 35%, var(--purple), var(--purple-dark));
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
    transition: transform .15s, box-shadow .15s;
    letter-spacing: 0.5px;
}

.btn-consent:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 50px rgba(124, 58, 237, 0.7);
}

.btn-consent:active { transform: scale(0.98); }


/* ─────────────────────────────────────────
   6. ALERTY / FLASH MESSAGES
   ───────────────────────────────────────── */
.alert,
.alert-msg {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.alert-success {
    background: var(--color-ok-bg);
    color: var(--color-ok);
    border: 1px solid var(--color-ok-bd);
}

.alert-error {
    background: var(--color-err-bg);
    color: var(--color-err);
    border: 1px solid var(--color-err-bd);
}

.alert-warn {
    background: var(--color-warn-bg);
    color: var(--color-warn);
    border: 1px solid var(--color-warn-bd);
}

/* Wersja zagnieżdżona w karcie (np. po zapisaniu) */
.reset-msg {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.83rem;
    font-weight: 600;
}

.reset-msg.success { background: var(--color-ok-bg);  color: var(--color-ok);  border: 1px solid var(--color-ok-bd); }
.reset-msg.error   { background: var(--color-err-bg); color: var(--color-err); border: 1px solid var(--color-err-bd); }


/* ─────────────────────────────────────────
   7. KARTY (card)
   ───────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 20px;
    backdrop-filter: blur(10px);
    margin-bottom: 16px;
}

/* Karta zalogowania / rejestracji (większy padding, silniejszy cień) */
.card-auth {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(196, 181, 253, 0.2);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 440px;
    width: 100%;
    backdrop-filter: blur(12px);
    box-shadow: 0 0 60px rgba(124, 58, 237, 0.2);
}

@media (max-width: 768px) {
    .card-auth { padding: 36px 24px; border-radius: 20px; }
}

@media (max-width: 400px) {
    .card-auth { padding: 28px 18px; }
}

.card-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--purple-pale);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Karta niebezpieczna (sekcja usunięcia) */
.card-danger {
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.04);
}

.card-danger .card-title { color: var(--color-err); }

/* Logo marki w karcie auth */
.card-logo {
    text-align: center;
    margin-bottom: 36px;
}

.card-logo .brand {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    color: var(--purple-pale);
    letter-spacing: -1px;
    display: block;
}

.card-logo .subtitle {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.card-logo .badge {
    display: inline-block;
    background: rgba(196, 181, 253, 0.15);
    border: 1px solid rgba(196, 181, 253, 0.3);
    color: var(--purple-pale);
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 10px;
}

/* Stopka karty auth */
.card-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--muted);
}

.card-footer a { color: var(--purple-pale); font-weight: 600; }
.card-footer a:hover { text-decoration: underline; }


/* ─────────────────────────────────────────
   8. FORMULARZE
   ───────────────────────────────────────── */
label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 5px;
    margin-top: 18px;
}

label:first-of-type { margin-top: 0; }

input[type="email"],
input[type="password"],
input[type="text"],
input[type="tel"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 13px 15px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(196, 181, 253, 0.2);
    border-radius: 10px;
    font-size: 1rem;
    color: #fff;
    font-family: var(--font-body);
    transition: border-color .2s, background .2s;
}

/* Mniejsze inputy w panelach (okna, zaproszenia) */
.field input,
.invite-fields input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.9rem;
}

input::placeholder,
textarea::placeholder { color: rgba(255, 255, 255, 0.25); }

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--purple-pale);
    background: rgba(255, 255, 255, 0.1);
}

input[type="checkbox"] {
    accent-color: var(--purple);
    cursor: pointer;
}

/* Zgody (konsent wall + rejestracja) */
.consent-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 18px;
}

.consent-item input[type="checkbox"] {
    margin-top: 3px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    flex-shrink: 0;
}

.consent-item label {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    cursor: pointer;
    margin-top: 0;
}

.consent-item label a {
    color: var(--purple-pale);
    text-decoration: underline;
}

/* Linia pozioma w formularzu */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0;
}

/* Pole z etykietą (okna, zaproszenia) */
.field label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 4px;
    margin-top: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

/* Pasek układu wierszowego formularza */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

@media (min-width: 560px) {
    .form-row.times { flex-direction: row; }
    .form-row.times .field { flex: 1; }
}

.invite-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 560px) {
    .invite-fields { flex-direction: row; align-items: flex-end; }
}

.invite-fields .field { flex: 1; }


/* ─────────────────────────────────────────
   9. LAYOUT — WIDOKI DASHBOARDÓW
   ───────────────────────────────────────── */

/* Wrapper strony (admin-panels / settings) */
.page {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: calc(var(--nav-h) + 16px) 16px 40px;
}

.page-narrow {
    max-width: 720px;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 6px;
}

.page-subtitle {
    font-size: 0.9rem;
    color: var(--muted);
    margin-bottom: 20px;
}

/* Strony auth (centrowanie pionowe) */
.page-wrap {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--nav-h) + 20px) 20px 40px;
}

/* Siatka 2-kolumnowa */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 640px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
}


/* ─────────────────────────────────────────
   10. ODZNAKI STATUSU (badge)
   ───────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 14px;
}

.badge-ok      { background: var(--color-ok-bg);   color: var(--color-ok);   border: 1px solid var(--color-ok-bd); }
.badge-pending { background: var(--color-warn-bg);  color: var(--color-warn); border: 1px solid var(--color-warn-bd); }
.badge-alert   { background: var(--color-err-bg);   color: var(--color-err);  border: 1px solid var(--color-err-bd);
                 animation: pulse-red 1.5s ease-in-out infinite; }
.badge-sleep   { background: var(--color-sleep-bg); color: var(--color-sleep); border: 1px solid var(--color-sleep-bd); }
.badge-waiting { background: rgba(251,191,36,0.12); color: #fef08a; border: 1px solid rgba(251,191,36,0.25); }
.badge-active  { background: rgba(59,130,246,0.15); color: #93c5fd; border: 1px solid rgba(59,130,246,0.35); }

@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* Małe odznaki inline */
.badge-count {
    display: inline-block;
    background: rgba(196, 181, 253, 0.15);
    color: var(--purple-pale);
    padding: 2px 10px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.85rem;
}

/* Role w tabeli rodziny */
.role-admin  { background: rgba(37,99,235,0.15);  color: #93c5fd; padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.role-member { background: rgba(255,255,255,0.08); color: var(--muted); padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }

/* Typ alertu w historii */
.alert-type     { display: inline-block; padding: 2px 8px; border-radius: 8px; font-size: 0.75rem; font-weight: 600; }
.alert-resolved { background: var(--color-ok-bg);  color: var(--color-ok); }
.alert-active   { background: var(--color-err-bg); color: var(--color-err); }

/* Plan badge */
.plan-badge {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 8px;
}

.plan-free     { background: var(--color-sleep-bg); color: var(--color-sleep); border: 1px solid var(--color-sleep-bd); }
.plan-standard { background: var(--color-life-bg);  color: var(--color-life);  border: 1px solid var(--color-life-bd); }
.plan-premium  { background: var(--color-warn-bg);  color: var(--color-warn);  border: 1px solid var(--color-warn-bd); }
.plan-b2b      { background: var(--color-ok-bg);    color: var(--color-ok);    border: 1px solid var(--color-ok-bd); }

/* Statusy okna (w tabeli rodziny) */
.w-status {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 2px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.w-status.ok                  { background: var(--color-ok-bg);   color: var(--color-ok); }
.w-status.pending             { background: var(--color-warn-bg);  color: var(--color-warn); }
.w-status.sleep               { background: var(--color-sleep-bg); color: var(--color-sleep); }
.w-status.alert               { background: var(--color-err-bg);   color: var(--color-err); }
.w-status.life_sign           { background: var(--color-life-bg);  color: var(--color-life); }
.w-status.missed_unescalated  { background: var(--color-warn-bg);  color: var(--color-warn); }
.w-status.life_sign .life-sign-label { font-size: 0.65em; opacity: 0.75; margin-left: 3px; }


/* ─────────────────────────────────────────
   11. WIERSZE INFORMACYJNE (info-row)
   ───────────────────────────────────────── */
.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    gap: 8px;
}

.info-row:last-child { border-bottom: none; }
.info-label { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.info-value { color: var(--text); font-weight: 600; text-align: right; }

/* Wiersze okien czasowych */
.window-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    gap: 8px;
}

.window-row:last-child { border-bottom: none; }
.window-row .w-label  { color: var(--text); font-weight: 600; }
.window-row .w-time   { color: var(--muted); font-size: 0.78rem; }

/* Item okna w ustawieniach */
.window-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.window-item:last-child { border-bottom: none; }
.window-item .w-info   { flex: 1; min-width: 0; }
.window-item .w-label  { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.window-item .w-time   { font-size: 0.82rem; color: var(--muted); margin-top: 2px; }
.window-item .w-actions { display: flex; gap: 8px; flex-shrink: 0; }

.empty-hint {
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
    padding: 16px 0;
}

.limit-hint {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 8px;
    line-height: 1.5;
}

.min-duration-hint {
    font-size: 0.78rem;
    color: var(--muted-dim);
    margin-top: 4px;
}


/* ─────────────────────────────────────────
   12. TABELA DANYCH
   ───────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    padding: 9px 10px;
    text-align: left;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr.today-row    { background: rgba(34, 197, 94, 0.05); }

@media (max-width: 480px) {
    .data-table { font-size: 0.82rem; }
    .data-table th,
    .data-table td { padding: 9px 6px; }
}


/* ─────────────────────────────────────────
   13. LINK BOX (link zaproszenia seniora)
   ───────────────────────────────────────── */
.link-box {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.link-box p {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.link-copy {
    display: flex;
    gap: 8px;
    align-items: center;
}

.link-copy input {
    flex: 1;
    min-width: 0;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.78rem;
    color: var(--muted);
    font-family: monospace;
}

.link-hint  { font-size: 0.73rem; color: rgba(255, 255, 255, 0.3); margin-top: 5px; }
.invite-hint { font-size: 0.73rem; color: rgba(255, 255, 255, 0.3); margin-top: 8px; }

/* Formularz zaproszenia */
.invite-form {
    border-top: 1px solid var(--border);
    padding-top: 18px;
    margin-top: 4px;
}

.invite-form > p {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}


/* ─────────────────────────────────────────
   14. PRZYCISK HALLO + ANIMACJE
   ───────────────────────────────────────── */
.hallo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Rozmiar ustawia per-page (dashboard vs index mogą mieć różne constraints) */
    flex-shrink: 0;
}

.halo-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
    animation: halo-spin 8s linear infinite;
}

.halo-ring-1 {
    width: 90.6%;
    height: 90.6%;
    border-color: rgba(196, 181, 253, 0.25);
    animation-duration: 12s;
}

.halo-ring-2 {
    width: 96.9%;
    height: 96.9%;
    border-color: rgba(167, 139, 250, 0.15);
    animation-duration: 18s;
    animation-direction: reverse;
}

.halo-rainbow {
    position: absolute;
    width: 87.5%;
    height: 87.5%;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(255,100,100,0.3),
        rgba(255,165,  0,0.3),
        rgba(255,255,  0,0.3),
        rgba(100,255,100,0.3),
        rgba(100,200,255,0.3),
        rgba(150,100,255,0.3),
        rgba(255,100,200,0.3),
        rgba(255,100,100,0.3)
    );
    animation: halo-spin 20s linear infinite;
    filter: blur(8px);
}

@keyframes halo-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.halo-glow {
    position: absolute;
    width: 81.25%;
    height: 81.25%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139,92,246,0.2) 0%, transparent 70%);
    animation: halo-pulse 3s ease-in-out infinite;
}

@keyframes halo-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%       { transform: scale(1.15); opacity: 1; }
}

.hallo-btn {
    position: relative;
    z-index: 2;
    width:  68.75%;
    height: 68.75%;
    border-radius: 50%;
    border: 3px solid rgba(196, 181, 253, 0.5);
    cursor: pointer;
    font-weight: 900;
    color: #fff;
    background: radial-gradient(circle at 35% 35%, var(--purple), var(--purple-dark) 60%, #2e1065);
    box-shadow:
        0 0 40px rgba(139,92,246,0.6),
        0 0 80px rgba(139,92,246,0.3),
        inset 0 0 30px rgba(196,181,253,0.1);
    transition: transform .15s, box-shadow .15s, border-color .4s, background .4s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    line-height: 1.1;
    user-select: none;
    letter-spacing: 2px;
    font-family: var(--font-display);
}

.hallo-btn span.sub {
    font-weight: 500;
    opacity: 0.8;
    letter-spacing: 0;
    font-family: var(--font-body);
}

.hallo-btn:hover {
    transform: scale(1.05);
    box-shadow:
        0 0 60px rgba(139,92,246,0.8),
        0 0 100px rgba(139,92,246,0.4),
        inset 0 0 30px rgba(196,181,253,0.2);
}

.hallo-btn:active { transform: scale(0.96); }

/* Stan: kliknięty dziś */
.hallo-btn.clicked-today {
    border-color: rgba(74, 222, 128, 0.85);
    box-shadow:
        0 0 40px rgba(74,222,128,0.5),
        0 0 80px rgba(74,222,128,0.2),
        inset 0 0 30px rgba(74,222,128,0.08);
}

.hallo-btn.clicked-today:hover {
    box-shadow:
        0 0 60px rgba(74,222,128,0.7),
        0 0 100px rgba(74,222,128,0.35),
        inset 0 0 30px rgba(74,222,128,0.15);
}

/* Stan: znak życia (klik poza oknem) — pomarańczowa obwódka.
   Kolor spójny z żółtym statusem w family_dashboard (#fbbf24). */
.hallo-btn.life-sign {
    border-color: rgba(251, 191, 36, 0.85);
    box-shadow:
        0 0 40px rgba(251,191,36,0.5),
        0 0 80px rgba(251,191,36,0.2),
        inset 0 0 30px rgba(251,191,36,0.08);
}

.hallo-btn.life-sign:hover {
    box-shadow:
        0 0 60px rgba(251,191,36,0.7),
        0 0 100px rgba(251,191,36,0.35),
        inset 0 0 30px rgba(251,191,36,0.15);
}

/* Stan: już aktywny (klik PRZED otwarciem okna) — niebieska obwódka.
   Pozytywny sygnał "Bliski na nogach, okno dopiero nadejdzie". Nie ostrzegawczy. */
.hallo-btn.early-active {
    border-color: rgba(59, 130, 246, 0.8);
    box-shadow:
        0 0 40px rgba(59,130,246,0.5),
        0 0 80px rgba(59,130,246,0.2),
        inset 0 0 30px rgba(59,130,246,0.08);
}

.hallo-btn.early-active:hover {
    box-shadow:
        0 0 60px rgba(59,130,246,0.7),
        0 0 100px rgba(59,130,246,0.35),
        inset 0 0 30px rgba(59,130,246,0.15);
}

/* Stan: alarm eskalacyjny (okno minęło bez kliku, cron powiadamia rodzinę).
   Czerwony BEZ pulsowania — odróżnia od pulsującego SOS. Sygnał dla Bliskiego
   "przegapiłeś okno, kliknij by rozbroić". */
.hallo-btn.alert-active {
    border-color: rgba(239, 68, 68, 0.75);
    box-shadow:
        0 0 40px rgba(239,68,68,0.55),
        0 0 80px rgba(239,68,68,0.25),
        inset 0 0 30px rgba(239,68,68,0.1);
}

.hallo-btn.alert-active:hover {
    box-shadow:
        0 0 60px rgba(239,68,68,0.75),
        0 0 100px rgba(239,68,68,0.4),
        inset 0 0 30px rgba(239,68,68,0.18);
}

/* Stan: SOS aktywny */
.hallo-btn.sos-active {
    background: radial-gradient(circle at 35% 35%, #dc2626, #991b1b 60%, #7f1d1d);
    border-color: rgba(239, 68, 68, 0.7);
    box-shadow:
        0 0 40px rgba(239,68,68,0.7),
        0 0 80px rgba(239,68,68,0.35),
        inset 0 0 30px rgba(239,68,68,0.15);
    animation: sos-btn-pulse 1.5s ease-in-out infinite;
}

.hallo-btn.sos-active:hover {
    box-shadow:
        0 0 60px rgba(239,68,68,0.9),
        0 0 110px rgba(239,68,68,0.5),
        inset 0 0 40px rgba(239,68,68,0.25);
}

@keyframes sos-btn-pulse {
    0%, 100% {
        box-shadow:
            0 0 40px rgba(239,68,68,0.7),
            0 0 80px rgba(239,68,68,0.35),
            inset 0 0 30px rgba(239,68,68,0.15);
    }
    50% {
        box-shadow:
            0 0 70px rgba(239,68,68,1),
            0 0 130px rgba(239,68,68,0.55),
            inset 0 0 50px rgba(239,68,68,0.3);
    }
}

/* Błysk po kliknięciu */
.hallo-btn.clicked-flash { animation: click-flash 0.4s ease-out; }

@keyframes click-flash {
    0%   { box-shadow: 0 0 40px rgba(139,92,246,0.6),  0 0 80px rgba(139,92,246,0.3),  inset 0 0 30px rgba(196,181,253,0.1); }
    50%  { box-shadow: 0 0 80px rgba(196,181,253,1),   0 0 160px rgba(139,92,246,0.8), inset 0 0 60px rgba(196,181,253,0.4); }
    100% { box-shadow: 0 0 40px rgba(74,222,128,0.5),  0 0 80px rgba(74,222,128,0.2),  inset 0 0 30px rgba(74,222,128,0.08); }
}

/* Ripple */
.ripple-container {
    position: absolute;
    width: 68.75%;
    height: 68.75%;
    border-radius: 50%;
    pointer-events: none;
    z-index: 3;
}

.ripple {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(196, 181, 253, 0.8);
    animation: ripple-out 1s ease-out forwards;
}

@keyframes ripple-out {
    from { transform: scale(1); opacity: 1; }
    to   { transform: scale(2.5); opacity: 0; }
}


/* ─────────────────────────────────────────
   15. SOS (dot + sekcja)
   ───────────────────────────────────────── */
.sos-section { flex-shrink: 0; }

.sos-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.sos-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: #dc3545;
    border: none;
    flex-shrink: 0;
    animation: sos-pulse 2s ease-in-out infinite;
    cursor: pointer;
    padding: 0;
}

@keyframes sos-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7); }
    50%       { box-shadow: 0 0 0 6px rgba(220, 53, 69, 0); }
}

.sos-text {
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
    user-select: none;
    white-space: nowrap;
}

.sos-trigger-btn:hover .sos-dot  { background-color: #ff4757; }
.sos-trigger-btn:hover .sos-text { color: #fff; }

.sos-cancel-hint {
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-err);
    line-height: 1.4;
}


/* ─────────────────────────────────────────
   16. STOPKA (index.php + strony legal)
   ───────────────────────────────────────── */
footer {
    position: relative;
    z-index: 1;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid var(--border);
    color: var(--muted);
    text-align: center;
    padding: 32px 24px;
    font-size: 0.85rem;
}

footer a          { color: var(--muted); text-decoration: none; }
footer a:hover    { color: var(--purple-pale); }


/* ─────────────────────────────────────────
   17. STRONY LEGAL (regulamin / polityka)
   ───────────────────────────────────────── */

/* Na tych stronach nav jest sticky, nie fixed */
nav.sticky-nav {
    position: sticky;
}

/* Back link (regulamin / polityka) */
.btn-back-nav {
    padding: 8px 18px;
    background: rgba(196, 181, 253, 0.1);
    border: 1px solid rgba(196, 181, 253, 0.25);
    border-radius: 8px;
    color: var(--purple-pale);
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: background .2s;
}

.btn-back-nav:hover { background: rgba(196, 181, 253, 0.2); text-decoration: none; }

/* Układ dokumentu */
.doc-page {
    max-width: 780px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

.doc-header {
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 28px;
}

.doc-header h1 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.doc-header p { color: var(--muted); font-size: 0.9rem; }

.doc-page section { margin-bottom: 32px; }

.doc-page h2 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--purple-pale);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.doc-page p  { color: var(--muted); font-size: 0.92rem; line-height: 1.75; margin-bottom: 10px; }
.doc-page ul { padding-left: 20px; margin: 8px 0 12px; }
.doc-page li { color: var(--muted); font-size: 0.92rem; line-height: 1.7; margin-bottom: 4px; }

.doc-page .warning-box {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.doc-page .warning-box p { color: rgba(255, 255, 255, 0.85); margin-bottom: 0; }


/* ─────────────────────────────────────────
   18. NARZĘDZIA / POMOCNICZE
   ───────────────────────────────────────── */
.note {
    margin-top: 16px;
    font-size: 0.78rem;
    color: var(--muted-dim);
    text-align: center;
    line-height: 1.5;
}

.login-link {
    text-align: center;
    margin-top: 20px;
    font-size: 0.88rem;
    color: var(--muted);
}

.login-link a { color: var(--purple-pale); font-weight: 600; text-decoration: none; }
.login-link a:hover { text-decoration: underline; }
