/* Staff layout (doctor, lab staff, partner): topbar + content area. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f3f4f6;
    margin: 0;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Topbar — same dark-navy style as the patient portal ===== */
.nav {
    position: sticky; top: 0; z-index: 10;
    background: #1e3a8a;
    color: white;
    padding: env(safe-area-inset-top, 0) 0 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}
.nav-inner {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    padding: 0.625rem 1.25rem;
    min-height: 3.25rem;
    max-width: 1536px;
    margin: 0 auto;
}
.nav-left {
    display: flex; align-items: center; gap: 1.25rem;
    min-width: 0;
}
.nav .brand {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: 0.05em;
    color: white;
    text-decoration: none;
    white-space: nowrap;
}
.nav .user-block {
    display: flex; align-items: center; gap: 1rem;
    font-size: 0.9375rem;
}
.nav .user-block .who {
    color: rgba(255,255,255,0.92);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 26rem;
}
.nav .user-block .who strong { color: white; font-weight: 600; }
.nav form { display: inline; margin: 0; }
.nav button.logout {
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    white-space: nowrap;
}
.nav button.logout:hover  { background: rgba(255,255,255,0.1); border-color: white; }
.nav button.logout:active { background: rgba(255,255,255,0.2); }

/* "Настройки" next to "Изход" (confirmed doctor / partner): the same look,
   a gear before the text; on the settings pages it stays highlighted. */
.nav a.settings-link {
    display: inline-flex; align-items: center; gap: 0.375rem;
    color: white; text-decoration: none;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.8125rem;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.nav a.settings-link .icon { flex: none; }
.nav a.settings-link:hover { background: rgba(255,255,255,0.1); border-color: white; }
.nav a.settings-link[aria-current] { background: rgba(255,255,255,0.2); border-color: white; }
.nav a.settings-link:focus-visible,
.nav button.logout:focus-visible { outline: 2px solid white; outline-offset: 2px; }
/* Windows contrast themes drop the background: the current page is marked
   by a thicker frame instead (as the focus). */
@media (forced-colors: active) {
    .nav a.settings-link[aria-current] { outline: 2px solid LinkText; outline-offset: 1px; }
}

/* Language switcher — sits to the right of the brand, like patient portal. */
.nav .lang-switch {
    display: inline-flex; align-items: center; gap: 0.25rem;
    font-size: 0.8125rem;
    color: rgba(255,255,255,0.85);
}
.nav .lang-switch form { display: inline; margin: 0; }
.nav .lang-switch button {
    background: transparent; border: 0; padding: 0.25rem 0.5rem;
    color: rgba(255,255,255,0.85); cursor: pointer; font: inherit; font-size: 0.8125rem;
    border-radius: 4px;
}
.nav .lang-switch button:hover { background: rgba(255,255,255,0.12); color: white; }
.nav .lang-switch button.active { color: white; font-weight: 700; cursor: default; }
.nav .lang-switch-sep { color: rgba(255,255,255,0.45); }

/* ===== Main ===== */
main {
    padding: 1.25rem 1.5rem;
    max-width: 1536px;
    margin: 0 auto;
}
.card {
    background: white; border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 1.5rem; margin-bottom: 1rem;
}
h1 { margin-top: 0; }
h2 { margin-top: 0; font-size: 1.125rem; color: #374151; }

/* Text for screen readers only, e.g. the h1 of the list and the report. */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
/* "Към съдържанието": the first link of the page, shown only when it gets the
   keyboard focus; jumps past the top bar (WCAG 2.4.1). */
.skip-link {
    position: absolute; left: 0.5rem; top: -10rem; z-index: 100;
    background: white; color: #1e3a8a; font-weight: 600; text-decoration: none;
    padding: 0.5rem 0.875rem; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.skip-link:focus { top: 0.5rem; outline: 3px solid #f59e0b; outline-offset: 2px; }

/* A table wider than a narrow screen / iframe scrolls alone, not the whole
   page (WCAG 1.4.10). */
.table-scroll { overflow-x: auto; }

.error {
    background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
    padding: 0.625rem 0.875rem; border-radius: 8px; margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

/* ===== Mobile topbar tweaks ===== */
@media (max-width: 720px) {
    .nav-inner {
        flex-wrap: wrap;
        padding: 0.5rem 0.875rem;
        gap: 0.5rem 0.75rem;
    }
    .nav-left { gap: 0.625rem; flex-wrap: wrap; }
    .nav .brand {
        font-size: 0.9375rem;
        letter-spacing: 0.04em;
    }
    .nav .user-block {
        font-size: 0.8125rem;
        gap: 0.625rem;
        margin-left: auto;
    }
    .nav .user-block .who {
        max-width: 50vw;
        font-size: 0.8125rem;
    }
    .nav button.logout,
    .nav a.settings-link {
        padding: 0.3rem 0.625rem;
        font-size: 0.75rem;
    }
    main { padding: 1rem 0.875rem; }
}
/* Very narrow screens: the gear alone; the text stays for screen readers. */
@media (max-width: 420px) {
    .nav a.settings-link .label {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
    }
}
