/* Login page: two-column card with three CSS-only tabs (patient, doctor,
   partner); the lab login (/login/lab-staff) is a single form, no tabs. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(135deg, #eef2ff 0%, #f3f4f6 100%);
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    color: #111827;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.page-title {
    text-align: center;
    padding: 2.25rem 1rem 1rem;
    /* Shift the heading visually downward without changing its
       layout-claimed space, so the centered login card stays put. */
    transform: translateY(5rem);
    font-size: 1.875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    color: #1e3a8a;
    font-feature-settings: "ss01" on, "cv11" on;
}
.page-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.page-footer {
    text-align: center;
    padding: 1.25rem 1rem calc(1.25rem + env(safe-area-inset-bottom, 0));
    font-size: 0.8125rem;
    color: #4b5563; /* 6.76:1 on the background */
    line-height: 1.55;
}
/* "Помощ · Достъпност · Контакти" above the copyright; "Нисет ООД" links to niset.bg. */
.page-footer .footer-links { margin-bottom: 0.375rem; }
.page-footer a { color: #1e40af; }
/* "(отваря се в нов раздел)" after that link — for screen readers only (as in app.css). */
.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;
}
@media (max-width: 600px) {
    .page-title { font-size: 1.5rem; padding-top: 1.25rem; letter-spacing: 0.04em; transform: translateY(3rem); }
    .page-footer { font-size: 0.75rem; padding: 1rem 0.75rem; }
}
/* On short viewports the visually-shifted heading would overlap
   with the centered login card. Drop the translate to keep them
   apart. The card stays centered in the remaining space.
   In em, not px (WCAG 1.4.4): a media query's em follows the
   browser's font size, so with a larger font (taller heading and card) the
   translate is dropped on taller screens too. 47.5em / 35em = the former
   760px / 560px at the default 16px — unchanged with default settings. */
@media (max-height: 47.5em) {
    .page-title { transform: none; padding-top: 1rem; padding-bottom: 0.75rem; }
}
@media (max-height: 35em) {
    .page-title { padding-top: 0.5rem; padding-bottom: 0.5rem; font-size: 1.375rem; }
}

/* The 2-column card */
.login-card {
    background: white;
    border-radius: 14px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05), 0 20px 40px -8px rgba(30,64,175,0.12);
    display: grid;
    /* rem: the tab column and the card grow with the browser's font size
       (15rem / 45rem = 240px / 720px at 16px). */
    grid-template-columns: 15rem 1fr;
    width: 100%;
    max-width: 45rem;
    min-height: 420px;
    overflow: hidden;
}

/* Hidden radios drive tab state */
.tab-radio { position: absolute; opacity: 0; pointer-events: none; }

/* Left column — tabs. The container is intentionally a darker
   gray than any active-tab background so the active tab pops out
   visibly against it. */
.tabs {
    background: #e5e7eb;
    border-right: 1px solid #d1d5db;
    padding: 1.5rem 0 0.5rem;
    display: flex;
    flex-direction: column;
}
.tabs .brand {
    padding: 0 1.25rem 1.25rem;
    font-weight: 700; font-size: 1.0625rem; color: #1e40af;
    letter-spacing: 0.01em;
}
.tabs label {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    font-size: 0.9375rem;
    color: #4b5563;
    border-left: 3px solid transparent;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    user-select: none;
}
.tabs label:hover { background: #d1d5db; color: #111827; }
.tabs label .icon {
    width: 1.25rem; height: 1.25rem; flex-shrink: 0;
    color: #9ca3af;
}

/* Language switcher pinned at the bottom of the tab column. */
.tabs .lang-switch {
    margin-top: auto;
    padding: 1.25rem 1.25rem 1rem;
    border-top: none;
    position: relative;
    display: flex; align-items: center; gap: 0.375rem;
    font-size: 0.8125rem;
    color: #4b5563;
}
.tabs .lang-switch::before {
    content: '';
    position: absolute;
    top: 0.25rem;
    left: 1.25rem;
    right: 1.25rem;
    border-top: 1px solid #d1d5db;
}
.tabs .lang-switch-label { color: #4b5563; margin-right: 0.25rem; } /* 6.10:1 on the tab column */
.tabs .lang-switch form { display: inline; margin: 0; }
.tabs .lang-switch button {
    background: transparent; border: 0; padding: 0.125rem 0.375rem;
    color: #4b5563; cursor: pointer; font: inherit; font-size: 0.8125rem;
    border-radius: 4px;
}
.tabs .lang-switch button:hover { color: #1e40af; background: #d1d5db; }
.tabs .lang-switch button.active {
    color: #1e40af; font-weight: 700; cursor: default;
}
.tabs .lang-switch-sep { color: #9ca3af; }

/* Right column — forms */
.panels {
    padding: 2rem 2rem;
    position: relative;
}
.panel { display: none; }
.panel h1 {
    margin: 0 0 0.375rem;
    font-size: 1.375rem;
    color: #111827;
}
.panel p.subtitle {
    margin: 0 0 1.5rem;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Form fields */
.field { margin-bottom: 1rem; }
.field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.375rem;
}
.field input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-size: 1rem;
    font-family: inherit; /* explicit so password fields don't fall back to a tighter UA default */
    letter-spacing: 0.04em; /* tiny breathing room between glyphs without looking spaced-out */
    border: 1px solid #8a8f98; /* 3.25:1 on white — WCAG 1.4.11 */
    border-radius: 8px;
    outline: none;
    transition: border-color 0.12s, box-shadow 0.12s;
    background: white;
}
.field input::placeholder { color: #6b7280; opacity: 1; } /* Firefox fades it to ~3.9:1 */
.field input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
/* Windows contrast themes replace the border colour and drop the shadow, so
   the focused field gets a real outline there (WCAG 2.4.7). Normal
   mode is unchanged. */
@media (forced-colors: active) {
    .field input:focus { outline: 2px solid Highlight; outline-offset: 2px; }
}
button.submit {
    width: 100%;
    padding: 0.6875rem 1rem;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.12s;
}
button.submit:hover { background: #1d4ed8; }
button.submit:active { background: #1e40af; }

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

/* Still logged in (26.11.2026): instead of the forms — who, "Към резултатите"
   (as the login button), "Изход" (outlined). One under the other on a narrow card. */
.signed-in-panel h1 { margin: 0 0 0.375rem; font-size: 1.375rem; color: #111827; }
.signed-in-panel .who { margin: 0 0 1.5rem; color: #374151; font-size: 0.9375rem; }
.signed-in-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.signed-in-actions a.to-results,
.signed-in-actions button {
    flex: 1 1 10rem;
    padding: 0.6875rem 1rem; border-radius: 8px;
    font: inherit; font-size: 0.9375rem; font-weight: 600; text-align: center;
    cursor: pointer;
}
.signed-in-actions a.to-results { background: #2563eb; color: white; text-decoration: none; border: 1px solid #2563eb; }
.signed-in-actions a.to-results:hover { background: #1d4ed8; }
.signed-in-actions form { display: flex; flex: 1 1 10rem; margin: 0; }
.signed-in-actions button { background: white; color: #1e40af; border: 1px solid #1e40af; }
.signed-in-actions button:hover { background: #eff6ff; }
.signed-in-actions a.to-results:focus-visible,
.signed-in-actions button:focus-visible { outline: 2px solid #2563eb; outline-offset: 2px; }

/* "Forgotten password?" under the doctor and partner forms */
.panel p.forgot { margin: 1rem 0 0; font-size: 0.8125rem; text-align: center; }
.panel p.forgot a { color: #1e40af; }

/* Embedded in a partner's website (legacy logopic, App\Http\Embed):
   no big heading, less space around the card and the footer. */
body.embed .page-main { padding: 0.75rem; }
body.embed .page-footer { padding: 0.5rem 0.75rem; font-size: 0.75rem; }

/* One role only: no tab column, the language switcher under the form. */
.login-card.single { grid-template-columns: 1fr; max-width: 28.75rem; /* 460px at 16px */ min-height: 0; }
.card-lang {
    margin-top: 1.5rem; padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}
.card-lang .lang-switch {
    display: flex; align-items: center; justify-content: center; gap: 0.375rem;
    font-size: 0.8125rem; color: #4b5563;
}
.card-lang .lang-switch-label { color: #6b7280; margin-right: 0.25rem; }
.card-lang .lang-switch form { display: inline; margin: 0; }
.card-lang .lang-switch button {
    background: transparent; border: 0; padding: 0.125rem 0.375rem;
    color: #4b5563; cursor: pointer; font: inherit; font-size: 0.8125rem;
    border-radius: 4px;
}
.card-lang .lang-switch button:hover { color: #1e40af; background: #f3f4f6; }
.card-lang .lang-switch button.active { color: #1e40af; font-weight: 700; cursor: default; }
.card-lang .lang-switch-sep { color: #9ca3af; }

/* CSS-only tab switching */
#tab-radio-patient:checked ~ .login-card .tabs label[for="tab-radio-patient"],
#tab-radio-doctor:checked  ~ .login-card .tabs label[for="tab-radio-doctor"],
#tab-radio-partner:checked ~ .login-card .tabs label[for="tab-radio-partner"] {
    background: white;
    color: #1e40af;
    font-weight: 600;
    border-left-color: #2563eb;
}
#tab-radio-patient:checked ~ .login-card .tabs label[for="tab-radio-patient"] .icon,
#tab-radio-doctor:checked  ~ .login-card .tabs label[for="tab-radio-doctor"] .icon,
#tab-radio-partner:checked ~ .login-card .tabs label[for="tab-radio-partner"] .icon {
    color: #2563eb;
}
/* The radios are invisible, so keyboard focus is shown on their tab (WCAG
   2.4.7) — only with the keyboard (:focus-visible), as the SMS / e-mail choice. */
#tab-radio-patient:focus-visible ~ .login-card .tabs label[for="tab-radio-patient"],
#tab-radio-doctor:focus-visible  ~ .login-card .tabs label[for="tab-radio-doctor"],
#tab-radio-partner:focus-visible ~ .login-card .tabs label[for="tab-radio-partner"] {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
}
#tab-radio-patient:checked ~ .login-card .panels .panel-patient,
#tab-radio-doctor:checked  ~ .login-card .panels .panel-doctor,
#tab-radio-partner:checked ~ .login-card .panels .panel-partner,
/* The lab form is the only one on its page (no tab). */
.login-card .panels .panel-lab {
    display: block;
}

/* Mobile: stack tabs above form as one row of three so all are
   visible without horizontal scrolling. The labels wrap to two
   lines if they really don't fit. */
@media (max-width: 600px) {
    .login-card {
        grid-template-columns: 1fr;
        min-height: 0;
    }
    .tabs {
        /* override the desktop "flex column" layout entirely */
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-auto-flow: row;
        border-right: 0;
        border-bottom: 1px solid #d1d5db;
        padding: 0;
        gap: 0;
        overflow: visible;
    }
    .tabs .brand { display: none; }
    .tabs label {
        padding: 0.625rem 0.5rem;
        font-size: 0.8125rem;
        line-height: 1.2;
        text-align: center;
        justify-content: center;
        border-left: 0;
        border-right: 1px solid #d1d5db;
        /* one row: the .tabs container already has its own border-bottom */
        border-bottom: 0;
        /* allow wrapping rather than scrolling/cropping on tiny screens */
        white-space: normal;
        word-break: break-word;
        min-height: 3rem;
    }
    /* No right-border on the rightmost column */
    .tabs label:nth-of-type(3n) { border-right: 0; }
    .tabs label .icon { display: none; }

    /* Active-tab styling on mobile: background tint + bold + a blue line
       at the bottom instead of the left accent (the tint alone is 1.1:1). */
    #tab-radio-patient:checked ~ .login-card .tabs label[for="tab-radio-patient"],
    #tab-radio-doctor:checked  ~ .login-card .tabs label[for="tab-radio-doctor"],
    #tab-radio-partner:checked ~ .login-card .tabs label[for="tab-radio-partner"] {
        background: #eef2ff;
        color: #1e40af;
        font-weight: 600;
        border-left: 0;
        box-shadow: inset 0 -3px 0 #1e40af;
    }

    .panels { padding: 1.5rem 1.25rem; }

    /* On mobile the tabs are one row; let the language switcher
       span the full width below them. */
    .tabs .lang-switch {
        grid-column: 1 / -1;
        padding: 0.5rem 0.875rem;
        justify-content: center;
        border-top: 1px solid #d1d5db;
    }
}
@media (max-width: 360px) {
    .tabs label {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
        min-height: 2.75rem;
    }
}
/* A large browser font on a phone: three tabs side by side do not
   fit and "партньори" broke mid-word — the tabs go one under another. In em:
   19.9375em = 319px at the default 16px, so with default settings this never
   applies (the smallest supported screen is 320px); at 24px it is 478px. */
@media (max-width: 19.9375em) {
    .tabs { grid-template-columns: 1fr; }
    .tabs label {
        border-right: 0;
        border-bottom: 1px solid #d1d5db;
        word-break: normal;
        min-height: 0;
    }
    /* the language switcher below has its own top border */
    .tabs label:nth-of-type(3) { border-bottom: 0; }
}
