@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Thin.woff2") format("woff2");
    font-weight: 100;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-ExtraLight.woff2") format("woff2");
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Light.woff2") format("woff2");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Black.woff2") format("woff2");
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --ink: #172423;
    --muted: #647270;
    --line: #dbe6e3;
    --surface: #ffffff;
    --canvas: #f3f8f6;
    --brand: #116a67;
    --brand-dark: #0c5351;
    --accent: #e6f4ef;
    --danger: #bd4242;
    font-family: Vazirmatn, Tahoma, Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }

body {
    min-width: 320px;
    margin: 0;
    background:
        radial-gradient(circle at 94% 4%, #d9f0e8 0, transparent 26rem),
        var(--canvas);
}

button, input, select, textarea { font: inherit; }

.page-shell {
    width: min(100% - 2rem, 940px);
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}

.form-card {
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgb(23 36 35 / 7%);
}

.form-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
    color: #fff;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand));
}

.eyebrow { margin: 0 0 .4rem; font-size: .8rem; color: #c9e8dd; }
h1 { margin: 0; font-size: clamp(1.5rem, 4vw, 2rem); line-height: 1.4; }
.form-card__description { margin: .55rem 0 0; color: #dceee9; font-size: .94rem; }

.operator-chip {
    display: grid;
    gap: .15rem;
    min-width: max-content;
    margin: 0;
    padding: .55rem .75rem;
    border: 1px solid rgb(255 255 255 / 25%);
    border-radius: .7rem;
    background: rgb(0 0 0 / 10%);
    font-size: .86rem;
}
.operator-chip__label { color: #c9e8dd; font-size: .72rem; }

.operator-actions { display: flex; align-items: stretch; gap: .5rem; }
.operator-actions form { margin: 0; }
.logout-button {
    height: 100%;
    min-height: 3.25rem;
    padding: .55rem .85rem;
    color: #fff;
    background: rgb(0 0 0 / 12%);
    border: 1px solid rgb(255 255 255 / 25%);
    border-radius: .7rem;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.logout-button:hover { background: rgb(0 0 0 / 22%); border-color: rgb(255 255 255 / 40%); }
.logout-button:focus-visible { outline: 3px solid rgb(255 255 255 / 38%); outline-offset: 2px; }

.clinic-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem 1rem;
    padding: clamp(1.5rem, 4vw, 2.5rem);
}

.field { min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label, .field legend { display: block; margin-bottom: .5rem; font-size: .92rem; font-weight: 700; }
.field [aria-hidden="true"] { color: var(--danger); }
.field__optional { margin-right: .35rem; color: var(--muted); font-size: .76rem; font-weight: 400; }

input, select, textarea {
    width: 100%;
    padding: .65rem .8rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid #bdcfca;
    border-radius: .65rem;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

input, select { height: 3.1rem; }
textarea { min-height: 7rem; resize: vertical; line-height: 1.8; }

input::placeholder, textarea::placeholder { color: #9aa8a5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(17 106 103 / 13%); }
select:disabled { color: #8d9a98; background: #f1f4f3; cursor: not-allowed; }
.field__hint { margin: .45rem 0 0; color: var(--muted); font-size: .76rem; line-height: 1.7; }
code { direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: .92em; }
.field__error { margin: .45rem 0 0; color: var(--danger); font-size: .78rem; line-height: 1.6; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
.form-status {
    display: none;
    align-items: center;
    gap: .85rem;
    padding: 1rem 1.1rem;
    border: 1px solid transparent;
    border-radius: .8rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.8;
    box-shadow: 0 .5rem 1.5rem rgb(23 36 35 / 7%);
}
.form-status.is-visible { display: flex; }
.form-status.is-error { color: #852d2d; background: #ffeded; border-color: #f0caca; }
.form-status.is-success { color: #155b46; background: #e6f5ed; border-color: #b9dfcc; }
.form-status.is-warning { color: #704d00; background: #fff3cd; border-color: #ead28d; }
.form-status__icon {
    display: inline-grid;
    place-items: center;
    flex: 0 0 2.25rem;
    width: 2.25rem;
    height: 2.25rem;
    border: 2px solid currentColor;
    border-radius: 50%;
    font-size: 1.35rem;
    line-height: 1;
}
.form-status__message { flex: 1; }

fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.date-options { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; }
.date-option { position: relative; display: block; margin: 0 !important; cursor: pointer; }
.date-option input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.date-option span {
    display: block;
    min-height: 4.15rem;
    padding: .65rem .35rem;
    border: 1px solid #bdcfca;
    border-radius: .65rem;
    color: #52605e;
    text-align: center;
    font-size: .78rem;
    line-height: 1.6;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.date-option input:checked + span { border-color: var(--brand); color: var(--brand-dark); background: var(--accent); font-weight: 700; }
.date-option input:focus-visible + span { outline: 3px solid rgb(17 106 103 / 18%); outline-offset: 2px; }
.visit-time select { max-width: 18rem; direction: ltr; text-align: right; }

.form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-top: .5rem;
    border-top: 1px solid var(--line);
}
.form-footer__notice { margin: 0; color: var(--muted); font-size: .82rem; }
.submit-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    min-width: 11rem;
    min-height: 3.15rem;
    padding: .65rem 1rem;
    border: 0;
    border-radius: .65rem;
    color: #fff;
    background: var(--brand);
    cursor: pointer;
    transition: background .15s ease, transform .15s ease;
}
.submit-button:hover { background: var(--brand-dark); }
.submit-button:focus-visible, .dialog-button:focus-visible { outline: 3px solid rgb(17 106 103 / 25%); outline-offset: 2px; }
.submit-button:active { transform: translateY(1px); }
.submit-button:disabled { background: #7b8b87; cursor: wait; }
.submit-button.is-loading::before {
    width: 1rem;
    height: 1rem;
    border: 2px solid rgb(255 255 255 / 45%);
    border-top-color: #fff;
    border-radius: 50%;
    content: "";
    animation: form-spin .75s linear infinite;
}

.form-loading {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(12 83 81 / 24%);
    backdrop-filter: blur(3px);
}
.form-loading[hidden] { display: none; }
.form-loading__panel {
    display: grid;
    justify-items: center;
    gap: .55rem;
    min-width: min(21rem, 100%);
    padding: 1.5rem;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 1rem;
    box-shadow: 0 1.2rem 3.5rem rgb(23 36 35 / 20%);
}
.form-loading__panel strong { font-size: 1.05rem; }
.form-loading__panel > span:last-child { color: var(--muted); font-size: .86rem; }
.form-loading__spinner {
    width: 2.75rem;
    height: 2.75rem;
    border: 4px solid #cfe4df;
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: form-spin .75s linear infinite;
}

@keyframes form-spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
    .form-loading__spinner, .submit-button.is-loading::before { animation-duration: 1.5s; }
}

.login-page { min-height: 100vh; min-height: 100svh; }
.login-shell {
    display: grid;
    place-items: center;
    width: min(100% - 2rem, 30rem);
    min-height: 100vh;
    min-height: 100svh;
    padding-block: 1rem;
}
.login-card { width: 100%; }
.login-card__header { min-height: 10rem; align-items: center; }
.login-form { display: grid; gap: 1.25rem; padding: clamp(1.5rem, 6vw, 2.5rem); }
.login-error {
    margin: 0;
    padding: .75rem .9rem;
    color: #852d2d;
    background: #ffeded;
    border: 1px solid #f0caca;
    border-radius: .65rem;
    font-size: .86rem;
    line-height: 1.7;
}
.login-submit { width: 100%; margin-top: .25rem; }

@media (max-width: 640px) {
    .page-shell { width: min(100% - 1rem, 940px); padding-top: .5rem; }
    .form-card { border-radius: 1rem; }
    .form-card__header { align-items: stretch; flex-direction: column; }
    .operator-chip { width: fit-content; }
    .operator-actions { align-items: stretch; justify-content: space-between; }
    .logout-button { min-height: 3.25rem; }
    .clinic-form { grid-template-columns: 1fr; gap: 1rem; }
    .field, .field--full { grid-column: auto; }
    .date-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .visit-time select { max-width: none; }
    .form-footer { align-items: stretch; flex-direction: column; }
    .submit-button { width: 100%; }
}
