/* ── FEAT-122 Phase 2 — Puspakom Manager Console ─────────────────────────── */

.psc-page {
    padding: 24px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Header */
.psc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 10px;
}

.psc-page-title {
    font-size: 20px;
    font-weight: bold;
    color: #e8eaf0;
}

body[data-theme="light"] .psc-page-title {
    color: #1a202c;
}

/* Filter bar */
.psc-filter-bar {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    align-items: flex-end;
}

.psc-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 160px;
}

.psc-filter-label {
    font-size: 12px;
    color: #9aa3b5;
    white-space: nowrap;
}

.psc-dropdown {
    min-width: 160px;
    color: #1a1f2e;
}

/* HiStore banner */
.psc-histore-banner {
    background: #dc354522;
    border: 1px solid #dc354555;
    border-left: 3px solid #dc3545;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    color: #e8eaf0;
    margin-bottom: 12px;
}

body[data-theme="light"] .psc-histore-banner {
    background: #fff0f2;
    color: #7b2034;
    border-left-color: #dc3545;
}

/* Capacity banner */
.psc-capacity-banner {
    font-size: 13px;
    color: #9aa3b5;
    margin-bottom: 16px;
    padding: 8px 12px;
    background: #1e2537;
    border-radius: 4px;
    border-left: 3px solid #4a90d9;
}

body[data-theme="light"] .psc-capacity-banner {
    background: #f0f4f8;
    color: #4a5568;
    border-left-color: #4a90d9;
}

/* Action status */
.psc-action-status {
    min-height: 22px;
    font-size: 13px;
    color: #9aa3b5;
    margin-bottom: 10px;
}

/* Section wrap (for busy overlay positioning) */
.psc-section-wrap {
    position: relative;
}

/* Section headings */
.psc-section-title {
    font-size: 15px;
    font-weight: bold;
    color: #e8eaf0;
    margin-bottom: 4px;
    margin-top: 12px;
}

body[data-theme="light"] .psc-section-title {
    color: #1a202c;
}

.psc-q0-title {
    color: #dc3545;
}

body[data-theme="light"] .psc-q0-title {
    color: #c0392b;
}

.psc-section-hint {
    font-size: 12px;
    color: #9aa3b5;
    margin-bottom: 10px;
}

.psc-divider {
    border-color: #2d3548;
    margin: 24px 0;
}

body[data-theme="light"] .psc-divider {
    border-color: #d1d9e0;
}

/* Table */
.psc-table-wrap {
    overflow-x: auto;
    margin-bottom: 8px;
}

.psc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.psc-empty {
    color: #9aa3b5;
    padding: 24px;
    text-align: center;
    background: #252b3b;
    border-radius: 6px;
}

body[data-theme="light"] .psc-empty {
    background: #f7f9fc;
    color: #6b7280;
}

/* Buttons */
.psc-refresh-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;
}

.psc-refresh-btn:hover {
    background: #3a7fd9;
}

.psc-raise-btn {
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
    transition: background 0.15s;
}

.psc-raise-btn:hover {
    background: #218838;
}

.psc-action-dropdown {
    font-size: 12px;
}

/* Modal overlay */
.psc-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;
}

.psc-modal-box {
    background: #252b3b;
    border-radius: 10px;
    padding: 24px 32px;
    min-width: 340px;
    max-width: 460px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.55);
}

body[data-theme="light"] .psc-modal-box {
    background: #ffffff;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.psc-modal-title {
    color: #e8eaf0;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 14px;
}

body[data-theme="light"] .psc-modal-title {
    color: #1a202c;
}

.psc-modal-input {
    background: #1a1f2e;
    color: #e8eaf0;
    border: 1px solid #4a90d9;
    border-radius: 4px;
    padding: 7px 10px;
    width: 100%;
    font-size: 13px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

body[data-theme="light"] .psc-modal-input {
    background: #f7f9fc;
    color: #1a202c;
    border-color: #4a90d9;
}

.psc-modal-btns {
    display: flex;
    gap: 10px;
}

.psc-btn-confirm {
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 13px;
    transition: background 0.15s;
}

.psc-btn-confirm:hover {
    background: #218838;
}

.psc-btn-cancel {
    background: #6b7488;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.15s;
}

.psc-btn-cancel:hover {
    background: #5a6480;
}

/* Busy overlay (FEAT-120 pattern) */
.psc-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;
}

.psc-busy-spinner {
    width: 36px;
    height: 36px;
    border: 4px solid rgba(74, 158, 255, 0.25);
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: psc-spin 0.8s linear infinite;
}

@keyframes psc-spin {
    to { transform: rotate(360deg); }
}

.psc-busy-label {
    color: #e8eaf0;
    font-size: 14px;
    font-weight: bold;
    letter-spacing: 0.02em;
}

body[data-theme="light"] .psc-busy-overlay {
    background: rgba(240, 244, 248, 0.88);
}

body[data-theme="light"] .psc-busy-label {
    color: #1a202c;
}

/* ── Raise Work Request modal (FEAT-123) ─────────────────────────────────── */

.psc-raise-modal-box {
    min-width: 380px;
    max-width: 520px;
}

.psc-raise-modal-info {
    font-size: 12px;
    color: #9aa3b5;
    margin-bottom: 14px;
    padding: 6px 10px;
    background: #1a1f2e;
    border-radius: 4px;
    border-left: 3px solid #4a90d9;
}

body[data-theme="light"] .psc-raise-modal-info {
    background: #f0f4f8;
    color: #4a5568;
}

.psc-raise-modal-fields {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 12px;
}

.psc-raise-label {
    font-size: 11px;
    color: #9aa3b5;
    margin-top: 8px;
    margin-bottom: 2px;
}

body[data-theme="light"] .psc-raise-label {
    color: #4a5568;
}

.psc-raise-dropdown {
    font-size: 13px;
    color: #1a1f2e;
}

/* Dark-theme option-list contrast fix — the global VirtualizedSelect rules (style-02-theme.css)
   only cover the focused/selected states, not the base option row; every other page using this
   dropdown component (service-booking, logs, pnl-report) needed the same page-scoped fix. */
body:not([data-theme="light"]) .psc-raise-dropdown .VirtualizedSelectOption {
    background: #1e2537 !important;
    color: #e8eaf0 !important;
}
body:not([data-theme="light"]) .psc-raise-dropdown .VirtualizedSelectFocusedOption {
    background: #2d3548 !important;
    color: #e8eaf0 !important;
}
body:not([data-theme="light"]) .psc-raise-dropdown .VirtualizedSelectSelectedOption {
    background: #3a4a6b !important;
    color: #ffffff !important;
}

.psc-raise-textarea {
    background: #1a1f2e;
    color: #e8eaf0;
    border: 1px solid #4a90d9;
    border-radius: 4px;
    padding: 7px 10px;
    width: 100%;
    font-size: 13px;
    min-height: 70px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
}

body[data-theme="light"] .psc-raise-textarea {
    background: #f7f9fc;
    color: #1a202c;
    border-color: #4a90d9;
}

.psc-raise-modal-status {
    min-height: 18px;
    font-size: 12px;
    color: #dc3545;
    margin-bottom: 10px;
}

/* ── FEAT-130 — Timeline slide-in button ─────────────────────────────────── */

.psc-timeline-btn {
    background: #3a4a6b;
    color: #7ab4ff;
    border: 1px solid #4a5a8b;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 11px;
    margin-top: 4px;
    white-space: nowrap;
    transition: background 0.15s;
}

.psc-timeline-btn:hover {
    background: #4a5a8b;
}

body[data-theme="light"] .psc-timeline-btn {
    background: #e8f0fe;
    color: #2a5db0;
    border-color: #b0c8f8;
}

body[data-theme="light"] .psc-timeline-btn:hover {
    background: #d0e4fe;
}

/* ── FEAT-130 — KPI section ──────────────────────────────────────────────── */

.psc-kpi-section {
    margin-top: 8px;
}

.psc-kpi-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 14px;
}

.psc-kpi-header-right {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.psc-kpi-toggle-btn {
    background: #2d3548;
    color: #9aa3b5;
    border: 1px solid #3a4560;
    border-radius: 4px;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    transition: background 0.15s;
    align-self: flex-end;
}

.psc-kpi-toggle-btn:hover {
    background: #3a4560;
    color: #e8eaf0;
}

body[data-theme="light"] .psc-kpi-toggle-btn {
    background: #f0f4f8;
    color: #4a5568;
    border-color: #d1d9e0;
}

body[data-theme="light"] .psc-kpi-toggle-btn:hover {
    background: #e2e8f0;
}

.psc-kpi-body {
    animation: psc-fadein 0.2s ease;
}

@keyframes psc-fadein {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.psc-kpi-subsection-title {
    font-size: 12px;
    font-weight: bold;
    color: #4a90d9;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

body[data-theme="light"] .psc-kpi-subsection-title {
    color: #2563eb;
}

/* Stage duration cards */
.psc-kpi-cards-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.psc-kpi-card {
    background: #1e2537;
    border: 1px solid #2d3548;
    border-left: 3px solid #4a90d9;
    border-radius: 6px;
    padding: 12px 16px;
    min-width: 160px;
    flex: 1;
}

body[data-theme="light"] .psc-kpi-card {
    background: #f0f4f8;
    border-color: #d1d9e0;
    border-left-color: #4a90d9;
}

.psc-kpi-card-label {
    font-size: 11px;
    color: #9aa3b5;
    margin-bottom: 8px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body[data-theme="light"] .psc-kpi-card-label {
    color: #6b7280;
}

.psc-kpi-card-value {
    font-size: 18px;
    font-weight: bold;
    color: #5ec97e;
}

body[data-theme="light"] .psc-kpi-card-value {
    color: #16a34a;
}

/* ── BUG-240 + FEAT-132 — Status count summary badges ───────────────────── */

.psc-kpi-status-summary-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.psc-kpi-status-badge {
    background: #1e2537;
    border: 1px solid #2d3548;
    border-radius: 8px;
    padding: 12px 18px;
    text-align: center;
    min-width: 100px;
    flex: 1;
}

body[data-theme="light"] .psc-kpi-status-badge {
    background: #f0f4f8;
    border-color: #d1d9e0;
}

/* ── FEAT-151 — Q0 stale data group (collapsed details) ─────────────────── */

.psc-stale-group {
    margin-top: 16px;
    border: 1px solid #3a4560;
    border-radius: 6px;
    background: #1a1f2e;
}

body[data-theme="light"] .psc-stale-group {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.psc-stale-summary {
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    color: #9aa3b5;
    font-weight: 600;
    user-select: none;
    list-style: none;
}

.psc-stale-summary::-webkit-details-marker {
    display: none;
}

.psc-stale-summary::before {
    content: '▶ ';
    font-size: 10px;
    margin-right: 4px;
}

details[open] > .psc-stale-summary::before {
    content: '▼ ';
}

body[data-theme="light"] .psc-stale-summary {
    color: #6b7280;
}

.psc-stale-group > div {
    padding: 0 12px 12px;
}

/* Mobile */
@media (max-width: 390px) {
    .psc-filter-bar {
        flex-direction: column;
    }

    .psc-filter-group {
        width: 100%;
    }

    .psc-dropdown {
        width: 100%;
    }

    .psc-page {
        padding: 12px;
    }

    .psc-kpi-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .psc-kpi-card {
        min-width: 100%;
    }

    .psc-kpi-status-badge {
        min-width: 100%;
    }
}
