/* portal.css - patient account area, sign up steps and the code boxes */

/* 1. Layout: search bar on top, sidebar left, page right */

.portal {
    background: var(--page-bg);
}
/* white strip with the search, lined up with the page column */
.portal-topbar {
    border-bottom: 1px solid var(--border);
    background: var(--white);
}
.portal-topbar-inner {
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1rem 16px;
}
.portal-search {
    position: relative;
    flex: 1;
    margin-left: auto;
}
.portal-search > .icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: var(--navy-dark);
    pointer-events: none;
}
.portal-search input {
    width: 100%;
    min-height: 52px;
    padding: 0 1rem 0 2.75rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #ECEEF2;
    font-size: 1rem;
}
.portal-search input:focus {
    border-color: var(--navy);
    background: var(--white);
    outline: none;
}
.portal-search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 20;
    margin: 0;
    padding: 0.375rem;
    list-style: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--white);
    box-shadow: var(--shadow);
}
.portal-search-results a {
    display: block;
    padding: 0.625rem 0.75rem;
    border-radius: 4px;
    color: var(--navy);
    text-decoration: none;
}
.portal-search-results a:hover,
.portal-search-results a:focus {
    background: var(--sky-light);
    outline: none;
}
.portal-search-results span {
    display: block;
    color: var(--text);
    font-size: 0.8125rem;
}
.portal-calendar {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #ECEEF2;
    color: var(--navy);
}
.portal-calendar:hover {
    background: var(--sky-light);
}
.portal-calendar .icon {
    width: 20px;
    height: 20px;
}

.portal-layout {
    display: grid;
    gap: 1.5rem;
    max-width: 1600px;
    margin: 0 auto;
    padding: 1.5rem 16px 4rem;
}
.portal-main {
    min-width: 0;
}

/* sidebar */
.portal-side {
    min-width: 0;
}
.portal-person {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}
.portal-avatar {
    display: grid;
    flex: none;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #D9DEE5;
    color: var(--navy);
    font-size: 1.25rem;
    font-weight: 700;
}
/* long names wrap instead of pushing the page wider than a phone */
.portal-person > div {
    min-width: 0;
}
.portal-person strong {
    overflow-wrap: anywhere;
    display: block;
    color: var(--navy-dark);
    font-size: 1.125rem;
}
.portal-person span {
    color: var(--navy-dark);
    font-size: 0.9375rem;
}
.portal-person .portal-id {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .35rem;
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.portal-id [data-id-value] {
    font-family: ui-monospace, Consolas, monospace;
    letter-spacing: 0;
}
.portal-id .portal-id-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 34px;
    height: 34px;
    padding: 7px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--navy-dark);
    cursor: pointer;
    transition: background 160ms ease, border-color 160ms ease;
}
.portal-id .portal-id-toggle[hidden] { display: none; }
.portal-id-toggle svg { width: 20px; height: 20px; }
.portal-id .portal-id-toggle:hover { background: #e8f2f9; border-color: #c9dfef; }
.portal-id .portal-id-toggle:focus-visible { outline: 2px solid var(--navy-dark); outline-offset: 2px; }
.portal-eye-slash { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 180ms ease; }
.portal-id-toggle[aria-pressed="true"] .portal-eye-slash { stroke-dashoffset: 1; }
@media (prefers-reduced-motion: reduce) {
    .portal-id .portal-id-toggle, .portal-eye-slash { transition: none; }
}
.portal-menu {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
}
.portal-menu a {
    display: flex;
    flex: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    color: var(--navy-dark);
    text-decoration: none;
    white-space: nowrap;
}
.portal-menu a:hover {
    background: var(--accent-light);
}
.portal-menu a.is-active {
    background: var(--navy);
    color: var(--white);
}
.portal-menu .icon {
    width: 18px;
    height: 18px;
}

@media (min-width: 960px) {
    .portal-layout {
        grid-template-columns: 290px minmax(0, 1fr);
        gap: 2rem;
        padding-top: 2.5rem;
    }
    /* search starts where the page column starts */
    .portal-topbar-inner {
        padding-left: calc(16px + 290px + 2rem);
    }
    .portal-menu {
        flex-direction: column;
        overflow: visible;
        margin-top: 2.5rem;
    }
}

/* 2. Page parts */

.portal-title {
    margin: 0 0 1.75rem;
    color: var(--navy-dark);
    font-size: clamp(1.875rem, 3vw, 2.5rem);
}
.portal-intro {
    margin: -1rem 0 1.75rem;
}
.portal-card {
    margin-bottom: 1.5rem;
    border-radius: 4px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(3, 33, 55, 0.08);
}
.portal-card-body {
    padding: 1.5rem;
}
.portal-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
}
.portal-card-head + .portal-card-body {
    border-top: 1px solid #E6EAF0;
}
.portal-card-head h2,
.portal-card-body h2 {
    margin: 0;
    color: var(--navy);
    font-size: 1.375rem;
}
.portal-card-head p {
    margin: 0.375rem 0 0;
}
.portal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    padding: 0 1.25rem;
    border: 1px solid var(--navy);
    border-radius: 4px;
    background: var(--navy);
    color: var(--white);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.portal-btn:hover {
    background: var(--navy-dark);
    color: var(--white);
}
.portal-btn-outline {
    background: var(--white);
    color: var(--navy);
}
.portal-btn-outline:hover {
    background: var(--sky-light);
    color: var(--navy);
}
.portal-btn-danger {
    border-color: var(--error);
    background: var(--white);
    color: var(--error);
}
.portal-btn-danger:hover {
    background: #FDECEC;
    color: var(--error);
}
.portal-btn-wide {
    width: 100%;
}

/* empty state: icon, bold line, small line */
.portal-empty {
    padding: 2.5rem 1.5rem;
    text-align: center;
}
.portal-empty .icon {
    width: 40px;
    height: 40px;
    color: var(--navy-dark);
    stroke-width: 2.5;
}
.portal-empty strong {
    display: block;
    margin: 0.5rem 0 0.25rem;
    color: var(--navy);
    font-size: 1.375rem;
}
.portal-empty p {
    margin: 0;
}

/* messages */
.portal-alert {
    margin-bottom: 1.25rem;
    padding: 0.875rem 1.25rem;
    border-radius: 4px;
}
.portal-alert p {
    margin: 0;
}
.portal-alert-ok {
    border: 1px solid #C3DCF4;
    background: var(--accent-light);
    color: var(--navy);
}
.portal-alert-error {
    border: 1px solid #F5C2C7;
    background: #F8D7DA;
    color: #842029;
}
.portal-alert-info {
    border: 1px solid #C3DCF4;
    background: #DDEBF8;
    color: var(--navy);
}

/* tabs with an underline */
.portal-tabs {
    display: flex;
    overflow-x: auto;
    margin-bottom: 1rem;
}
.portal-tabs a {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 2px solid transparent;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
}
.portal-tabs a.is-active {
    border-bottom-color: var(--navy);
    color: var(--navy);
}
.portal-tabs .icon {
    width: 16px;
    height: 16px;
}

/* forms: grey boxes, hint inside */
.portal-form {
    display: grid;
    gap: 1rem;
    max-width: 880px;
    margin: 0 auto;
}
.portal-form label > span{
    display: block;
    margin-bottom: 0.375rem;
    color: var(--navy-dark);
    font-weight: 500;
}
.portal-form input:not([type="checkbox"]):not([type="radio"]),
.portal-form select,
.portal-form textarea {
    width: 100%;
    min-height: 50px;
    padding: 0 0.875rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: #ECEEF2;
    color: var(--navy-dark);
    font: inherit;
}
.portal-form textarea {
    min-height: 90px;
    padding: 0.75rem 0.875rem;
}
.portal-form input:focus,
.portal-form select:focus,
.portal-form textarea:focus {
    border-color: var(--navy);
    background: var(--white);
    outline: none;
}
.portal-form input[readonly] {
    color: var(--text);
}
.portal-row {
    display: grid;
    gap: 1rem;
}
@media (min-width: 640px) {
    .portal-row {
        grid-template-columns: 1fr 1fr;
    }
}
.portal-form h3 {
    margin: 1rem 0 0;
    color: var(--text);
    font-size: 1.25rem;
}
.portal-check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    color: var(--navy-dark);
}
.portal-check input {
    flex: none;
    width: 18px;
    height: 18px;
    margin-top: 0.2rem;
    accent-color: var(--navy);
}
.portal-checks {
    display: grid;
    gap: 0.75rem 2rem;
}
@media (min-width: 640px) {
    .portal-checks {
        grid-template-columns: 1fr 1fr;
    }
}

/* switch (consent) */
.portal-switch {
    position: relative;
    flex: none;
    width: 46px;
    height: 26px;
}
.portal-switch input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}
.portal-switch span {
    position: absolute;
    inset: 0;
    border: 2px solid #9AA5B1;
    border-radius: 999px;
    background: var(--white);
    transition: background 0.2s, border-color 0.2s;
    pointer-events: none;
}
.portal-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #9AA5B1;
    transition: transform 0.2s, background 0.2s;
}
.portal-switch input:checked + span {
    border-color: var(--navy);
    background: var(--navy);
}
.portal-switch input:checked + span::after {
    background: var(--white);
    transform: translateX(20px);
}
.portal-switch input:focus-visible + span {
    outline: 3px solid rgba(79, 163, 224, 0.4);
}

/* accordions (assistance, legal) */
.portal-accordion details {
    border-bottom: 1px solid #E6EAF0;
}
.portal-accordion summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 0.25rem;
    color: var(--navy-dark);
    font-size: 1.1875rem;
    font-weight: 600;
    list-style: none;
    cursor: pointer;
}
.portal-accordion summary::-webkit-details-marker {
    display: none;
}
.portal-accordion summary .icon {
    flex: none;
    width: 20px;
    height: 20px;
    color: var(--navy);
    transition: transform 0.2s;
}
.portal-accordion details[open] summary .icon {
    transform: rotate(180deg);
}
.portal-accordion .portal-answer {
    padding: 0 0.25rem 1.25rem;
}
.portal-accordion .portal-answer p {
    margin: 0 0 0.75rem;
}

/* service cards (book a visit) */
.portal-services {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
@media (min-width: 720px) {
    .portal-services {
        grid-template-columns: repeat(2, 1fr);
    }
}
.portal-service {
    display: block;
    padding: 1.5rem;
    border-radius: 4px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(3, 33, 55, 0.08);
    color: inherit;
    text-decoration: none;
    transition: box-shadow 0.2s, transform 0.2s;
}
.portal-service:hover {
    box-shadow: 0 6px 20px rgba(3, 33, 55, 0.14);
    transform: translateY(-2px);
}
.portal-service .icon {
    width: 40px;
    height: 40px;
    color: var(--navy);
    stroke-width: 2.25;
}
.portal-service strong {
    display: block;
    margin: 0.5rem 0 0.375rem;
    color: var(--navy);
    font-size: 1.25rem;
}
.portal-service p {
    margin: 0;
}
.portal-doctor {
    display: grid;
    gap: 1.5rem;
    align-items: center;
    padding: 1.5rem;
}
.portal-doctor h2 {
    margin: 0 0 0.75rem;
    color: var(--navy);
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}
.portal-doctor img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
@media (min-width: 900px) {
    .portal-doctor {
        grid-template-columns: 1.3fr 1fr;
    }
}

/* simple lists (reminders, dependants) */
.portal-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.portal-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid #E6EAF0;
}
.portal-list strong {
    display: block;
    color: var(--navy-dark);
}
.portal-list span {
    font-size: 0.9375rem;
}
.portal-list .portal-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* 3. Pop-up (welcome) */

.portal-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: grid;
    place-items: center;
    padding: 16px;
    background: rgba(3, 33, 55, 0.45);
}
.portal-modal[hidden] {
    display: none;
}
.portal-modal-box {
    position: relative;
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    border-radius: 4px;
    background: var(--white);
}
.portal-modal-box h2 {
    margin: 0 2.5rem 0.75rem 0;
    color: var(--navy-dark);
    font-size: 1.5rem;
}
.portal-modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 0;
    background: none;
    color: var(--navy);
    cursor: pointer;
}
.portal-modal-close .icon {
    width: 28px;
    height: 28px;
    stroke-width: 3;
}

/* 4. Sign up, create a password and verify (single column, like the account pages) */

.signup-page {
    padding: 3rem 16px 4rem;
    background: var(--page-bg);
}
.signup-box {
    max-width: 560px;
    margin: 0 auto;
}
.signup-box h1 {
    margin: 0;
    color: var(--navy-dark);
    font-size: clamp(1.875rem, 3vw, 2.5rem);
}
.signup-intro {
    margin: 0.5rem 0 1.5rem;
}
.signup-box h2 {
    margin: 1.75rem 0 0.375rem;
    color: var(--navy-dark);
    font-size: 1.375rem;
}
.signup-step[hidden] {
    display: none;
}
.signup-label {
    display: block;
    margin: 1.25rem 0 0.5rem;
    color: var(--navy-dark);
    font-size: 1.25rem;
    font-weight: 700;
}
.signup-box .auth-field input {
    border: 1px solid transparent;
    border-radius: 4px;
    background: #ECEEF2;
}
.signup-box .auth-field input:focus {
    border-color: var(--navy);
    background: var(--white);
}
.signup-next {
    min-width: 120px;
    margin-top: 1.25rem;
    border-radius: 4px;
}
.signup-back {
    margin-left: 0.5rem;
}

/* password strength: bar grows and changes colour */
.pw-strength {
    margin-top: 0.75rem;
}
.pw-strength-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9375rem;
}
.pw-strength-word {
    font-weight: 700;
    transition: color 0.3s;
}
.pw-bar {
    height: 4px;
    margin-top: 0.5rem;
    overflow: hidden;
    border-radius: 2px;
    background: #E3E7EC;
}
.pw-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: 2px;
    background: #D92D20;
    transition: width 0.45s cubic-bezier(0.2, 0.8, 0.2, 1), background-color 0.45s;
}
.pw-rules {
    margin: 0.75rem 0 0;
}
.otp-choice {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin: 1rem 0 0.5rem;
    color: var(--navy);
}
.otp-choice input {
    width: 20px;
    height: 20px;
    accent-color: var(--navy);
}

.otp-links {
    display: grid;
    gap: 1.25rem;
    margin-top: 1.5rem;
    text-align: center;
}
.otp-links button,
.otp-links summary {
    border: 0;
    background: none;
    color: var(--navy-dark);
    font: inherit;
    cursor: pointer;
}
.otp-links summary {
    list-style: none;
}
.otp-links summary::-webkit-details-marker {
    display: none;
}
.otp-links details p {
    margin: 0.75rem 0 0;
    text-align: left;
}

/* grey head and shoulders when there's no photo */
.portal-avatar {
    overflow: hidden;
    background: none;
}
.portal-avatar .person-avatar,
.user-avatar .person-avatar {
    display: block;
    width: 100%;
    height: 100%;
}
.portal-avatar-big {
    width: 96px;
    height: 96px;
}

/* 6. Dashboard */

.dash-cards {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (min-width: 900px) {
    .dash-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
.dash-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 4px;
    background: var(--white);
    box-shadow: 0 2px 10px rgba(3, 33, 55, 0.08);
}
.dash-card img {
    display: block;
    width: 100%;
    height: 170px;
    object-fit: cover;
}
.dash-card-body {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    padding: 1.5rem;
}
.dash-card-body h2 {
    margin: 0 0 0.5rem;
    color: var(--navy);
    font-size: 1.375rem;
}
.dash-card-body p {
    flex: 1;
    margin: 0 0 1.5rem;
}

.dash-profile {
    display: grid;
    gap: 1.5rem;
    align-items: start;
    padding: 1.5rem;
}
@media (min-width: 720px) {
    .dash-profile {
        grid-template-columns: 150px minmax(0, 1fr);
    }
}
.dash-avatar {
    width: 150px;
    height: 150px;
    padding: 8px;
    border: 1px solid #D9DEE5;
    border-radius: 50%;
}
.dash-profile-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
}
.dash-profile-head h2 {
    margin: 0 0 0.375rem;
    color: var(--navy-dark);
    font-size: 1.5rem;
}
.dash-profile-head p {
    margin: 0;
}
.dash-percent {
    color: #12B76A;
    font-weight: 600;
}
.dash-steps {
    display: grid;
    gap: 0.5rem 2rem;
    margin: 1.25rem 0 0;
    padding: 0;
    list-style: none;
}
@media (min-width: 900px) {
    .dash-steps {
        grid-template-columns: 1fr 1fr;
    }
}
.dash-steps a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
}
.dash-steps a::before {
    content: "";
    flex: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #9AA5B1;
}
.dash-steps a:hover {
    color: var(--navy);
}
/* done: green dot, crossed off */
.dash-steps .is-done a {
    color: var(--navy);
}
.dash-steps .is-done a::before {
    background: #12B76A;
}

.dash-pending a {
    font-weight: 600;
}

/* switch stays on the right of its card heading */
.portal-card-head:has(.portal-switch) {
    flex-wrap: nowrap;
}
