/* ==========================================================================
   BDW WebApp – layout shell (sidebar na desktopu, horní lišta + spodní navigace na mobilu)
   Barvy: BDW zelená zůstává, šedá #595f67 pro horní lištu a sidebar (kvůli logu).
   --bdw-green-fill / --bdw-green-ink jsou tmavší odstíny zelené, aby text na nich prošel kontrastem.
   ========================================================================== */

:root {
    --bdw-gray: #595f67;
    --bdw-green: #5fb201;
    --bdw-green-fill: #3e7a00;
    --bdw-green-ink: #2f6000;
    --bdw-green-tint: #e4f2d4;
    --bdw-bg: #f3f6f1;
    --bdw-border: #dde4d8;
    --bdw-ink: #1f2e2e;
    --bdw-muted: #4c5959;
    --bdw-danger: #b3200a;
    --bdw-display: 'Bricolage Grotesque', 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

.bdw-shell {
    min-height: 100vh;
    display: flex;
    background: var(--bdw-bg);
    color: var(--bdw-ink);
}

.bdw-frame {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* Rozmazané pozadí dialogu „Uložit do záložek“ (dříve v NavMenu) */
.my-custom-class {
    backdrop-filter: blur(10px);
}

/* --- Společné prvky ------------------------------------------------------ */

.bdw-shell a:focus-visible,
.bdw-shell button:focus-visible {
    outline: 2px solid var(--bdw-green-fill);
    outline-offset: 2px;
}

.bdw-sidebar a:focus-visible,
.bdw-sidebar button:focus-visible,
.bdw-appbar a:focus-visible,
.bdw-appbar button:focus-visible {
    outline-color: #ffffff;
}

.bdw-shell .mud-icon-root {
    flex-shrink: 0;
}

/* --- Sidebar (jen desktop) ---------------------------------------------- */

.bdw-sidebar {
    display: none;
}

.bdw-sidebar-logo {
    display: block;
    padding: 2px 12px 26px;
}

    .bdw-sidebar-logo img {
        height: 38px;
        width: auto;
        display: block;
    }

.bdw-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.bdw-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 44px;
    box-sizing: border-box;
    padding: 0 12px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    text-decoration: none;
    text-align: left;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

    .bdw-nav-item:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff;
    }

    .bdw-nav-item.active {
        background: #ffffff;
        color: var(--bdw-green-ink);
        font-weight: 700;
    }

.bdw-nav-item-label {
    flex-grow: 1;
}

/* Šipka u sbalovací skupiny menu */
.bdw-nav-chevron {
    flex: none;
    transition: transform 0.15s ease;
}

    .bdw-nav-chevron.is-open {
        transform: rotate(180deg);
    }

@media (prefers-reduced-motion: reduce) {
    .bdw-nav-chevron {
        transition: none;
    }
}

.bdw-nav-sub {
    margin: 0 0 4px 21px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.bdw-nav-subitem {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    box-sizing: border-box;
    padding: 0 12px;
    border-radius: 8px;
    color: #ffffff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

    .bdw-nav-subitem:hover {
        background: rgba(255, 255, 255, 0.12);
        color: #ffffff;
    }

    .bdw-nav-subitem.active {
        background: #ffffff;
        color: var(--bdw-green-ink);
        font-weight: 700;
    }

    .bdw-nav-subitem.is-disabled {
        color: rgba(255, 255, 255, 0.8);
        cursor: not-allowed;
    }

        .bdw-nav-subitem.is-disabled:hover {
            background: transparent;
            color: rgba(255, 255, 255, 0.8);
        }

.bdw-nav-badge {
    margin-left: auto;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--bdw-danger);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}

.bdw-nav-divider {
    height: 1px;
    margin: 8px 12px;
    background: rgba(255, 255, 255, 0.22);
}

.bdw-sidebar-spacer {
    flex-grow: 1;
}

.bdw-sidebar-user {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.bdw-user-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 6px;
}

.bdw-user-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdw-user-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bdw-user-name {
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bdw-user-role {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.88);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bdw-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 44px;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    background: transparent;
    color: #ffffff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

    .bdw-logout-btn:hover {
        background: rgba(255, 255, 255, 0.12);
    }

/* --- Horní lišta na mobilu ---------------------------------------------- */

.bdw-appbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    height: 56px;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 0 16px;
    background: var(--bdw-gray);
    color: #ffffff;
}

.bdw-appbar-logo {
    height: 30px;
    width: auto;
    display: block;
}

.bdw-appbar-spacer {
    flex-grow: 1;
}

.bdw-avatar-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.bdw-avatar-ring {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Horní lišta na desktopu -------------------------------------------- */

.bdw-topbar {
    display: none;
}

.bdw-topbar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    box-sizing: border-box;
    padding: 0 14px;
    border: 1px solid #c5cebf;
    border-radius: 10px;
    background: #ffffff;
    color: var(--bdw-ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

    .bdw-topbar-btn:hover {
        background: var(--bdw-bg);
    }

    .bdw-topbar-btn.is-primary {
        padding: 0 18px;
        border-color: var(--bdw-green-fill);
        background: var(--bdw-green-fill);
        color: #ffffff;
        font-weight: 700;
    }

        .bdw-topbar-btn.is-primary:hover {
            background: var(--bdw-green-ink);
        }

/* --- Obsah -------------------------------------------------------------- */

.bdw-content {
    flex: 1 0 auto;
    box-sizing: border-box;
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* Stránky s vlastní přilepenou lištou akcí (formulář úkolu) – bez místa pro spodní navigaci */
.bdw-content--no-nav {
    padding-bottom: 0;
}

/* --- Spodní navigace na mobilu ------------------------------------------ */

.bdw-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1100;
    height: calc(72px + env(safe-area-inset-bottom));
    box-sizing: border-box;
    display: flex;
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid var(--bdw-border);
}

.bdw-bn-item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--bdw-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.bdw-bn-pill {
    position: relative;
    width: 58px;
    height: 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdw-bn-badge {
    position: absolute;
    top: -2px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--bdw-danger);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
}

.bdw-bn-item.active {
    color: var(--bdw-green-ink);
    font-weight: 700;
}

    .bdw-bn-item.active .bdw-bn-pill {
        background: var(--bdw-green-tint);
    }

/* --- Spodní panel „Více“ na mobilu -------------------------------------- */

.bdw-sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 1250;
    padding: 0;
    border: 0;
    background: rgba(31, 46, 46, 0.55);
    cursor: default;
}

.bdw-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1251;
    max-height: 88vh;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    color: var(--bdw-ink);
    display: flex;
    flex-direction: column;
    animation: bdw-sheet-in 0.18s ease-out;
}

@keyframes bdw-sheet-in {
    from {
        transform: translateY(24px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.bdw-sheet-handle {
    align-self: center;
    width: 40px;
    height: 4px;
    margin-bottom: 14px;
    border-radius: 2px;
    background: #c5cebf;
}

.bdw-sheet-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 4px 14px;
}

.bdw-sheet-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bdw-green-fill);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bdw-sheet-user-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.bdw-sheet-user-name {
    font-size: 17px;
    font-weight: 700;
}

.bdw-sheet-user-role {
    font-size: 14px;
    color: var(--bdw-muted);
}

.bdw-sheet-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    min-height: 52px;
    box-sizing: border-box;
    padding: 0 4px;
    border: 0;
    border-top: 1px solid var(--bdw-border);
    background: transparent;
    color: var(--bdw-ink);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

    .bdw-sheet-item .mud-icon-root {
        color: var(--bdw-green-ink);
    }

    .bdw-sheet-item.is-danger {
        color: var(--bdw-danger);
        font-weight: 600;
    }

        .bdw-sheet-item.is-danger .mud-icon-root {
            color: var(--bdw-danger);
        }

.bdw-sheet-item-label {
    flex-grow: 1;
}

.bdw-sheet-item-meta {
    font-size: 14px;
    color: var(--bdw-muted);
}

.bdw-sheet-chip {
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bdw-green-tint);
    color: var(--bdw-green-ink);
    font-size: 13px;
    font-weight: 700;
}

.bdw-sheet-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    background: var(--bdw-danger);
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

/* --- Desktop ------------------------------------------------------------ */

@media (min-width: 960px) {
    .bdw-sidebar {
        display: flex;
        flex-direction: column;
        flex: 0 0 272px;
        width: 272px;
        height: 100vh;
        position: sticky;
        top: 0;
        box-sizing: border-box;
        padding: 22px 14px 16px;
        background: var(--bdw-gray);
        color: #ffffff;
        overflow-y: auto;
    }

    .bdw-appbar,
    .bdw-bottomnav,
    .bdw-sheet,
    .bdw-sheet-overlay {
        display: none;
    }

    .bdw-topbar {
        position: sticky;
        top: 0;
        z-index: 1000;
        height: 68px;
        flex-shrink: 0;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 12px;
        padding: 0 32px;
        background: #ffffff;
        border-bottom: 1px solid var(--bdw-border);
    }

    .bdw-content {
        padding-bottom: 0;
    }
}
