/* ── FEAT-107 Phase 3b — Puspakom Results review screen ─────────────────── */

/* Page container */
.psr-page {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Status bar */
.psr-status-bar {
    font-size: 13px;
    color: #9aa3b5;
    margin-bottom: 16px;
    padding: 6px 10px;
    background: #1e2537;
    border-radius: 4px;
    border-left: 3px solid #4a90d9;
}

/* Actions row */
.psr-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.psr-filter-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.psr-filter-label {
    color: #9aa3b5;
    font-size: 13px;
    white-space: nowrap;
}

.psr-filter-dropdown {
    min-width: 180px;
    color: #1a1f2e;
}

/* Buttons */
.psr-refresh-btn,
.psr-sync-btn,
.psr-reconnect-btn,
.psr-action-btn {
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: bold;
    transition: background 0.15s;
}

.psr-refresh-btn:hover,
.psr-sync-btn:hover,
.psr-reconnect-btn:hover,
.psr-action-btn:hover {
    background: #3a7fd9;
}

.psr-sync-btn {
    background: #28a745;
}

.psr-sync-btn:hover {
    background: #218838;
}

.psr-reconnect-btn {
    background: #6b7488;
}

.psr-reconnect-btn:hover {
    background: #5a6480;
}

.psr-cancel-btn {
    background: #6b7488;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    cursor: pointer;
    font-size: 13px;
}

.psr-cancel-btn:hover {
    background: #5a6480;
}

.psr-confirm-btn {
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    margin-right: 6px;
    transition: background 0.15s;
}

.psr-confirm-btn:hover {
    background: #218838;
}

.psr-reject-btn {
    background: #dc3545;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    transition: background 0.15s;
}

.psr-reject-btn:hover {
    background: #c82333;
}

.psr-pdf-btn {
    display: inline-block;
    background: transparent;
    color: #9aa3b5;
    border: 1px solid #4a5268;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: normal;
    text-decoration: none;
    margin-left: 6px;
    transition: border-color 0.15s, color 0.15s;
}

.psr-pdf-btn:hover {
    border-color: #7a8aaa;
    color: #c0c6d4;
    text-decoration: none;
}

body[data-theme="light"] .psr-pdf-btn {
    color: #6b7280;
    border-color: #b0bac8;
}

body[data-theme="light"] .psr-pdf-btn:hover {
    border-color: #8a95aa;
    color: #1a202c;
}

/* Action status */
.psr-action-status {
    min-height: 24px;
    font-size: 13px;
    color: #9aa3b5;
    margin-bottom: 10px;
}

/* Table */
.psr-table-wrap {
    overflow-x: auto;
}

.psr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.psr-empty {
    color: #9aa3b5;
    padding: 24px;
    text-align: center;
    background: #252b3b;
    border-radius: 6px;
}

/* Re-connect card */
.psr-reconnect-card {
    background: #252b3b;
    border: 1px solid #3a4252;
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 560px;
    margin-top: 16px;
}

.psr-card-title {
    color: #e8eaf0;
    font-size: 15px;
    font-weight: bold;
    margin-bottom: 10px;
}

.psr-reconnect-hint {
    color: #9aa3b5;
    font-size: 13px;
    margin-bottom: 14px;
}

.psr-code-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.psr-code-label {
    color: #9aa3b5;
    font-size: 12px;
    white-space: nowrap;
    min-width: 110px;
}

.psr-code-value {
    color: #e8eaf0;
    font-size: 14px;
    background: #1a1f2e;
    padding: 3px 8px;
    border-radius: 4px;
    word-break: break-all;
}

.psr-reconnect-btns {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.psr-reconnect-status {
    margin-top: 10px;
    font-size: 13px;
    color: #9aa3b5;
}

/* ── Busy overlay (FEAT-120) ─────────────────────────────────────────────── */

.psr-section-wrap {
    position: relative;
}

.psr-busy-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 31, 46, 0.82);
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    pointer-events: all;
    border-radius: 6px;
    min-height: 80px;
}

.psr-busy-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid rgba(74, 158, 255, 0.25);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: psr-spin 0.8s linear infinite;
}

@keyframes psr-spin {
    to { transform: rotate(360deg); }
}

.psr-busy-label {
    color: #e8eaf0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

/* ── Edit & Save button (in table actions) ───────────────────────────────── */

.psr-edit-btn {
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    margin-right: 6px;
    transition: background 0.15s;
}

.psr-edit-btn:hover {
    background: #3a7fd9;
}

/* ── Edit & Save modal overlay (BUG-258) ─────────────────────────────────── */

.psr-edit-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
}

.psr-edit-modal {
    background: #252b3b;
    border-radius: 10px;
    padding: 0;
    min-width: 360px;
    max-width: 500px;
    width: 92%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    overflow: hidden;
}

body[data-theme="light"] .psr-edit-modal {
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.psr-edit-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #2d3548;
    flex-shrink: 0;
}

body[data-theme="light"] .psr-edit-modal-header {
    border-bottom-color: #d1d9e0;
}

.psr-edit-modal-title {
    color: #e8eaf0;
    font-size: 15px;
    font-weight: bold;
}

body[data-theme="light"] .psr-edit-modal-title {
    color: #1a202c;
}

.psr-edit-modal-close-btn {
    background: transparent;
    border: none;
    color: #9aa3b5;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    line-height: 1;
    transition: background 0.15s, color 0.15s;
}

.psr-edit-modal-close-btn:hover {
    background: #3a4252;
    color: #e8eaf0;
}

body[data-theme="light"] .psr-edit-modal-close-btn:hover {
    background: #e2e8f0;
    color: #1a202c;
}

.psr-edit-modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.psr-edit-modal-status {
    min-height: 18px;
    font-size: 12px;
    color: #dc3545;
    margin-bottom: 10px;
}

.psr-edit-field-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.psr-edit-label {
    font-size: 12px;
    color: #9aa3b5;
    font-weight: 600;
}

body[data-theme="light"] .psr-edit-label {
    color: #4a5568;
}

.psr-edit-input {
    background: #1a1f2e;
    color: #e8eaf0;
    border: 1px solid #4a5268;
    border-radius: 4px;
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
}

.psr-edit-input:focus {
    outline: none;
    border-color: #4a90d9;
}

/* Dark theme — date input calendar icon */
.psr-edit-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

body[data-theme="light"] .psr-edit-input {
    background: #f7f9fc;
    color: #1a202c;
    border-color: #b0bac8;
}

body[data-theme="light"] .psr-edit-input:focus {
    border-color: #4a90d9;
}

body[data-theme="light"] .psr-edit-input[type="date"]::-webkit-calendar-picker-indicator {
    filter: none;
}

.psr-edit-dropdown {
    font-size: 13px;
    color: #1a1f2e;
}

/* Dark-theme option-list contrast for result dropdown */
body:not([data-theme="light"]) .psr-edit-dropdown .VirtualizedSelectOption {
    background: #1e2537 !important;
    color: #e8eaf0 !important;
}
body:not([data-theme="light"]) .psr-edit-dropdown .VirtualizedSelectFocusedOption {
    background: #2d3548 !important;
    color: #e8eaf0 !important;
}
body:not([data-theme="light"]) .psr-edit-dropdown .VirtualizedSelectSelectedOption {
    background: #3a4a6b !important;
    color: #ffffff !important;
}

.psr-edit-modal-footer {
    display: flex;
    gap: 10px;
    padding: 12px 20px 16px;
    border-top: 1px solid #2d3548;
    flex-shrink: 0;
}

body[data-theme="light"] .psr-edit-modal-footer {
    border-top-color: #d1d9e0;
}

.psr-edit-modal-submit-btn {
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.15s;
}

.psr-edit-modal-submit-btn:hover {
    background: #218838;
}

.psr-edit-modal-cancel-btn {
    background: #6b7488;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.psr-edit-modal-cancel-btn:hover {
    background: #5a6480;
}

/* Mobile */
@media (max-width: 390px) {
    .psr-edit-modal {
        width: 98%;
        min-width: unset;
    }

    .psr-edit-modal-footer {
        flex-direction: column;
    }

    .psr-edit-modal-submit-btn,
    .psr-edit-modal-cancel-btn {
        width: 100%;
    }
}

/* ── Light theme overrides ────────────────────────────────────────────────── */
body[data-theme="light"] .psr-status-bar {
    background: #f0f4f8;
    color: #4a5568;
    border-left-color: #4a90d9;
}

body[data-theme="light"] .psr-empty {
    background: #f7f9fc;
    color: #6b7280;
}

body[data-theme="light"] .psr-reconnect-card {
    background: #f7f9fc;
    border-color: #d1d9e0;
}

body[data-theme="light"] .psr-card-title {
    color: #1a202c;
}

body[data-theme="light"] .psr-reconnect-hint,
body[data-theme="light"] .psr-code-label,
body[data-theme="light"] .psr-reconnect-status,
body[data-theme="light"] .psr-action-status {
    color: #4a5568;
}

body[data-theme="light"] .psr-code-value {
    background: #e8edf2;
    color: #1a202c;
}

body[data-theme="light"] .psr-busy-overlay {
    background: rgba(240, 244, 248, 0.88);
}

body[data-theme="light"] .psr-busy-label {
    color: #1a202c;
}
