/* =========================================================
   Horní hlavní menu (PersonIS)
   Unified single-row navigace: logo + menu + pravá část.
   ========================================================= */

:root {
    --ph-header-height: 60px;
    --ph-font: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Wrapper hlavičky ---------- */
.ph-header {
    position: sticky;
    top: 0;
    z-index: 1031;
    background-color: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: var(--ph-font);
    height: var(--ph-header-height);
    overflow: visible;
}

/* ---------- Hlavní navigace (unified) ---------- */
.ph-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    min-height: var(--ph-header-height);
    gap: 1rem;
}

.ph-logo {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

.ph-logo img {
    height: 38px;
    object-fit: contain;
}

.ph-menu-wrapper {
    flex: 1;
    min-width: 0;
}

.ph-menu {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow: visible;
}

.ph-menu-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ph-menu-link:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.ph-menu-link.active {
    background-color: #eff6ff;
    color: #3b82f6;
}

.ph-menu-link .material-icons {
    font-size: 1.15rem;
    line-height: 1;
}

/* ---------- Pravá část navbaru ---------- */
.ph-nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.ph-utility-link {
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    border-radius: 0.375rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.ph-utility-link:hover {
    color: #3b82f6;
    background-color: #f1f5f9;
}

/* ---------- Uživatelské menu ---------- */
.ph-user {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    color: #334155;
    padding: 0.35rem 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.15s ease;
}

.ph-user:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.ph-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.3;
}

.ph-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

.ph-user-company {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 400;
}

.ph-user-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background-color: #f1f5f9;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.ph-user-chevron {
    font-size: 0.65rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
}

.ph-user[aria-expanded="true"] .ph-user-chevron {
    transform: rotate(180deg);
}

/* ---------- Dropdown – sekce přepínání organizace ---------- */
.ph-dropdown-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0.75rem 0.25rem;
    margin: 0;
}

/* ---------- Posun fixního levého (kontextového) menu pod hlavičku ---------- */
body.has-top-header .sidenav.fixed-start {
    margin: 0 !important;
    top: var(--ph-header-height);
    left: 0 !important;
    height: calc(100vh - var(--ph-header-height));
    border-radius: 0 !important;
    box-shadow: none !important;
    border-right: 1px solid #e5e7eb !important;
}

/* Když je horní menu, není potřeba duplicitní horní mezera v hlavním obsahu */
body.has-top-header .main-content {
    margin-top: 0;
}

/* ---------- Responzivita ---------- */
@media (max-width: 1399px) {
    .ph-user-info {
        display: none;
    }
}

@media (max-width: 575.98px) {
    .ph-nav {
        padding: 0 0.75rem;
    }
}

/* =========================================================
   Mobilní menu (hamburger + drawer)
   ========================================================= */

/* Hamburger – skrytý na desktopu, viditelný na mobilu */
.ph-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem 0.5rem;
    color: #475569;
    font-size: 1.25rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
}

.ph-hamburger:hover {
    background-color: #f1f5f9;
}

/* Desktop menu wrapper viditelný, mobilní drawer skrytý */
.ph-menu-wrapper,
.ph-nav-right > *:not(.ph-hamburger) {
    display: flex;
}

/* Overlay */
.ph-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1040;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.ph-mobile-overlay.is-open {
    display: block;
    opacity: 1;
}

/* Drawer */
.ph-mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 90vw;
    background: #ffffff;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
}

.ph-mobile-drawer.is-open {
    transform: translateX(0);
}

.ph-mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
    flex-shrink: 0;
}

.ph-mobile-drawer-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
}

.ph-mobile-drawer-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #64748b;
    font-size: 1.1rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
}

.ph-mobile-drawer-close:hover {
    background-color: #f1f5f9;
}

/* Navigační sekce uvnitř draweru */
.ph-mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0.75rem;
}

.ph-mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ph-mobile-nav-link:hover {
    background-color: #f1f5f9;
    color: #1e293b;
}

.ph-mobile-nav-link.active {
    background-color: #eff6ff;
    color: #3b82f6;
}

.ph-mobile-nav-link--danger {
    color: #ef4444;
}

.ph-mobile-nav-link--danger:hover {
    background-color: #fef2f2;
    color: #dc2626;
}

.ph-mobile-section {
    padding: 0.5rem 0.75rem;
    border-top: 1px solid #f1f5f9;
}

.ph-mobile-section-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.5rem 0.75rem 0.25rem;
    margin: 0;
}

/* Zamezit scrollování stránky při otevřeném menu */
body.ph-mobile-menu-open {
    overflow: hidden;
}

/* Breakpoint: přepnutí na mobilní layout */
@media (max-width: 1247px) {
    .ph-hamburger {
        display: flex;
        align-items: center;
    }

    .ph-menu-wrapper {
        display: none !important;
    }

    .ph-nav-right > *:not(.ph-hamburger) {
        display: none !important;
    }
}
