﻿/* ==========================================================================
   Appointments
   ========================================================================== */

.appt-layout { display: flex; gap: 10px; align-items: flex-start; }
.appt-left { flex: 1 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.appt-right { flex: 0 0 480px; display: flex; flex-direction: column; gap: 8px; }

@media (max-width: 1180px) {
    .appt-layout { flex-direction: column; }
    .appt-right { flex: 1 1 auto; width: 100%; }
}

/* -- three month calendars ----------------------------------------------- */

.appt-calendars { display: flex; gap: 10px; align-items: flex-start; }

.cal { width: 168px; flex-shrink: 0; }

.cal-head {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
}

.cal-month { min-width: 62px; text-align: center; }
.cal-year { color: var(--ink-muted); }

.cal-arrow {
    width: 14px;
    height: 14px;
    padding: 0;
    background: none;
    border: none;
    color: #2f6ea5;
    font-size: 9px;
    line-height: 1;
}

.cal-arrow:hover { color: var(--brand-blue); }
.cal-arrow-space { width: 14px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 0; }

.cal-dow {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--ink-muted);
    padding: 2px 0;
}

.cal-day {
    height: 18px;
    padding: 0;
    background: none;
    border: 1px solid transparent;
    font-size: 11px;
    color: var(--ink);
    line-height: 1;
}

.cal-day:hover { background: #dcecf8; }
.cal-day-outside { color: #c3ccd4; }
.cal-day-weekend { color: var(--brand-red); }
.cal-day-outside.cal-day-weekend { color: #e3b4ae; }

.cal-day-selected {
    background: #2f6ea5;
    border-color: #1c5f9e;
    color: #fff;
    font-weight: 700;
}

/* -- go to --------------------------------------------------------------- */

.appt-goto {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding-left: 6px;
    border-left: 1px solid #d7e2ea;
    min-width: 62px;
}

.appt-goto-title { font-size: 11px; font-weight: 700; color: var(--ink-muted); margin-bottom: 2px; }
.appt-goto-row { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.appt-goto-input { width: 46px; height: 19px; margin-top: 3px; border: 1px solid var(--input-border); font-size: 11px; padding: 0 4px; }

.appt-goto-btn {
    margin-top: 3px;
    padding: 2px 10px;
    background: linear-gradient(#ffffff, #eef3f7);
    border: 1px solid #b9c6d2;
    border-radius: 3px;
    font-size: 11px;
}

.appt-goto-btn:hover { background: linear-gradient(#ffffff, #e0e9f1); }

/* -- department / clinic selector ---------------------------------------- */

.appt-selector { display: flex; gap: 12px; align-items: center; }
.appt-selector-fields { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.appt-select { flex: 1; min-width: 0; }

.appt-ok {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: 74px;
    height: 62px;
    background: linear-gradient(#ffffff, #eef3f7);
    border: 1px solid #b9c6d2;
    border-radius: 5px;
    font-size: 13px;
}

.appt-ok:hover:not(:disabled) { background: linear-gradient(#ffffff, #e0e9f1); }
.appt-ok:disabled { opacity: 0.45; }

.appt-ok-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #3E9E44;
    color: #fff;
    font-size: 14px;
}

/* -- appointment board --------------------------------------------------- */

.appt-detail-tab {
    align-self: flex-start;
    padding: 3px 12px;
    background: #dcecf8;
    border: 1px solid var(--panel-border);
    border-bottom: none;
    border-radius: 3px 3px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: #14507f;
}

.appt-board {
    display: flex;
    flex-direction: column;
    min-height: 240px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
    margin-top: -9px;
}

.appt-board-caption {
    padding: 3px 8px;
    background: var(--panel-caption);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
    color: #14507f;
    text-align: center;
}

.appt-grid-head, .appt-grid-row { display: flex; }

.appt-grid-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
    color: #2c3e50;
}

.appt-grid-body { flex: 1; overflow-y: auto; max-height: 320px; }

.appt-grid-row { font-size: 12px; border-bottom: 1px solid #eef2f6; cursor: pointer; }
.appt-grid-row:hover { background: #e8f2fa; }
.appt-grid-row-selected { outline: 2px solid #2f6ea5; outline-offset: -2px; }

.ag-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-col-sr { width: 48px; flex-shrink: 0; text-align: right; }
.ag-col-time { width: 78px; flex-shrink: 0; }
.ag-col-mr { width: 132px; flex-shrink: 0; }
.ag-col-name { flex: 1; min-width: 120px; }
.ag-col-remarks { width: 150px; flex-shrink: 0; border-right: none; }

.appt-grid-empty { padding: 20px; font-size: 12px; color: var(--ink-muted); text-align: center; }

/* Status colours are shared by the board rows, the legend and the future appointment list. */
.appt-status-followup { background: #f6cff0; }
.appt-status-arrived { background: #fdf3b6; }
.appt-status-seen { background: #cdeecd; }
.appt-status-cancelled { background: #f7b9ad; }
.appt-status-booked { background: #ffffff; }

.appt-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 4px 2px; font-size: 12px; }
.appt-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.appt-legend-swatch { width: 16px; height: 13px; border: 1px solid #9aa5ad; }

/* -- right hand column --------------------------------------------------- */

.appt-search { display: flex; gap: 10px; align-items: flex-start; }
.appt-search-options { flex: 1; min-width: 0; }

.appt-refresh {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 10px;
    background: linear-gradient(#ffffff, #eef3f7);
    border: 1px solid #b9c6d2;
    border-radius: 4px;
    font-size: 12px;
}

.appt-refresh:hover:not(:disabled) { background: linear-gradient(#ffffff, #e0e9f1); }
.appt-refresh:disabled { opacity: 0.45; }
.appt-refresh-icon { color: #3E9E44; font-size: 15px; }

.appt-lookup { margin-top: 8px; border: 1px solid var(--panel-border); background: var(--surface); }
.appt-lookup-head, .appt-lookup-row { display: flex; }

.appt-lookup-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
}

.appt-lookup-body { max-height: 132px; overflow-y: auto; }
.appt-lookup-row { font-size: 12px; border-bottom: 1px solid #eef2f6; cursor: pointer; }
.appt-lookup-row:hover { background: #e8f2fa; }
.appt-lookup-row-selected { background: #cfe4f5; }

.al-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-col-mr { width: 140px; flex-shrink: 0; }
.al-col-name { flex: 1; min-width: 100px; }
.al-col-city { width: 90px; flex-shrink: 0; }
.al-col-contact { width: 150px; flex-shrink: 0; border-right: none; }

.appt-remarks-row { display: flex; align-items: center; gap: 6px; }

.appt-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 26px;
    padding: 3px;
    background: linear-gradient(#ffffff, #eef3f7);
    border: 1px solid #b9c6d2;
    border-radius: 4px;
}

.appt-icon-btn:hover:not(:disabled) { background: linear-gradient(#ffffff, #e0e9f1); }
.appt-icon-btn:disabled { opacity: 0.4; }
.appt-icon-btn svg { width: 16px; height: 16px; }

.appt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.appt-actions .toolbar-btn { height: 40px; flex-direction: column; gap: 1px; padding: 0 8px; font-size: 11px; }
.appt-actions .toolbar-btn-icon { width: 16px; height: 16px; }

.appt-temp { display: flex; gap: 8px; align-items: flex-start; }
.appt-temp-fields { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.appt-temp-buttons { display: flex; flex-direction: column; gap: 4px; }

.appt-status-strip {
    padding: 3px 8px;
    background: var(--brand-green);
    color: #fff;
    font-size: 11px;
}

/* -- future appointments ------------------------------------------------- */

.future-top { display: flex; gap: 10px; align-items: flex-start; }
.future-left { flex: 1 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.future-right { flex: 0 0 430px; }
.future-lookup { margin-top: 0; }
.future-lookup .appt-lookup-body { max-height: 300px; }

@media (max-width: 1180px) {
    .future-top { flex-direction: column; }
    .future-right { flex: 1 1 auto; width: 100%; }
}

.future-appointments {
    display: flex;
    flex-direction: column;
    min-height: 200px;
    border: 1px solid var(--panel-border);
    background: var(--surface);
}

.fa-head, .fa-row { display: flex; }

.fa-head {
    background: linear-gradient(#f2f6fa, #dfe9f1);
    border-bottom: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 600;
}

.fa-body { flex: 1; overflow-y: auto; max-height: 300px; }
.fa-row { font-size: 12px; border-bottom: 1px solid #eef2f6; }

.fa-col { padding: 3px 6px; border-right: 1px solid #eef2f6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fa-col-date { width: 104px; flex-shrink: 0; }
.fa-col-day { width: 92px; flex-shrink: 0; }
.fa-col-time { width: 84px; flex-shrink: 0; }
.fa-col-clinic { flex: 1; min-width: 140px; }
.fa-col-consultant { width: 180px; flex-shrink: 0; }
.fa-col-booking { width: 108px; flex-shrink: 0; }
.fa-col-entry { width: 150px; flex-shrink: 0; border-right: none; }

/* -- report screens ------------------------------------------------------ */

.report-screen { display: flex; gap: 14px; align-items: stretch; min-height: 520px; padding-bottom: 4px; }
.report-criteria { flex: 0 0 232px; display: flex; flex-direction: column; gap: 10px; }
.report-screen .report-viewer { flex: 1; min-width: 0; }

.report-thumb { border: 1px solid var(--panel-border); background: var(--surface); padding: 2px; }
.report-thumb svg { width: 100%; height: auto; display: block; }

.criteria-row { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.criteria-row:last-child { margin-bottom: 0; }
.criteria-label { width: 46px; font-size: 12px; }
.criteria-row .entry-input { flex: 1; min-width: 0; }
.criteria-select { flex: 1; min-width: 0; }

.criteria-radio { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 3px 0; }

/* A command button, not a panel: 62px tall it read as an empty box the criteria had been
   dropped into, and disabled it looked like dead space rather than a button waiting for a
   selection. */
.report-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    align-self: flex-start;
    min-height: 28px;
    padding: 4px 14px;
    background: linear-gradient(#ffffff, #eef3f7);
    border: 1px solid #b9c6d2;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
}

.report-preview-btn:hover:not(:disabled) { background: linear-gradient(#ffffff, #e0e9f1); }
.report-preview-btn:disabled { opacity: 0.5; cursor: default; }
.report-preview-icon { display: inline-flex; width: 15px; height: 15px; }
.report-preview-icon svg { width: 100%; height: 100%; }

