/* studyreport.css - StudyReportNext (desktop).
   Everything is scoped under .srn, so the old StudyReport is not affected.
   Phone styles come from StudyReportMobile.js (same class names: sr-dialog, sr-header, sr-body ...). */

.srn.sr-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .35);
    z-index: 10000;
}

/* no z-index here on purpose: MessageDialog (z 1050) is a later sibling and must paint on top */
.srn .sr-dialog {
    position: fixed;
    inset: 1.5vh 1.5vw;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
    display: flex;
    flex-direction: column;
    outline: none;
}

/* ---- header ---- */
.srn .sr-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px 12px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.srn-title {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}

.srn-name {
    font-size: 22px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
}

.srn-sub {
    font-size: 14px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.srn-stat {
    background: #c62828;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 3px 8px;
    border-radius: 4px;
}

.srn-final {
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.srn-spacer {
    flex: 1;
}

/* message button: grey = none, red = unread, green = read */
.srn-msg {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

    .srn-msg.is-unread {
        background: #c62828;
        border-color: #c62828;
        color: #fff;
    }

    .srn-msg.is-read {
        background: #2e7d32;
        border-color: #2e7d32;
        color: #fff;
    }

.srn-close {
    display: none;   /* desktop: footer Cancel/Close replaces it */
    width: 38px;
    height: 38px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #374151;
    font-size: 16px;
    cursor: pointer;
    flex: none;
}

    .srn-msg:hover, .srn-close:hover {
        filter: brightness(.95);
    }

/* ---- body ---- */
.srn .sr-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ---- body layout: side panel + main ---- */
.srn .study-report-container {
    position: relative;   /* phone More sheet is positioned against this */
    display: flex;
    height: 100%;
    min-height: 0;
}

.srn .sidebar {
    flex: 0 0 320px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 18px 20px;
    background: #fafafa;
    border-right: 1px solid #e5e7eb;
    overflow: auto;
}

.srn .main-content {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* collapsible details card */
.srn-card {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
}

.srn-card-pad {
    padding: 12px;
}

.srn-card-head {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .05em;
    color: #6b7280;
    cursor: pointer;
    text-align: left;
}

    .srn-card-head i {
        margin-left: auto;
        font-size: 11px;
        transition: transform .15s;
    }

    .srn-card-head.open i {
        transform: rotate(180deg);
    }

.srn-facts {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    row-gap: 7px;
    column-gap: 10px;
    margin: 0;
    padding: 10px 12px 12px;
    border-top: 1px solid #f0f0f0;
    font-size: 13.5px;
}

    .srn-facts dt {
        color: #6b7280;
    }

    .srn-facts dd {
        margin: 0;
        color: #1f2937;
        overflow-wrap: anywhere;
    }

        .srn-facts dd.strong {
            font-weight: 600;
        }

/* Exam / Clinical History: dark label + dark text, like the old panel */
.srn-label {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.srn-history {
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* template applied */
.srn-template {
    background: #eef5fc;
    border: 1px solid #bbdefb;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1f2937;
}

.srn-template-title {
    font-weight: 600;
    color: #1565c0;
    margin-bottom: 4px;
}

.srn-template-hint {
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
    margin-top: 2px;
}

/* ---- tabs: stretch the active panel to full height ----
   [aria-hidden="false"]: Radzen v11 also renders hidden placeholder panels; only the active one may flex */
.srn .tab-container {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

    .srn .tab-container .rz-tabview,
    .srn .tab-container .rz-tabview-panels,
    .srn .tab-container .rz-tabview-panel[aria-hidden="false"] {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        height: auto !important;
        overflow: hidden !important;
    }

.srn .tab-content {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 12px 4px 4px;
    overflow: hidden;
}

/* ---- report editor ---- */
.srn textarea.report-textarea {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    box-sizing: border-box;
    resize: none;
    padding: 14px 16px;
    line-height: 1.6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

    .srn textarea.report-textarea:focus {
        border-color: #2e7d32;
        box-shadow: 0 0 0 2px rgba(46, 125, 50, .12);
    }

    .srn textarea.report-textarea.validation-warning {
        border-color: #ffc107 !important;
        box-shadow: 0 0 0 2px rgba(255, 193, 7, .15) !important;
    }

    .srn textarea.report-textarea.validation-critical {
        border-color: #dc3545 !important;
        box-shadow: 0 0 0 2px rgba(220, 53, 69, .15) !important;
    }

    .srn textarea.report-textarea.report-finalized {
        background: #f8f9fa !important;
        border-color: #dee2e6 !important;
        color: #495057 !important;
        cursor: default !important;
        caret-color: transparent;
        box-shadow: none !important;
    }

/* ---- footer ---- */
.srn .report-footer {
    flex: 0 0 auto;
    padding: 10px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.srn .button-container {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.srn-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}

    .srn-btn:hover:not(:disabled) {
        background: #f3f4f6;
    }

    .srn-btn:disabled {
        color: #9ca3af;
        cursor: not-allowed;
    }

.srn .font-size-controls {
    display: flex;
    gap: 4px;
}

.srn .font-size-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

    .srn .font-size-btn:hover {
        background: #f3f4f6;
    }

/* Finalize & Fax: brand green, not the orange theme primary.
   Radzen draws borders with an inset box-shadow, so it is cleared. */
.srn .srn-finalize .rz-button {
    height: 40px;
    background: #2e7d32 !important;
    color: #fff !important;
    border: 0 !important;
    box-shadow: none !important;
    font-weight: 600;
}

.srn .srn-finalize .rz-splitbutton-menubutton {
    border-left: 1px solid rgba(255, 255, 255, .35) !important;
}

.srn .srn-finalize .rz-button:hover:not(:disabled) {
    background: #276b2b !important;
}

.srn-btn-dark {
    background: #1f2937;
    border-color: #1f2937;
    color: #fff;
}

    .srn-btn-dark:hover:not(:disabled) {
        background: #111827;
    }

.srn-btn-green {
    background: #2e7d32;
    border-color: #2e7d32;
    color: #fff;
    font-weight: 600;
}

    .srn-btn-green:hover:not(:disabled) {
        background: #276b2b;
    }

/* ---- tabs: grids, documents, AI prelim ---- */
.srn .tab-content .rz-datatable {
    height: 100%;
}

.srn .document-viewer-container,
.srn .two-column-layout {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    width: 100%;
    overflow: hidden;
}

.srn .document-viewer-container {
    flex-direction: column;
}

    .srn .document-viewer-container iframe,
    .srn .right-column iframe {
        flex: 1 1 auto;
        width: 100%;
        height: 100%;
        border: 0;
    }

.srn .left-column {
    flex: 0 0 200px;
    overflow-y: auto;
    border-right: 1px solid #e5e7eb;
    background: #f5f5f5;
}

.srn .right-column {
    flex: 1 1 auto;
    display: flex;
    min-height: 0;
}

.srn .doc-tab {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

    .srn .doc-tab:hover {
        background: #e9ecef;
    }

    .srn .doc-tab.active {
        background: #e9ecef;
        border-right: 3px solid #2e7d32;
        font-weight: 600;
    }

.srn .tab-content.prelim-only {
    overflow-y: auto;
}

.srn .prelim-panel {
    flex: 0 0 auto;
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 10px;
}

.srn .prelim-warnings {
    background: #fff8e1;
    border-left: 4px solid #f0ad4e;
}

.srn .prelim-datagaps {
    background: #eef4fb;
    border-left: 4px solid #5b9bd5;
}

.srn .prelim-panel-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.srn .prelim-scrollbox {
    flex: 0 0 auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-family: ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.srn .prelim-meta {
    flex: 0 0 auto;
    color: #6b7280;
    font-size: .8rem;
    margin-top: 6px;
}

.srn .prelim-clear-link {
    color: #5b9bd5;
    cursor: pointer;
    text-decoration: underline;
}

/* ---- dictation ---- */
.srn-btn-rec {
    background: #fdecec;
    border-color: #f3b8b8;
    color: #b32424;
    font-weight: 600;
}

/* Docked bar at the bottom: does not cover the tabs; transcript scrolls inside */
.srn .dictation-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9000;
    display: flex;
    justify-content: flex-start;
    pointer-events: none;
    padding: 0 12px 12px 12px;
}

.srn .dictation-panel {
    pointer-events: auto;
    width: min(900px, 96vw);
    max-height: 40vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px 10px 0 0;
    box-shadow: 0 -6px 24px rgba(0, 0, 0, .18);
    overflow: hidden;
}

.srn .dictation-header {
    font-weight: 600;
}

.srn .dictation-status.recording { color: #dc2626; }
.srn .dictation-status.processing { color: #2563eb; }
.srn .dictation-status.paused { color: #b45309; }
.srn .dictation-status.review { color: #15803d; }

.srn .dictation-canvas {
    flex: 0 0 auto;
    width: 100%;
    height: 80px;
    background: #1e1e1e;
    border-radius: 4px;
}

.srn .dictation-transcript {
    flex: 1 1 auto;
    width: 100%;
    min-height: 64px;
    max-height: 24vh;
    overflow-y: auto;
    padding: 8px;
    border: 1px solid #d4d4d8;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.srn .dictation-error {
    padding: 8px;
    border-radius: 4px;
    background: #fef2f2;
    color: #b91c1c;
}

.srn .dictation-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ---- phone: name over sub-line, icon-only message button ---- */
@media (max-width: 768px) {
    /* StudyReportMobile.js zeroes the sidebar padding; give the expanded panel some room */
    .srn .sidebar-collapsible.expanded {
        gap: 12px;
        padding: 10px 12px;
    }

    .srn .sidebar .validation-panel {
        margin: 6px 10px;
    }

    .srn .sr-header {
        gap: 8px;
    }

    .srn-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .srn-name {
        font-size: 16px;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .srn-sub {
        font-size: 12px;
        max-width: 100%;
    }

    .srn-msg span {
        display: none;
    }

    .srn-msg, .srn-close {
        width: 44px;
        height: 44px;
        padding: 0;
        justify-content: center;
    }

    .srn-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
