/* Powłoka aplikacji: górny pasek, menu konta i dolny pasek sekcji (telefon i tablet do 991 px).
   Prefiks app-, bez zmian w styles.css. */

:root {
    --app-header-height: 3.5rem;
    --app-tabbar-height: 3.75rem;
    --app-tabbar-total: calc(var(--app-tabbar-height) + env(safe-area-inset-bottom, 0px));
    --app-line: #e5eaf2;
    --app-muted: #64748b;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: #fff;
    border-bottom: 1px solid var(--app-line);
    padding-top: env(safe-area-inset-top, 0px);
}

.app-header__inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: var(--app-header-height);
}

.app-brand {
    display: inline-flex;
    align-items: center;
    color: var(--bs-primary);
    font-size: 1.15rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.app-topnav {
    flex: 1 1 auto;
    gap: 0.25rem;
    justify-content: flex-end;
}

.app-topnav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.75rem;
    border-radius: 0.6rem;
    color: #334155;
    font-weight: 500;
    text-decoration: none;
}

.app-topnav__link:hover,
.app-topnav__link:focus-visible {
    background: #f1f5fb;
    color: #0f172a;
}

.app-topnav__link.is-active {
    background: #e8f0ff;
    color: var(--bs-primary);
}

.app-icon {
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-account {
    margin-left: auto;
}

.app-account__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
}

.app-account__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #e8f0ff;
    color: var(--bs-primary);
    font-size: 0.85rem;
    font-weight: 700;
}

.app-account__button:focus-visible .app-account__avatar {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.app-account__menu {
    min-width: 15rem;
    padding: 0.9rem;
}

.app-account__name {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.app-account__email {
    color: var(--app-muted);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.app-main {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.app-tabbar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1030;
    display: flex;
    height: var(--app-tabbar-total);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--app-line);
    box-shadow: 0 -0.25rem 1rem rgba(15, 23, 42, 0.05);
}

.app-tabbar__link {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    min-width: 0;
    color: var(--app-muted);
    font-size: 0.72rem;
    font-weight: 500;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.app-tabbar__link.is-active {
    color: var(--bs-primary);
}

.app-tabbar__link.is-active .app-tabbar__icon {
    background: #e8f0ff;
}

.app-tabbar__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 1.9rem;
    border-radius: 1rem;
}

.app-tabbar__label {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-tabbar__badge {
    position: absolute;
    top: -0.2rem;
    right: 0.35rem;
    min-width: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 0.6rem;
    background: #f59e0b;
    color: #111827;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.15rem;
    text-align: center;
}

@media (max-width: 991.98px) {
    .has-tabbar .app-main {
        padding-bottom: calc(var(--app-tabbar-total) + 1.5rem);
    }

    .app-main {
        padding-top: 1rem;
    }

    /* Pola tekstowe co najmniej 16 px: iOS nie powiększa wtedy strony przy wpisywaniu. */
    .form-control,
    .form-select {
        font-size: max(1rem, 16px);
    }
}

/* Logowanie i zmiana hasła: przycisk pokazywania hasła o stałej szerokości (Pokaż / Ukryj). */
.auth-password-toggle {
    min-width: 5.5rem;
    font-size: 1rem;
}

@media (max-width: 575.98px) {
    .auth-card {
        margin-top: 0.5rem;
    }
}

/* Ekrany dotykowe (telefon, tablet): małe przyciski i przełączniki mają co najmniej ok. 40 px wysokości. */
@media (pointer: coarse) {
    .btn-sm {
        min-height: 2.5rem;
        padding-inline: 0.85rem;
    }

    .btn-sm:not(.w-100):not(.d-block) {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .form-check-input:not([role="switch"]) {
        width: 1.25em;
        height: 1.25em;
    }
}
