/* Brand colours, taken from the clinic logo */
:root {
    --brand-plum: #660451;
    --brand-plum-dark: #4d033d;
    --brand-plum-darker: #3a022e;
    --brand-orange: #e55c0c;
    --brand-navy: #2b196b;

    --bs-primary: var(--brand-plum);
    --bs-primary-rgb: 102, 4, 81;
    --bs-link-color: var(--brand-plum);
    --bs-link-color-rgb: 102, 4, 81;          /* Bootstrap 5.3 builds link colours from this one */
    --bs-link-hover-color: var(--brand-plum-dark);
    --bs-link-hover-color-rgb: 77, 3, 61;
}

body {
    background: #f8f6f8;
}

.btn-primary {
    --bs-btn-bg: var(--brand-plum);
    --bs-btn-border-color: var(--brand-plum);
    --bs-btn-hover-bg: var(--brand-plum-dark);
    --bs-btn-hover-border-color: var(--brand-plum-dark);
    --bs-btn-active-bg: var(--brand-plum-darker);
    --bs-btn-active-border-color: var(--brand-plum-darker);
    --bs-btn-focus-shadow-rgb: 102, 4, 81;
    --bs-btn-disabled-bg: #a87a9e;
    --bs-btn-disabled-border-color: #a87a9e;
    font-weight: 600;
}

/* Plum focus ring on inputs instead of Bootstrap's blue */
.form-control:focus {
    border-color: #b06aa0;
    box-shadow: 0 0 0 0.25rem rgba(102, 4, 81, 0.15);
}

.brand-name {
    color: var(--brand-plum);
}

/* Login page: centred card on a soft plum background */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background:
        radial-gradient(circle at 15% 20%, rgba(229, 92, 12, 0.12), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(43, 25, 107, 0.14), transparent 45%),
        linear-gradient(160deg, #fbf5fa 0%, #f1e6ef 100%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    border: 0;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(58, 2, 46, 0.15);
}

/* Thin bar in the three logo colours along the top of the card */
.brand-stripe {
    height: 6px;
    background: linear-gradient(90deg, var(--brand-orange), var(--brand-plum) 50%, var(--brand-navy));
}

/* The logo is a circle on a white square, so round it off */
.login-logo {
    width: 112px;
    height: 112px;
    border-radius: 50%;
    box-shadow: 0 6px 20px rgba(102, 4, 81, 0.25);
}

.brand-tagline {
    color: var(--brand-orange);
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Home page */
.app-navbar {
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--brand-orange), var(--brand-plum) 50%, var(--brand-navy)) 1;
}

.nav-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Dashboard tiles, each with a top edge in one logo colour */
.tile {
    border: 0;
    border-top: 4px solid var(--tile-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

/* A tile that is a link: no underline, lifts slightly on hover */
.tile-link {
    text-decoration: none;
    color: inherit;
    transition: transform 0.15s, box-shadow 0.15s;
}

.tile-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(102, 4, 81, 0.15);
}

.tile-plum   { --tile-color: var(--brand-plum); }
.tile-navy   { --tile-color: var(--brand-navy); }
.tile-orange { --tile-color: var(--brand-orange); }

/* Add/edit patient form */
.form-page {
    max-width: 900px;
}

.form-section {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--brand-plum);
    margin-bottom: 0.75rem;
}

/* Allergies stand out on the form */
.allergy-box {
    background: #fdf1f1;
    border: 1px solid #f3c7c7;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.form-check-input:checked {
    background-color: var(--brand-plum);
    border-color: var(--brand-plum);
}

/* Gender buttons: plum instead of Bootstrap blue */
.btn-outline-primary {
    --bs-btn-color: var(--brand-plum);
    --bs-btn-border-color: #c9a3c0;
    --bs-btn-hover-bg: #f1e6ef;
    --bs-btn-hover-color: var(--brand-plum);
    --bs-btn-hover-border-color: var(--brand-plum);
    --bs-btn-active-bg: var(--brand-plum);
    --bs-btn-active-border-color: var(--brand-plum);
}

/* Patient page */
.case-badge {
    background: var(--brand-plum);
    font-size: 0.8rem;
}

.alerts-box {
    border-left: 5px solid #b42318;
}

.alert-badge {
    background: #b42318;
    font-size: 0.85rem;
    font-weight: 500;
}

.condition-badge {
    background: #f1e6ef;
    color: var(--brand-plum);
    font-weight: 500;
    font-size: 0.85rem;
}

.condition-badge.is-alert {
    background: #fde8e8;
    color: #b42318;
}

/* Treatments table */
.tooth-badge {
    background: #ffffff;
    color: var(--brand-navy);
    border: 1px solid #c8c0e0;
    font-weight: 600;
}

.status-ongoing {
    background: #fff1e6;
    color: #b24a07;
}

.status-done {
    background: #e7f6ec;
    color: #1d7a3e;
}

/* Money: Total / Paid / Pending */
.money-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 2.5rem;
    align-items: flex-end;
}

.money-row > div {
    display: flex;
    flex-direction: column;
}

.money-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a7d88;
}

/* ".table" in front so these win over Bootstrap's own table text colour */
.text-pending,
.table .text-pending {
    color: var(--brand-orange);
}

.text-paid,
.table .text-paid {
    color: #1d7a3e;
}

/* Visits timeline on the patient page */
.visit-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid #eee6ec;
}

.visit-date {
    flex: 0 0 6.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand-plum);
}

.visit-body {
    min-width: 0;
}

.visit-work {
    white-space: pre-line;   /* keep the line breaks she typed */
}

/* Appointment lists (fragments/appointments.html) */
.appt-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1rem;
    padding: 0.65rem 1rem;
    border-top: 1px solid #eee6ec;
}

.appt-item.is-closed {
    opacity: 0.6;
}

.appt-when {
    flex: 0 0 6.5rem;
}

.appt-day {
    font-size: 0.75rem;
    color: #8a7d88;
}

.appt-time {
    font-weight: 700;
    color: var(--brand-plum);
}

.appt-who {
    flex: 1 1 12rem;
    min-width: 0;
}

.appt-actions {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.status-missed,
.text-missed,
.table .text-missed {
    color: #b42318;
}

.status-missed {
    background: #fde8e8;
}

.status-cancelled {
    background: #eeeeee;
    color: #555555;
}

/* Delete buttons sit apart from Save, below a line */
.danger-zone {
    border-top: 1px solid #eee6ec;
    padding-top: 1rem;
}

/* Expense sheet: compact rows, amounts right-aligned like a spreadsheet */
.expense-sheet td,
.expense-sheet th {
    padding: 0.4rem 0.5rem;
}

.expense-sheet input.amount {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Dashboard: stat tiles */
.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
    gap: 0.75rem;
}

.stat-tile {
    background: #fff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.stat-lead .stat-value {
    font-size: 2rem;
}

/* Dashboard chart (static/js/income-chart.js). Colours checked with the dataviz palette validator:
   clear colour-blind separation between neighbours. Profit (aqua) is just under 3:1 on white,
   so the table under the chart carries the same numbers. */
.viz-root {
    --series-income: #2a78d6;
    --series-expenses: #eb6834;
    --series-profit: #1baf7a;
    --chart-grid: #e1e0d9;
    --chart-axis: #c3c2b7;
}

.income-chart {
    position: relative;
    min-height: 260px;
}

.chart-tick {
    font-size: 11px;
    fill: #898781;
    font-variant-numeric: tabular-nums;
}

.chart-hit {
    fill: transparent;
    cursor: default;
    outline: none;
}

.chart-hit:hover,
.chart-hit:focus {
    fill: rgba(11, 11, 11, 0.04);
}

.chart-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #52514e;
}

.chart-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 0.35rem;
    vertical-align: -1px;
}

.chart-tip {
    position: absolute;
    top: 0;
    background: #fff;
    border: 1px solid rgba(11, 11, 11, 0.10);
    border-radius: 0.5rem;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    pointer-events: none;
    white-space: nowrap;
}

.chart-tip-title {
    color: #52514e;
    margin-bottom: 0.25rem;
}

.chart-tip-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-tip-key {
    width: 12px;
    height: 2px;
    background: transparent;
}

.chart-tip-name {
    color: #52514e;
}

.numbers-table td {
    font-variant-numeric: tabular-nums;
}

/* Tooth chart (static/js/tooth-chart.js) */
.tooth-chart {
    border: 1px solid #e6dce4;
    border-radius: 0.75rem;
    padding: 0.75rem;
    background: #fff;
}

.tooth-chart-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.tooth-sides {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #8a7d88;
}

.tooth-arches {
    max-width: 640px;
    margin: 0 auto;
}

.tooth-row {
    display: flex;
    gap: 2px;
}

/* the line between upper and lower teeth */
.tooth-row + .tooth-row {
    border-top: 2px solid #e6dce4;
    margin-top: 4px;
    padding-top: 4px;
}

.tooth {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 2px 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
}

/* the line between the patient's right and left */
.tooth.midline {
    margin-left: 6px;
    box-shadow: -4px 0 0 -2px #e6dce4;
}

.tooth svg {
    width: 100%;
    max-width: 34px;
    height: auto;
}

.tooth path {
    fill: #fbf8f2;
    stroke: #b8aab4;
    stroke-width: 1.5;
    transition: fill 0.12s, stroke 0.12s;
}

.tooth-no {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c6170;
    font-variant-numeric: tabular-nums;
}

.tooth:hover path {
    fill: #f1e6ef;
    stroke: var(--brand-plum);
}

.tooth.selected path {
    fill: var(--brand-plum);
    stroke: var(--brand-plum-dark);
}

.tooth.selected .tooth-no {
    color: var(--brand-plum);
}

.tooth:focus-visible {
    outline: 2px solid var(--brand-orange);
    outline-offset: 1px;
}

.tooth-picked {
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.coming-soon {
    background: #f1e6ef;
    color: var(--brand-plum);
    font-weight: 500;
}
