/* ==========================================================================
   Základní layout aplikace (horní lišta, postranní menu, spodní navigace, panel „Více“).
   Přepnutí mobil / desktop je čistě v CSS na hranici 960 px (= MudBlazor Breakpoint.Md),
   aby nic neblikalo při prvním vykreslení a shodovalo se to s MudDrawer a JenProDesktop.
   Načítá se až za MudBlazor.min.css, aby přepisy vyhrávaly při stejné specificitě.
   ========================================================================== */

:root {
    --hd-blue: #191FB9;
    --hd-blue-tint: #E9EAFB;
    --hd-ground: #F3F4FA;
    --hd-ink: #14163A;
    --hd-muted: #5A5D80;
    --hd-line: #E1E3F0;
    --hd-badge: #C9260B;
    --hd-danger: #B3200A;
    --hd-font-display: 'Barlow Condensed', 'Figtree', Roboto, Helvetica, Arial, sans-serif;
}

/* --- Přepínání mobil / desktop ------------------------------------------- */
.hd-appbar-desktop { display: none; }

@media (min-width: 960px) {
    .hd-appbar-mobile { display: none !important; }
    .hd-appbar-desktop { display: flex; }
}

/* --- Horní lišta ---------------------------------------------------------- */
.hd-layout .hd-appbar {
    background: var(--hd-blue);
    color: #ffffff;
    box-shadow: none;
}

.hd-layout .hd-appbar .mud-toolbar {
    min-height: 56px;
    height: 56px;
    padding: 0 8px 0 16px;
    gap: 12px;
}

.hd-layout .mud-main-content {
    padding-top: 56px;
}

.hd-appbar-mobile,
.hd-appbar-host {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    min-width: 0;
}

.hd-brand-logo {
    height: 34px;
    width: auto;
    display: block;
}

.hd-brand-title {
    flex-grow: 1;
    min-width: 0;
    font-family: var(--hd-font-display);
    font-weight: 700;
    font-size: 27px;
    line-height: 1;
    letter-spacing: 0.01em;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
}

.hd-avatar-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.hd-avatar {
    width: 36px;
    height: 36px;
    box-sizing: border-box;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-appbar-host .mud-icon-button { color: #ffffff; }

@media (min-width: 960px) {
    .hd-layout .hd-appbar {
        background: #ffffff;
        color: var(--hd-ink);
        border-bottom: 1px solid var(--hd-line);
    }

    .hd-layout .hd-appbar .mud-toolbar {
        min-height: 68px;
        height: 68px;
        padding: 0 32px;
    }

    .hd-layout .mud-main-content { padding-top: 68px; }

    /* Nepřihlášený host nemá postranní menu, takže lišta zůstává modrá i s logem. */
    .hd-layout .hd-appbar.hd-appbar--host {
        background: var(--hd-blue);
        color: #ffffff;
        border-bottom: 0;
    }

    .hd-layout .hd-appbar.hd-appbar--host .mud-toolbar { padding: 0 16px; }
}

.hd-appbar-desktop {
    align-items: center;
    gap: 12px;
    flex-grow: 1;
    min-width: 0;
}

.hd-page-title {
    flex-grow: 1;
    min-width: 0;
    font-family: var(--hd-font-display);
    font-weight: 700;
    font-size: 32px;
    line-height: 1;
    letter-spacing: 0.01em;
    color: var(--hd-ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hd-layout .hd-topbtn.mud-button-root {
    height: 42px;
    padding: 0 18px;
    border-radius: 10px;
    text-transform: none;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: normal;
    box-shadow: none;
}

.hd-layout .hd-topbtn.mud-button-outlined {
    padding: 0 14px;
    border-color: #C9CBE3;
    color: var(--hd-ink);
    font-weight: 600;
}

/* --- Obsah ---------------------------------------------------------------- */
.hd-layout .hd-content.mud-container {
    padding: 14px 16px 24px;
}

@media (min-width: 960px) {
    .hd-layout .hd-content.mud-container { padding: 28px 32px 32px; }
}

/* Na mobilu místo pro spodní navigaci. Proměnná --hd-bottomnav-height je k dispozici i stránkám
   (např. přilepená lišta na nástěnce), aby se nedostaly pod spodní navigaci. */
@media (max-width: 959.98px) {
    .hd-layout .mud-main-content.hd-main--nav {
        --hd-bottomnav-height: calc(72px + env(safe-area-inset-bottom));
        padding-bottom: var(--hd-bottomnav-height);
    }

    /* Tlačítko „Instalovat aplikaci“ (app.css) by jinak překrylo záložku Více. */
    .pwa-install-button {
        bottom: calc(72px + env(safe-area-inset-bottom) + 1rem);
    }
}

/* --- Postranní menu ------------------------------------------------------- */
.hd-layout .hd-drawer {
    background: var(--hd-blue);
    color: #ffffff;
    border: 0;
    box-shadow: none;
}

.hd-drawer-inner {
    height: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    padding: 20px 14px 16px;
}

.hd-drawer-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
}

.hd-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 24px;
    color: #ffffff;
    text-decoration: none;
    flex-shrink: 0;
}

.hd-brand-logo--drawer { height: 42px; }

.hd-brand-name {
    font-family: var(--hd-font-display);
    font-weight: 700;
    font-size: 29px;
    line-height: 1;
    letter-spacing: 0.01em;
}

.hd-layout .hd-drawer .mud-navmenu {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-item,
.hd-layout .hd-drawer .mud-navmenu .mud-nav-group {
    width: 100%;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link {
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
    margin: 0;
    padding: 0 12px !important;
    border-radius: 10px;
    border-inline-end: 0 !important;
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 600;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link .mud-nav-link-text {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: inherit;
    font-weight: inherit;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link .mud-nav-link-icon {
    margin: 0;
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: inherit;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    background: rgba(255, 255, 255, 0.12);
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link.mud-nav-link-disabled {
    color: rgba(255, 255, 255, 0.5);
    opacity: 1;
}

/* Aktivní položka = bílá „pilulka“ s modrým textem. */
.hd-layout .hd-drawer .hd-nav.mud-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled),
.hd-layout .hd-drawer .hd-nav.mud-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled):hover:not(.mud-nav-link-disabled) {
    background: #ffffff !important;
    color: var(--hd-blue) !important;
    font-weight: 700;
}

.hd-layout .hd-drawer .hd-nav.mud-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled) .mud-nav-link-icon {
    color: var(--hd-blue) !important;
}

/* Chevron skupiny: vpravo zavřeno, dolů rozbaleno. */
.hd-layout .hd-drawer .mud-navmenu .mud-nav-link-expand-icon {
    margin: 0;
    width: 18px;
    height: 18px;
    fill: currentColor !important;
    color: inherit;
    transform: none !important;
}

.hd-layout .hd-drawer .mud-navmenu .mud-nav-link-expand-icon.mud-transform {
    transform: rotate(90deg) !important;
}

/* Podpoložky skupiny: odsazené, se svislou vodicí čárou. */
.hd-layout .hd-drawer .hd-nav .mud-nav-group .mud-navmenu {
    gap: 2px;
    margin: 0 0 4px 21px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.hd-layout .hd-drawer .hd-nav .mud-nav-group .mud-navmenu .mud-nav-link {
    height: 38px;
    min-height: 38px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.hd-layout .hd-drawer .hd-nav .mud-divider {
    margin: 6px 0;
    border-color: rgba(255, 255, 255, 0.2);
}

.hd-nav-badge {
    min-width: 22px;
    height: 22px;
    box-sizing: border-box;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--hd-badge);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
}

/* --- Uživatel dole v postranním menu ------------------------------------- */
.hd-user {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding: 14px 6px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
}

.hd-user .hd-avatar { width: 40px; height: 40px; flex-shrink: 0; }

.hd-user-text {
    flex-grow: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hd-user-name {
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-user-role {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.85);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hd-user .mud-icon-button { color: #ffffff; }

/* --- Spodní navigace (mobil) --------------------------------------------- */
.hd-bottomnav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    box-sizing: border-box;
    height: calc(72px + env(safe-area-inset-bottom));
    display: flex;
    padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
    background: #ffffff;
    border-top: 1px solid var(--hd-line);
}

.hd-tab {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--hd-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.hd-tab-icon {
    position: relative;
    width: 58px;
    height: 32px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-tab-icon .mud-icon-root {
    width: 22px;
    height: 22px;
    font-size: 22px;
}

.hd-tab--active {
    color: var(--hd-blue);
    font-weight: 700;
}

.hd-tab--active .hd-tab-icon { background: var(--hd-blue-tint); }

.hd-tab-badge {
    position: absolute;
    top: -3px;
    right: 6px;
    min-width: 18px;
    height: 18px;
    box-sizing: border-box;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--hd-badge);
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

@media (min-width: 960px) {
    .hd-bottomnav { display: none; }
}

/* --- Panel „Více“ (mobil) ------------------------------------------------ */
.hd-scrim {
    position: fixed;
    inset: 0;
    z-index: 1300;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(20, 22, 58, 0.52);
    cursor: default;
}

.hd-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1301;
    box-sizing: border-box;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: #ffffff;
    color: var(--hd-ink);
    animation: hd-sheet-in 0.22s ease-out;
}

@keyframes hd-sheet-in {
    from { transform: translateY(100%); }
}

@media (prefers-reduced-motion: reduce) {
    .hd-sheet { animation: none; }
}

@media (min-width: 960px) {
    .hd-scrim,
    .hd-sheet { display: none; }
}

.hd-sheet-handle {
    align-self: center;
    width: 40px;
    height: 4px;
    margin-bottom: 14px;
    border-radius: 2px;
    background: #C4C6DE;
    flex-shrink: 0;
}

.hd-sheet-user {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 4px 14px;
}

.hd-sheet-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--hd-blue);
    color: #ffffff;
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-sheet-name {
    font-size: 17px;
    font-weight: 700;
}

.hd-sheet-role {
    font-size: 14px;
    color: var(--hd-muted);
}

.hd-sheet-item {
    width: 100%;
    box-sizing: border-box;
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 4px;
    border: 0;
    border-top: 1px solid var(--hd-line);
    background: transparent;
    color: var(--hd-ink);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.hd-sheet-item .mud-icon-root {
    width: 22px;
    height: 22px;
    color: var(--hd-blue);
}

.hd-sheet-item--danger {
    color: var(--hd-danger);
    font-weight: 600;
}

.hd-sheet-item--danger .mud-icon-root { color: currentColor; }

.hd-sheet-info {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 8px 0 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--hd-ground);
    color: #3A3D63;
    font-size: 14px;
    line-height: 1.4;
}

.hd-sheet-info .mud-icon-root {
    flex-shrink: 0;
    color: var(--hd-blue);
}

.hd-sheet form { margin: 0; }
