/* Shared clinical visit footer (all practice specialties) */

.practice-form-shell {
    --pf-clinical-accent: #0d6efd;
    --pf-clinical-radius: 10px;
}

.pf-clinical-visit-footer {
    width: 100%;
}

.pf-field-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.4rem;
}

.pf-current-medications {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--pf-clinical-radius);
    padding: 0.85rem 1rem;
}

.pf-current-med-line {
    font-size: 0.95rem;
    line-height: 1.45;
    color: #1e293b;
    padding: 0.5rem 0.65rem;
    background: #fff;
    border-radius: 8px;
    border-left: 3px solid var(--pf-clinical-accent);
    margin-bottom: 0.5rem;
}

.pf-current-med-line:last-child {
    margin-bottom: 0;
}

.pf-current-meds-empty {
    font-style: italic;
}

.pf-prescription-stack,
.consultation-prescription-stack {
    position: relative;
    z-index: 30;
}

/* TomSelect appended to body — above sticky save visit bar (z-index 200) */
body > .ts-dropdown {
    z-index: 10050 !important;
}

body > .ts-dropdown .ts-dropdown-content {
    max-height: min(280px, calc(100vh - 10rem));
}

.pf-prescription-stack .table-responsive:has(#pfPrescriptionTable) {
    overflow: visible !important;
}

#pfPrescriptionTable .ts-wrapper { min-width: 180px; position: relative; z-index: 42; }
#pfPrescriptionTable .ts-control { font-size: 13px; min-height: 30px; padding: 2px 8px; }
#pfPrescriptionTable .ts-dropdown { font-size: 13px; z-index: 5000 !important; position: absolute !important; }
#pfPrescriptionTable { overflow: visible !important; }
#pfPrescriptionTable td { overflow: visible !important; }
.table-responsive:has(#pfPrescriptionTable) { overflow: visible !important; }
#pfPrescriptionCardsMobile .ts-wrapper { min-width: 100%; position: relative; }
#pfPrescriptionCardsMobile .ts-control { font-size: 13px; min-height: 38px; padding: 4px 10px; }
#pfPrescriptionCardsMobile .ts-dropdown { font-size: 13px; z-index: 9999 !important; position: absolute !important; }
#pfPrescriptionCardsMobile { overflow: visible !important; }

/* Collapsible dosage column (practice prescription table) */
#pfPrescriptionTable.rx-dosage-hidden .rx-col-dosage,
#pfPrescriptionCardsMobile.rx-dosage-hidden .rx-col-dosage {
    display: none !important;
}

.rx-drug-cell-wrap .ts-wrapper,
.rx-drug-cell-wrap .form-select {
    width: 100%;
    min-width: 0;
}

.rx-dosage-toggle-btn {
    min-width: 1.75rem;
    min-height: 1.75rem;
    line-height: 1;
    padding: 0.15rem 0.35rem;
}

.pf-summary-card textarea {
    min-height: 72px;
    font-size: 0.95rem;
    border-radius: var(--pf-clinical-radius);
}

.pf-clinical-sticky-bar,
.pf-save-visit-row {
    position: sticky;
    bottom: 0;
    z-index: 20;
    background: linear-gradient(180deg, transparent 0%, #fff 24%);
    padding: 0.75rem 0 0.25rem;
}

.pf-practice-footer-toolbar {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.pf-practice-footer-toolbar .pf-footer-meta {
    font-size: 0.8125rem;
}

.pf-practice-footer .pf-save-visit-row {
    position: static;
    z-index: auto;
    background: transparent;
    padding: 0;
    margin: 0;
    width: auto;
    flex: 0 0 auto;
    gap: 0.5rem;
}

.pf-practice-footer .pf-save-visit-status {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 0;
    max-width: 12rem;
}

.pf-practice-footer .pf-save-visit-status-text {
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pf-practice-footer .pf-save-visit-btn {
    flex: 0 0 auto;
    max-width: none;
    width: auto;
    margin-left: 0;
    min-height: 0;
    white-space: nowrap;
    font-weight: 600;
}

.pf-save-visit-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.pf-save-visit-status {
    flex: 1 1 50%;
    min-width: 0;
    display: flex;
    align-items: center;
    min-height: 2.5rem;
}

.pf-save-visit-status-text {
    font-size: 0.875rem;
    line-height: 1.35;
    color: #64748b;
}

.pf-save-visit-status.is-saving .pf-save-visit-status-text {
    color: #0d6efd;
}

.pf-save-visit-status.is-saving .pf-save-visit-status-text::before {
    content: '';
    display: inline-block;
    width: 0.9rem;
    height: 0.9rem;
    margin-right: 0.4rem;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -0.15em;
    animation: pf-save-spin 0.65s linear infinite;
}

.pf-save-visit-status.is-success .pf-save-visit-status-text {
    color: #198754;
    font-weight: 500;
}

.pf-save-visit-status.is-error .pf-save-visit-status-text {
    color: #dc3545;
    font-weight: 500;
}

.pf-save-visit-btn {
    flex: 0 0 50%;
    max-width: 50%;
    margin-left: auto;
    min-height: 2.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
}

@keyframes pf-save-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767.98px) {
    .pf-clinical-sticky-bar,
    .pf-save-visit-row {
        margin-left: -0.25rem;
        margin-right: -0.25rem;
    }

    .pf-save-visit-status-text {
        font-size: 0.8125rem;
    }
}
