/* Page layout */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
}

.content {
    padding: 1.1rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 640.98px) {
    .content {
        padding: 1rem;
    }
}

/* Top navbar */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: 3.5rem;
    padding: 0 1.5rem;
    background-image: linear-gradient(90deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

.navbar-brand {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    margin-right: 2rem;
}

.navbar-brand:hover {
    color: white;
}

.top-navbar :focus-visible {
    outline: 2px solid white;
    outline-offset: 2px;
    border-radius: 4px;
}

/* Collapsible panel: holds both nav links and the auth links/user info.
   On desktop it's just an inline flex row; on mobile it becomes a dropdown. */
.navbar-collapse {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.25rem;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.nav-link {
    color: #d7d7d7;
    background: none;
    border: none;
    border-radius: 4px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    text-decoration: none;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.37);
    color: white;
}

.nav-lang-switch {
    display: flex;
    gap: 0.25rem;
}

.nav-lang-link {
    color: #d7d7d7;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: 4px;
}

.nav-lang-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-lang-active {
    background-color: rgba(255, 255, 255, 0.37);
    color: white;
}

/* Nav icons */
.bi {
    display: inline-block;
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    top: -1px;
    background-size: cover;
}

.bi-house-door-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
}

.bi-plus-square-fill-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
}

.bi-list-nested-nav-menu {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
}

/* Mobile hamburger toggle (CSS-only: no JS/SignalR dependency, so it
   also works on statically-rendered pages like Login/Home/Error). */
.navbar-toggler-checkbox {
    display: none;
}

.navbar-toggler-label {
    display: none;
    order: 1;
    margin-left: auto;
    padding: 0.5rem;
    cursor: pointer;
}

.navbar-toggler-icon {
    position: relative;
    display: block;
    width: 1.375rem;
    height: 2px;
    background: white;
    transition: transform 0.2s ease;
}

.navbar-toggler-icon::before,
.navbar-toggler-icon::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: white;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.navbar-toggler-icon::before {
    top: -0.4375rem;
}

.navbar-toggler-icon::after {
    top: 0.4375rem;
}

/* Hamburger -> X when open */
.navbar-toggler-checkbox:checked ~ .navbar-toggler-label .navbar-toggler-icon {
    background: transparent;
}

.navbar-toggler-checkbox:checked ~ .navbar-toggler-label .navbar-toggler-icon::before {
    top: 0;
    transform: rotate(45deg);
}

.navbar-toggler-checkbox:checked ~ .navbar-toggler-label .navbar-toggler-icon::after {
    top: 0;
    transform: rotate(-45deg);
}

/* Click-outside-to-close: a full-screen label tied to the same checkbox,
   invisible and non-interactive until the menu is open. */
.navbar-backdrop {
    display: none;
}

@media (max-width: 640.98px) {
    .navbar-toggler-label {
        display: block;
    }

    .navbar-collapse {
        position: absolute;
        top: 3.5rem;
        left: 0;
        right: 0;
        z-index: 100;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        background: rgb(20, 20, 35);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
        transition: max-height 0.2s ease;
    }

    .navbar-toggler-checkbox:checked ~ .navbar-collapse {
        max-height: calc(100vh - 3.5rem);
        overflow-y: auto;
    }

    .nav-links,
    .nav-auth {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin-left: 0;
        gap: 0;
        padding: 0.5rem 1rem;
    }

    .nav-auth {
        border-top: 1px solid rgba(255, 255, 255, 0.15);
    }

    .nav-link {
        width: 100%;
        padding: 0.75rem 0.5rem;
        border-radius: 0;
    }

    .nav-username {
        padding: 0.75rem 0.5rem;
    }

    .navbar-toggler-checkbox:checked ~ .navbar-backdrop {
        display: block;
        position: fixed;
        inset: 3.5rem 0 0 0;
        z-index: 99;
        background: rgba(0, 0, 0, 0.35);
        cursor: default;
    }
}

/* Blazor error UI */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
