/* Shared styles for the patient auth pages (login, sign up, reset password) */
:root {
    --primary: #1047e6;
    --primary-hover: #0b3cc7;
    --navy: #0b2366;
    --ink: #1f2a44;
    --muted: #5b6478;
    --soft: #8a93a6;
    --line: #dfe4ee;
    --line-soft: #e9edf5;
    --danger: #e0393e;
    --success: #12925a;
    --page: #f1f5fd;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--page);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    -webkit-font-smoothing: antialiased;
}

svg.icon {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ---------- Shell ---------- */
.shell {
    position: relative;
    width: 100%;
    max-width: 1120px;
    min-height: 640px;
    display: grid;
    grid-template-columns: 40% 60%;
    border-radius: 22px;
    overflow: hidden;
    background:
        radial-gradient(120% 70% at 20% 30%, rgba(255,255,255,.85) 0%, rgba(255,255,255,0) 60%),
        linear-gradient(165deg, #eef2ff 0%, #d9e3ff 40%, #b4c8ff 75%, #9db6fb 100%);
    box-shadow: 0 30px 80px rgba(20, 52, 150, .12), 0 2px 6px rgba(20, 52, 150, .05);
    border: 1px solid #dfe6f7;
}

/* ---------- Brand panel ---------- */
.brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 56px 56px 56px 72px;
    overflow: hidden;
    isolation: isolate;
}

.brand .wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

.brand .dots {
    position: absolute;
    left: 0;
    bottom: 40px;
    width: 140px;
    height: 120px;
    background-image: radial-gradient(rgba(16, 71, 230, .22) 1.4px, transparent 1.6px);
    background-size: 14px 14px;
    z-index: -1;
}

.brand .plus {
    position: absolute;
    z-index: -1;
    color: rgba(255, 255, 255, .55);
}
.brand .plus svg { width: 100%; height: 100%; fill: currentColor; }
.brand .plus.p1 { width: 40px; height: 40px; left: 4%; top: 58%; }
.brand .plus.p2 { width: 34px; height: 34px; right: 9%; bottom: 13%; color: rgba(255,255,255,.6); }
.brand .plus.p3 { width: 30px; height: 30px; left: 46%; bottom: -6px; color: rgba(255,255,255,.5); }

.brand-logo {
    width: 170px;
    margin: 0 auto 44px;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(16, 50, 140, .10));
}

.brand-copy { max-width: 300px; margin: 0 auto; width: 100%; }

.brand h2 {
    font-size: 30px;
    line-height: 1.22;
    font-weight: 800;
    color: var(--navy);
    letter-spacing: -0.01em;
    margin-bottom: 16px;
}

.brand p {
    font-size: 14px;
    line-height: 1.65;
    color: #33405e;
}

/* ---------- Form panel ---------- */
.panel {
    position: relative;
    background: #fff;
    border-bottom-left-radius: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 40px 28px;
}

.panel::before {
    content: "";
    position: absolute;
    top: 12px;
    right: 12px;
    width: 140px;
    height: 200px;
    background-image: radial-gradient(rgba(16, 71, 230, .16) 1.4px, transparent 1.6px);
    background-size: 14px 14px;
    -webkit-mask-image: linear-gradient(225deg, #000 30%, transparent 85%);
    mask-image: linear-gradient(225deg, #000 30%, transparent 85%);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 18px;
    border: 1px solid var(--line-soft);
    box-shadow: 0 14px 44px rgba(18, 44, 120, .08);
    padding: 0 30px 32px;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--line-soft);
    margin: 0 0 30px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 20px 0 16px;
    font-size: 15px;
    font-weight: 600;
    color: var(--soft);
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    transition: color .2s ease;
}

.tab::after {
    content: "";
    position: absolute;
    left: 10%;
    right: 10%;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transition: transform .25s ease;
}

.tab:hover { color: var(--muted); }
.tab.active { color: var(--primary); }
.tab.active::after { transform: scaleX(1); }

/* Views */
.form-container { display: none; }
.form-container.active { display: block; animation: fadeIn .35s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.form-head { text-align: center; margin-bottom: 24px; }

.form-head h1 {
    font-size: 21px;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 8px;
}

.form-head p {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--muted);
    max-width: 290px;
    margin: 0 auto;
}

/* Inputs */
.input-group { margin-bottom: 14px; }

.field {
    position: relative;
    display: flex;
    align-items: center;
}

.field > .icon {
    position: absolute;
    left: 15px;
    color: #6b7489;
    pointer-events: none;
}

.field input {
    width: 100%;
    height: 48px;
    padding: 0 44px 0 46px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    background: #fff;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.field input::placeholder { color: #8d95a6; }

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 71, 230, .10);
}

.password-toggle {
    position: absolute;
    right: 8px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: none;
    background: none;
    color: #4b5468;
    cursor: pointer;
    border-radius: 6px;
}
.password-toggle:hover { color: var(--primary); }
.password-toggle:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

.error-message {
    display: block;
    color: var(--danger);
    font-size: 12px;
    margin-top: 6px;
    line-height: 1.4;
}
.error-message:empty { display: none; }

.password-strength { margin-top: 6px; }
.password-strength-meter { height: 4px; border-radius: 4px; transition: width .3s ease; }
.strength-weak { width: 33%; background: var(--danger); }
.strength-medium { width: 66%; background: #f2a516; }
.strength-strong { width: 100%; background: var(--success); }

/* Row: remember + forgot */
.row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 22px;
    font-size: 13.5px;
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #3a4359;
    cursor: pointer;
    font-size: 13.5px;
    line-height: 1.5;
}

.check input {
    appearance: none;
    -webkit-appearance: none;
    width: 17px;
    height: 17px;
    border: 1.6px solid #6f8be8;
    border-radius: 4px;
    display: grid;
    place-items: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background .15s ease, border-color .15s ease;
}
.check input::after {
    content: "";
    width: 9px;
    height: 5px;
    border: 2px solid #fff;
    border-top: 0;
    border-right: 0;
    transform: rotate(-45deg) translate(1px, -1px);
    opacity: 0;
}
.check input:checked { background: var(--primary); border-color: var(--primary); }
.check input:checked::after { opacity: 1; }
.check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
    background: none;
    border: none;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}
.link:hover { text-decoration: underline; }

/* Buttons */
.btn {
    position: relative;
    width: 100%;
    height: 46px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, box-shadow .2s ease, transform .1s ease;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    box-shadow: 0 8px 18px rgba(16, 71, 230, .22);
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary .icon { position: absolute; right: 16px; width: 19px; height: 19px; }

.btn-outline {
    margin-top: 18px;
    background: #fff;
    color: var(--primary);
    border: 1px solid var(--line);
}
.btn-outline:hover { border-color: var(--primary); background: #f6f8ff; }

.btn[disabled] { opacity: .7; cursor: progress; }
.btn-primary.is-loading .label::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 10px;
    vertical-align: -2px;
    border: 2px solid rgba(255,255,255,.5);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


.terms { margin: 18px 0 22px; align-items: flex-start; font-size: 13px; }
.terms input { margin-top: 1px; }

.switch-line {
    text-align: center;
    margin-top: 22px;
    font-size: 13.5px;
    color: #3a4359;
}

/* Flash */
.flash-message {
    display: none;
    margin-bottom: 18px;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}
.flash-message.success { display: block; background: #e8f7ef; color: #0d6e44; border: 1px solid #bfe8d2; }
.flash-message.error { display: block; background: #fdeeee; color: #b42328; border: 1px solid #f6caca; }

/* Contact footer */
.contact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-top: 26px;
    font-size: 13px;
    color: #3a4359;
    flex-wrap: wrap;
}
.contact a {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: inherit;
    text-decoration: none;
}
.contact a:hover { color: var(--primary); }
.contact .icon { color: var(--primary); width: 16px; height: 16px; }
.contact .sep { width: 1px; height: 14px; background: #c9d0de; }

input[name="csrf_token"] { display: none; }

a.tab { display: block; text-decoration: none; }

/* ---------- Reset password ---------- */
.status-badge {
    width: 64px;
    height: 64px;
    margin: 0 auto 18px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #eaf0ff;
    color: var(--primary);
    box-shadow: 0 0 0 8px #f4f7ff;
}
.status-badge .icon { width: 28px; height: 28px; stroke-width: 2; }
.status-badge.success { background: #e3f6ec; color: var(--success); box-shadow: 0 0 0 8px #f1faf5; }
.status-badge.error { background: #fdecec; color: var(--danger); box-shadow: 0 0 0 8px #fef6f6; }

.rules {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
    margin: 4px 0 18px;
    padding: 12px 14px;
    background: #f7f9fe;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    font-size: 12px;
    color: var(--muted);
}
.rules li { display: flex; align-items: center; gap: 7px; transition: color .2s ease; }
.rules .icon { width: 14px; height: 14px; stroke-width: 2.4; color: #c3cad8; transition: color .2s ease; }
.rules li.ok { color: var(--success); }
.rules li.ok .icon { color: var(--success); }

a.btn { text-decoration: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .shell { grid-template-columns: 1fr; min-height: 0; }
    .brand { padding: 36px 24px 56px; text-align: center; }
    .brand-logo { width: 104px; margin-bottom: 18px; }
    .brand-copy { max-width: 340px; }
    .brand h2 { font-size: 24px; margin-bottom: 8px; }
    .brand h2 br { display: none; }
    .brand p { font-size: 13px; }
    .panel {
        border-bottom-left-radius: 0;
        border-top-left-radius: 28px;
        border-top-right-radius: 28px;
        margin-top: -28px;
        padding: 28px 16px 24px;
    }
    .panel::before { display: none; }
}

@media (max-width: 420px) {
    .rules { grid-template-columns: 1fr; }
    body { padding: 0; }
    .shell { border-radius: 0; border: none; }
    .auth-card { padding: 0 18px 26px; box-shadow: none; border: none; }
    .contact .sep { display: none; }
    .contact { gap: 10px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
