/* ============================================================
   Psychological Safety Module — Phase 28
   Amy Edmondson 7-question scale
   ============================================================ */

.ps-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #1d1d1f;
}

/* ─── Header ──────────────────────────────────────────────── */
.ps-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.ps-title {
    font-size: 22px;
    font-weight: 700;
    color: #1d1d1f;
    margin: 0 0 4px;
}

.ps-subtitle {
    font-size: 13px;
    color: #6e6e73;
    margin: 0;
}

/* ─── Buttons ─────────────────────────────────────────────── */
.ps-btn {
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.ps-btn-primary {
    background: #0071e3;
    color: white;
}
.ps-btn-primary:hover { background: #0064c8; }
.ps-btn-primary:disabled { background: #c7c7cc; cursor: not-allowed; }

.ps-btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #e5e5e5;
}
.ps-btn-secondary:hover { background: #e5e7eb; }

/* ─── Score Section ───────────────────────────────────────── */
.ps-score-section {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .ps-score-section { grid-template-columns: 1fr; }
}

.ps-score-card {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    padding: 28px 24px;
    text-align: center;
    border-top: 4px solid #e5e5e5;
}

.ps-score-high { border-top-color: #34c759; }
.ps-score-medium { border-top-color: #ff9500; }
.ps-score-low { border-top-color: #ff3b30; }

.ps-score-number {
    font-size: 64px;
    font-weight: 800;
    line-height: 1;
    color: #1d1d1f;
}

.ps-score-max {
    font-size: 14px;
    color: #8e8e93;
    margin: 2px 0 8px;
}

.ps-score-level {
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1f;
    margin-bottom: 12px;
}

.ps-score-bar-wrap { margin: 0 auto 12px; max-width: 220px; }

.ps-score-bar {
    height: 8px;
    background: #f0f0f5;
    border-radius: 4px;
    overflow: hidden;
}

.ps-score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.ps-score-desc {
    font-size: 13px;
    color: #6e6e73;
    line-height: 1.5;
}

/* Score meta sidebar */
.ps-score-meta {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ps-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f5f5f7;
}
.ps-meta-row:last-of-type { border-bottom: none; padding-bottom: 0; }

.ps-meta-label { color: #6e6e73; }
.ps-meta-value { font-weight: 600; color: #1d1d1f; }

/* ─── Empty State ─────────────────────────────────────────── */
.ps-empty-state {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    margin-bottom: 24px;
}

.ps-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.ps-empty-title {
    font-size: 20px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 8px;
}

.ps-empty-desc {
    color: #6e6e73;
    font-size: 14px;
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto 20px;
}

/* ─── Question Breakdown ──────────────────────────────────── */
.ps-breakdown {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.ps-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 16px;
}

.ps-questions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ps-q-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.ps-q-num {
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: #f0f0f5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #6e6e73;
    margin-top: 2px;
}

.ps-q-content { flex: 1; }

.ps-q-text {
    font-size: 13px;
    color: #3c3c43;
    margin-bottom: 6px;
    line-height: 1.4;
}

.ps-reverse-tag {
    display: inline-block;
    font-size: 10px;
    color: #8e8e93;
    background: #f0f0f5;
    border-radius: 4px;
    padding: 1px 6px;
    margin-left: 4px;
    vertical-align: middle;
}

.ps-q-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ps-q-bar {
    flex: 1;
    height: 6px;
    background: #f0f0f5;
    border-radius: 3px;
    overflow: hidden;
}

.ps-q-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.ps-q-score {
    font-size: 13px;
    font-weight: 700;
    min-width: 28px;
    text-align: right;
}

/* ─── Info Box ────────────────────────────────────────────── */
.ps-info-box {
    background: #f0f6ff;
    border: 1px solid #c0d8f0;
    border-radius: 12px;
    padding: 16px 20px;
    font-size: 13px;
    color: #1d3557;
    line-height: 1.6;
}

.ps-info-title {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 8px;
}

.ps-info-box p { margin: 0 0 8px; }
.ps-info-box p:last-child { margin: 0; }

/* ─── Survey View ─────────────────────────────────────────── */
.ps-survey-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 24px;
}

.ps-back-btn {
    background: none;
    border: none;
    color: #0071e3;
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    white-space: nowrap;
    margin-top: 4px;
    font-weight: 500;
}
.ps-back-btn:hover { text-decoration: underline; }

.ps-survey-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.ps-survey-question {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.18s;
}

.ps-survey-question:focus-within {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0,113,227,0.1);
}

.ps-survey-q-num {
    font-size: 11px;
    color: #8e8e93;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.ps-survey-q-text {
    font-size: 15px;
    color: #1d1d1f;
    line-height: 1.5;
    margin-bottom: 12px;
    font-weight: 500;
}

.ps-reverse-note {
    font-size: 12px;
    color: #8e8e93;
    margin-bottom: 10px;
    font-style: italic;
}

.ps-radio-scale {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.ps-radio-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    flex: 1;
    min-width: 44px;
}

.ps-radio-opt input[type="radio"] { display: none; }

.ps-radio-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: #6e6e73;
    transition: all 0.18s;
    background: white;
}

.ps-radio-opt:hover .ps-radio-num {
    border-color: #0071e3;
    color: #0071e3;
}

.ps-radio-opt.selected .ps-radio-num {
    background: #0071e3;
    border-color: #0071e3;
    color: white;
    transform: scale(1.1);
}

.ps-scale-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #8e8e93;
    margin-top: 4px;
}

/* ─── Survey Footer ───────────────────────────────────────── */
.ps-survey-footer {
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    text-align: center;
}

.ps-anon-note {
    font-size: 13px;
    color: #6e6e73;
}

.ps-submit-btn {
    width: 100%;
    max-width: 320px;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}

/* ─── Toast ───────────────────────────────────────────────── */
.ps-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    color: white;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: psToastIn 0.3s ease;
}

@keyframes psToastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Quarterly Trend Chart ──────────────────────────────── */
.ps-trend-chart {
    display: flex;
    justify-content: space-around;
    align-items: flex-end;
    height: 140px;
    padding: 0 16px;
    margin-bottom: 8px;
}

.ps-trend-bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    max-width: 80px;
}

.ps-trend-bar-label-top {
    font-size: 13px;
    font-weight: 700;
    color: #1d1d1f;
    margin-bottom: 4px;
    min-height: 18px;
}

.ps-trend-bar-track {
    width: 40px;
    height: 80px;
    background: #f0f0f5;
    border-radius: 4px;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.ps-trend-bar-fill {
    width: 100%;
    border-radius: 4px 4px 0 0;
    transition: height 0.5s ease;
    min-height: 4px;
}

.ps-trend-bar-label {
    font-size: 11px;
    color: #6e6e73;
    margin-top: 6px;
    text-align: center;
    white-space: nowrap;
}

.ps-trend-responses {
    font-size: 10px;
    color: #8e8e93;
    text-align: center;
}

.ps-trend-legend {
    font-size: 11px;
    color: #6e6e73;
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid #f5f5f7;
}
