/* Clinical Note Amendment & Addendum styling.
   Pairs with /js/modules/clinicalnotes/AmendmentAddendumModule.js

   Color scheme (no yellow): indigo = amendment/primary, teal = addendum,
   slate = original, green = current. */

/* ── Wide modal: View Clinical Notes + amend/addendum modals ──────────────── */
.amend-wide-modal,
#tabbedClinicalNoteModal .modal-dialog {
    max-width: 92vw;
}

#tabbedClinicalNoteModal .modal-content,
.amend-wide-modal .modal-content {
    height: 90vh;
}

/* ── Two-column signed-note layout ────────────────────────────────────────── */
.amend-layout {
    display: block;
}

.amend-layout.amend-has-activity {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.amend-layout.amend-has-activity .amend-note-main {
    flex: 1 1 auto;
    min-width: 0;
}

.amend-layout.amend-has-activity .amend-activity-pane {
    flex: 0 0 340px;
    max-width: 340px;
}

/* ── Version bar (above the note content) ─────────────────────────────────── */
.amend-version-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0.85rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.amend-version-bar.bar-current {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    justify-content: flex-start;
}

.amend-version-bar.bar-historical {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
}

/* ── NOTE ACTIVITY sidebar ────────────────────────────────────────────────── */
.amend-activity-pane {
    background: #fafbfd;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.85rem;
    max-height: 72vh;
    overflow-y: auto;
}

.amend-activity-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #6b7280;
    margin-bottom: 0.75rem;
}

.amend-activity-count {
    background: #e0e7ff;
    color: #3730a3;
    border-radius: 999px;
    padding: 0.05rem 0.5rem;
    font-size: 0.7rem;
}

.amend-activity-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* ── Timeline cards ───────────────────────────────────────────────────────── */
.amend-tl-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-left-width: 4px;
    border-radius: 0.4rem;
    padding: 0.6rem 0.7rem;
    transition: box-shadow 0.12s ease, background 0.12s ease;
}

.amend-tl-card[role="button"] {
    cursor: pointer;
}

.amend-tl-card[role="button"]:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.amend-tl-card.card-original { border-left-color: #94a3b8; }
.amend-tl-card.card-amendment { border-left-color: #6366f1; }
.amend-tl-card.card-addendum { border-left-color: #14b8a6; }

.amend-tl-card.active {
    background: #eef2ff;
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1 inset;
}

.amend-tl-row1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.35rem;
}

.amend-tl-date {
    font-size: 0.78rem;
    color: #374151;
}

.amend-tl-who {
    font-size: 0.78rem;
    color: #6b7280;
}

.amend-tl-reason {
    margin-top: 0.3rem;
    font-size: 0.8rem;
    color: #1f2937;
    background: #f8f9fa;
    border-radius: 0.3rem;
    padding: 0.3rem 0.45rem;
}

.amend-tl-reason-label {
    font-weight: 600;
    color: #6b7280;
}

/* ── Pills ────────────────────────────────────────────────────────────────── */
.amend-pill {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.amend-pill.pill-original { background: #e2e8f0; color: #334155; }
.amend-pill.pill-amendment { background: #e0e7ff; color: #3730a3; }
.amend-pill.pill-addendum { background: #ccfbf1; color: #0f766e; }
.amend-pill.pill-current { background: #d1fae5; color: #065f46; }
.amend-pill.pill-viewing { background: #6366f1; color: #fff; }

/* ── Countdown badge (indigo, not yellow) ─────────────────────────────────── */
.amend-countdown-badge {
    display: inline-block;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
}

/* ── Addendum blocks (below note content, current view only) ──────────────── */
.amend-addendums {
    margin-top: 1rem;
}

.amend-addendum-block {
    background: #f0fdfa;
    border-left: 4px solid #14b8a6;
    border-radius: 0.4rem;
    padding: 0.6rem 0.75rem;
    margin-top: 0.6rem;
    transition: box-shadow 0.2s ease, background 0.2s ease;
}

/* Flash when jumped to from an addendum activity card */
.amend-addendum-block.amend-addendum-flash {
    background: #ccfbf1;
    box-shadow: 0 0 0 2px #14b8a6;
}

.amend-addendum-head {
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-size: 0.72rem;
    color: #0f766e;
}

.amend-addendum-reason {
    font-size: 0.82rem;
    color: #6b7280;
}

/* ── Modals ───────────────────────────────────────────────────────────────── */
.amend-modal-header {
    border-bottom: 2px solid #6366f1;
}

.addendum-modal-header {
    border-bottom: 2px solid #14b8a6;
}

.amend-info-banner {
    border-left: 4px solid var(--bs-info, #0dcaf0);
}

/* Trumbowyg invalid-state border for inline validation */
.amend-editor-invalid.trumbowyg-box {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.15);
}

/* ── Responsive: stack the sidebar under the note on narrow screens ───────── */
@media (max-width: 991.98px) {
    .amend-layout.amend-has-activity {
        flex-direction: column;
    }
    .amend-layout.amend-has-activity .amend-activity-pane {
        flex-basis: auto;
        max-width: none;
        width: 100%;
    }
}
