/* Friends & Family Test - shared styles. Light theme only.
   .pearl  = practice pages, Pearl Dental Software brand (brand guide 2025)
   .survey = patient questionnaire pages, deliberately unbranded */

:root { color-scheme: light; }
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: #fff; }
img { max-width: 100%; height: auto; border: 0; }

/* =========================================================================
   Practice pages (Pearl branded)
   Colours: green #009F51, purple #2A2251, blue #2D789F, light blue #C6DFF5
   ========================================================================= */
.pearl {
    font-family: 'Montserrat', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #2A2251;
}
.pearl a { color: #2D789F; }
.pearl h1 { font-size: 24px; font-weight: 700; line-height: 1.3; margin: 0 0 8px; }
.pearl h2 { font-size: 16px; font-weight: 700; margin: 32px 0 8px; }
.pearl h2:first-child { margin-top: 0; }
.pearl p { margin: 0 0 12px; }

.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* Header: logo asset already includes its exclusion zone, so nothing sits on it */
.topbar { border-bottom: 1px solid #C6DFF5; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar .logo { display: block; width: 180px; }
.topbar .app-name { font-weight: 700; font-size: 15px; }

.page { padding-top: 28px; padding-bottom: 56px; }
.lead { font-size: 15px; margin-bottom: 24px; }
.muted { opacity: .75; }
.small { font-size: 12px; }

/* Logged-in bar */
.userbar {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 8px 24px; padding: 10px 0; margin-bottom: 28px;
    border-bottom: 1px solid #C6DFF5; font-size: 13px;
}
.userbar .who { font-weight: 600; }
.userbar .links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.userbar .links a { font-weight: 600; text-decoration: none; }
.userbar .links a:hover { text-decoration: underline; }

/* Panels */
.panel { border: 1px solid #C6DFF5; border-radius: 8px; padding: 20px; margin-bottom: 24px; }
.panel-tint { background: #C6DFF5; border-color: #C6DFF5; }
.cols { display: grid; gap: 24px; }
@media (min-width: 760px) {
    .cols { grid-template-columns: 1fr 1fr; }
    .cols-main { grid-template-columns: 3fr 2fr; align-items: start; }
}

/* Forms */
.form { max-width: 420px; }
.field { margin-bottom: 16px; }
.field > label, .field .label { display: block; font-weight: 600; margin-bottom: 4px; }
.hint { display: block; font-size: 12px; opacity: .75; margin-top: 4px; }
.pearl input[type=text], .pearl input[type=password], .pearl input[type=email], .pearl select, .pearl textarea {
    width: 100%;
    font-family: inherit;
    font-size: 16px;          /* 16px stops phones zooming in on focus */
    color: #2A2251;
    padding: 8px 10px;
    border: 1px solid #C6DFF5;
    border-radius: 6px;
    background: #fff;
}
.pearl input:focus, .pearl select:focus, .pearl textarea:focus { outline: 2px solid #2D789F; outline-offset: -1px; }
.pearl input.num { width: 90px; text-align: right; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { margin-top: 4px; flex: none; }
.choice-list { list-style: none; margin: 0; padding: 0; }
.choice-list li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 10px; }
.choice-list input { margin-top: 4px; flex: none; }

/* Validation and messages (red is used only for errors) */
.err { display: block; color: #B42318; font-size: 12px; font-weight: 600; margin-top: 4px; }
.alert { display: block; border: 1px solid #B42318; color: #B42318; border-radius: 6px; padding: 10px 12px; margin-bottom: 20px; }
.success { display: block; border: 1px solid #009F51; border-radius: 6px; padding: 10px 12px; margin-bottom: 20px; }

/* Bot trap on the registration form: off-screen for people (not display:none, which some bots skip) */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 20px; }

/* Buttons. Save/Confirm use the approved SVGs from the brand pack; other actions have no
   approved asset, so .btn copies the same system: white pill, green outline, purple
   Montserrat SemiBold 12px, light-green hover, grey disabled. */
.btn {
    appearance: none; -webkit-appearance: none;
    display: inline-block; min-width: 82px; height: 29px; padding: 0 18px;
    font-family: 'Montserrat', Arial, sans-serif; font-weight: 600; font-size: 12px; line-height: 27px;
    color: #2A2251; background: #fff; border: 1px solid #009F51; border-radius: 15px;
    text-align: center; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.pearl a.btn { color: #2A2251; }
.btn:hover { background: #C4E9D7; }
.btn:disabled { background: #D9D9D9; border-color: #AFAFAF; color: #A8A8A8; cursor: default; }

.btn-svg {
    appearance: none; -webkit-appearance: none;
    width: 82px; height: 29px; padding: 0; border: 0;
    background: transparent no-repeat center / contain;
    color: transparent; font-size: 0; cursor: pointer;
}
.btn-save { background-image: url(../images/buttons/save.svg); }
.btn-save:hover { background-image: url(../images/buttons/save-hover.svg); }
.btn-save:disabled { background-image: url(../images/buttons/save-disabled.svg); cursor: default; }
.btn-confirm { background-image: url(../images/buttons/confirm.svg); }
.btn-confirm:hover { background-image: url(../images/buttons/confirm-hover.svg); }
.btn-confirm:disabled { background-image: url(../images/buttons/confirm-disabled.svg); cursor: default; }

/* Tables */
.table-scroll { overflow-x: auto; margin-bottom: 8px; }
.table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.table th, .table td { padding: 9px 12px; border-bottom: 1px solid #C6DFF5; text-align: right; white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table thead th { background: #2A2251; color: #fff; font-weight: 600; }
.table thead th:first-child { background: transparent; }
.table thead th.hl { background: #009F51; }
.table td.hl { font-weight: 700; }
.table tr.total td { font-weight: 700; border-top: 2px solid #2A2251; }
.table a { font-weight: 600; }
@media (max-width: 600px) {
    /* fit all columns on a phone so "Last month" is never scrolled out of view */
    .table th, .table td { padding: 8px 5px; font-size: 13px; white-space: normal; }
    .table th:first-child, .table td:first-child { padding-left: 0; }
}
.pearl a { overflow-wrap: anywhere; }

.linkbox { font-family: Consolas, monospace; font-size: 14px !important; background: #fff; }
.template { border-left: 3px solid #C6DFF5; padding: 4px 0 4px 14px; margin: 8px 0 16px; }

/* Share page: Short link / Long link switch, no script. The two radios come before everything they
   affect, are hidden from view but still keyboard-focusable, and show either .link-short or .link-long. */
.link-choice { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
#linkShort:checked ~ .link-long, #linkShort:checked ~ * .link-long,
#linkLong:checked ~ .link-short, #linkLong:checked ~ * .link-short { display: none !important; }
.link-switch { display: inline-flex; margin: 4px 0 16px; border: 1px solid #009F51; border-radius: 15px; overflow: hidden; }
.link-switch label { padding: 0 16px; height: 27px; line-height: 27px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.link-switch label:hover { background: #C4E9D7; }
#linkShort:checked ~ .link-switch label[for=linkShort],
#linkLong:checked ~ .link-switch label[for=linkLong] { background: #009F51; color: #fff; }
#linkShort:focus-visible ~ .link-switch label[for=linkShort],
#linkLong:focus-visible ~ .link-switch label[for=linkLong] { outline: 2px solid #2D789F; outline-offset: -2px; }

/* Admin pages */
.adminnav { display: flex; flex-wrap: wrap; gap: 4px 20px; padding: 10px 0; margin-bottom: 24px; border-bottom: 1px solid #C6DFF5; font-size: 13px; font-weight: 600; }
.adminnav a { text-decoration: none; }
.adminnav a:hover { text-decoration: underline; }
.adminnav a[aria-current=page] { color: #2A2251; border-bottom: 2px solid #009F51; }
.adminnav .adminnav-back { margin-left: auto; }
.admin h2 a.small { font-weight: 600; margin-left: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { border: 1px solid #C6DFF5; border-radius: 8px; padding: 14px 16px; }
.stat-title { font-size: 12px; font-weight: 600; opacity: .8; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.3; }
.stat-detail { font-size: 12px; opacity: .8; }
.filters { display: flex; flex-wrap: wrap; gap: 0 16px; align-items: flex-end; margin-bottom: 8px; }
.filters .field { min-width: 180px; flex: 1 1 180px; max-width: 280px; }
.filters .actions { margin: 0 0 16px; }
.admin-table td { white-space: normal; text-align: left; vertical-align: top; }
.admin-table th { text-align: left; }
.admin-table td { overflow-wrap: break-word; }
.admin-table td:nth-child(3) { min-width: 200px; }
.admin-table td:first-child { white-space: nowrap; }
.admin-table th, .admin-table td { padding: 8px 8px; }
.practices-table td:nth-child(2) { min-width: 200px; }
.practices-table td:last-child { white-space: nowrap; }
.practices-table td:nth-child(3) { min-width: 150px; overflow-wrap: anywhere; }
.tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 8px; border-radius: 10px; background: #C6DFF5; }
.tag-warn { background: #FCE8C3; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.btn-danger { border-color: #B42318; }
.btn-danger:hover { background: #FDE2DF; }
.pager a { margin-right: 16px; font-weight: 600; }

.footer { border-top: 1px solid #C6DFF5; padding: 16px 0 32px; font-size: 12px; opacity: .8; }

/* =========================================================================
   Patient questionnaire (unbranded, neutral)
   ========================================================================= */
.survey {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.5;
    color: #1f2328;
    background: #f4f5f7;
}
.survey-card { max-width: 560px; margin: 0 auto; min-height: 100vh; padding: 24px 20px 40px; background: #fff; }
@media (min-width: 600px) {
    .survey-card { min-height: 0; margin: 40px auto; padding: 36px 36px 40px; border: 1px solid #e1e4e8; border-radius: 12px; }
}
.survey-label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #59636e; margin: 0 0 12px; }
.survey-intro { color: #59636e; margin: 0 0 20px; }
.survey h1 { font-size: 22px; line-height: 1.3; margin: 0 0 18px; }
.survey p { margin: 0 0 14px; }
.survey a { color: #1f2328; }

.options { list-style: none; margin: 0 0 6px; padding: 0; }
.options li { margin: 0 0 10px; position: relative; }
.options input { position: absolute; opacity: 0; left: 0; top: 0; }
.options label {
    display: block; padding: 14px 16px; cursor: pointer;
    border: 1px solid #d0d7de; border-radius: 10px; background: #fff;
}
.options label::before {
    content: ""; display: inline-block; width: 18px; height: 18px; margin-right: 12px; vertical-align: -3px;
    border: 2px solid #8c959f; border-radius: 50%; background: #fff;
}
.options input:checked + label { border-color: #1f2328; box-shadow: inset 0 0 0 1px #1f2328; font-weight: 600; }
.options input:checked + label::before { border-color: #1f2328; background: radial-gradient(#1f2328 0 4px, #fff 5px); }
.options input:focus-visible + label { outline: 2px solid #0969da; outline-offset: 2px; }

.survey .q2 { font-weight: 600; margin: 24px 0 8px; }
.survey textarea {
    width: 100%; min-height: 120px; padding: 12px;
    font: inherit; color: inherit;
    border: 1px solid #d0d7de; border-radius: 10px; resize: vertical;
}
.survey textarea:focus { outline: 2px solid #0969da; outline-offset: 0; }
.consent { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: #59636e; margin: 16px 0 24px; }
.consent input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; }
.survey-btn {
    appearance: none; -webkit-appearance: none;
    display: block; width: 100%; padding: 14px; text-align: center; text-decoration: none;
    font: inherit; font-weight: 600; color: #fff; background: #1f2328;
    border: 0; border-radius: 10px; cursor: pointer;
}
.survey a.survey-btn { color: #fff; }
.survey-btn:disabled { opacity: .6; cursor: default; }
.survey-err { display: block; color: #b42318; font-size: 15px; margin: 4px 0 8px; }
