/* ProgressSummaryForm Component Styles */

/* Overlay */
.psf-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

/* Modal */
.psf-modal {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Header */
.psf-header {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.psf-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.psf-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.psf-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Body */
.psf-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    color: #372562;
}

/* Loading */
.psf-loading {
    text-align: center;
    padding: 2rem;
}

.psf-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #97c1bc;
    border-radius: 50%;
    animation: psf-spin 1s linear infinite;
    margin: 0 auto 0.75rem;
}

@keyframes psf-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.psf-loading p {
    margin: 0;
    font-size: 0.85rem;
    color: #372562;
}

/* Messages */
.psf-error {
    background: #f8d7da;
    color: #721c24;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.psf-success {
    background: #d4edda;
    color: #155724;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.psf-readonly-notice {
    background: #fff3cd;
    color: #856404;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    border: 1px solid #ffeeba;
}

/* Sections */
.psf-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #C8DDD8;
}

.psf-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.psf-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: #372562;
}

/* Fields grid */
.psf-fields-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.psf-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.psf-field label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #372562;
}

.psf-readonly-value {
    display: block;
    padding: 0.4rem 0.5rem;
    background: #F0F7F5;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #372562;
}

/* Select */
.psf-select {
    width: 100%;
    max-width: 300px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #372562;
    background: white;
}

.psf-select:disabled {
    background: #F0F7F5;
    cursor: default;
}

.psf-select:focus {
    outline: none;
    border-color: #372562;
    box-shadow: 0 0 0 2px rgba(232, 114, 106, 0.15);
}

/* RAG Rating */
.psf-rag-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.psf-rag-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 2px solid #C8DDD8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #372562;
    transition: border-color 0.2s, background 0.2s;
}

.psf-rag-radio input[type="radio"] {
    display: none;
}

.psf-rag-radio.selected {
    border-color: #372562;
    background: #F0F7F5;
}

.rag-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: inline-block;
}

.rag-red-indicator {
    background: #fde8e8;
}

.rag-amber-indicator {
    background: #fff3cd;
}

.rag-green-indicator {
    background: #d4edda;
}

.rag-red-option.selected {
    border-color: #feb2b2;
    background: #fde8e8;
}

.rag-amber-option.selected {
    border-color: #ffc107;
    background: #fff3cd;
}

.rag-green-option.selected {
    border-color: #c3e6cb;
    background: #d4edda;
}

/* Metrics Grid */
.psf-metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.psf-metric-card {
    background: #F0F7F5;
    border: 1px solid #C8DDD8;
    border-radius: 8px;
    padding: 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.psf-metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #372562;
}

.psf-metric-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
}

/* Tables */
.psf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.psf-table th,
.psf-table td {
    padding: 0.5rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #C8DDD8;
    color: #372562;
}

.psf-table th {
    background: #F0F7F5;
    font-weight: 600;
    font-size: 0.8rem;
}

.psf-table tbody tr:hover {
    background: #F0F7F5;
}

/* Notes of Visit outcomes */
.psf-nov-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.psf-nov-item {
    background: #F0F7F5;
    border: 1px solid #C8DDD8;
    border-radius: 6px;
    padding: 0.75rem;
}

.psf-nov-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #372562;
    display: block;
    margin-bottom: 0.4rem;
}

.psf-nov-item ul {
    margin: 0;
    padding-left: 1.25rem;
}

.psf-nov-item li {
    font-size: 0.85rem;
    color: #372562;
    margin-bottom: 0.2rem;
}

.psf-empty-note {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
    margin: 0;
}

/* Textarea fields */
.psf-textarea-field {
    margin-bottom: 1rem;
}

.psf-textarea-field:last-child {
    margin-bottom: 0;
}

.psf-textarea-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #372562;
    margin-bottom: 0.3rem;
}

.psf-textarea-field textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #372562;
    font-family: inherit;
    resize: vertical;
    min-height: 60px;
}

.psf-textarea-field textarea:disabled {
    background: #F0F7F5;
    cursor: default;
}

.psf-textarea-field textarea:focus {
    outline: none;
    border-color: #372562;
    box-shadow: 0 0 0 2px rgba(232, 114, 106, 0.15);
}

/* Footer */
.psf-footer {
    padding: 1rem 1.5rem;
    background: #F0F7F5;
    border-top: 1px solid #C8DDD8;
    border-radius: 0 0 12px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.psf-footer-right {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.psf-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: opacity 0.2s, transform 0.2s;
}

.psf-btn:disabled {
    opacity: 0.6;
    cursor: default;
    transform: none;
}

.psf-btn-save {
    background: #FDF0EF;
    color: #372562;
}

.psf-btn-save:hover:not(:disabled) {
    background: #dcc5f0;
    transform: translateY(-1px);
}

.psf-btn-cancel {
    background: #C8DDD8;
    color: #372562;
}

.psf-btn-cancel:hover:not(:disabled) {
    background: #C8DDD8;
}

.psf-btn-pdf {
    background: #F0F7F5;
    color: #372562;
    border: 1px solid #C8DDD8;
}

.psf-btn-pdf:hover:not(:disabled) {
    background: #A8C9C0;
}

/* Responsive */
@media (max-width: 600px) {
    .psf-modal {
        width: 95%;
        max-height: 95vh;
    }

    .psf-fields-grid {
        grid-template-columns: 1fr;
    }

    .psf-metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .psf-rag-options {
        flex-direction: column;
    }

    .psf-footer {
        flex-direction: column;
        gap: 0.75rem;
    }

    .psf-footer-right {
        width: 100%;
        justify-content: flex-end;
    }
}
