/* AssessmentFormModal Component Styles */

/* Modal Overlay */
.assessment-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    overflow-y: auto;
    padding: 20px;
}

/* Modal Content */
.assessment-modal-overlay .modal-content {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 100%;
}

.assessment-modal-overlay .modal-large {
    max-width: 1100px;
}

/* Modal Header */
.assessment-modal-overlay .modal-header {
    background: linear-gradient(135deg, #F0F7F5 0%, #F0F7F5 100%);
    color: #2c3e50;
    padding: 16px 24px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.assessment-modal-overlay .modal-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.assessment-modal-overlay .close-btn {
    background: none;
    border: none;
    color: #999;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color 0.2s;
}

.assessment-modal-overlay .close-btn:hover {
    color: #333;
}

/* Modal Body */
.assessment-modal-overlay .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Modal Footer */
.assessment-modal-overlay .modal-footer {
    padding: 14px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 8px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
}

/* Buttons */
.assessment-modal-overlay .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.assessment-modal-overlay .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.assessment-modal-overlay .btn-primary {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
}

.assessment-modal-overlay .btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.assessment-modal-overlay .btn-secondary {
    background: #6c757d;
    color: white;
}

.assessment-modal-overlay .btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.assessment-modal-overlay .btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 3px;
}

.assessment-modal-overlay .btn-spinner {
    border: 2px solid #ffffff;
    border-top: 2px solid transparent;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    animation: afm-spin 0.8s linear infinite;
}

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

/* Loading State */
.assessment-modal-overlay .loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.assessment-modal-overlay .spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #ec5f59;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: afm-spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Error / Success Messages */
.assessment-modal-overlay .error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin-bottom: 16px;
    font-size: 14px;
}

.assessment-modal-overlay .success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-bottom: 16px;
    font-size: 14px;
}

.assessment-modal-overlay .warning-message {
    background-color: #fff3cd;
    color: #856404;
    padding: 10px 14px;
    border-radius: 4px;
    border: 1px solid #ffeeba;
    margin-bottom: 16px;
    font-size: 14px;
}

/* Form Styles */
.afm-form-section {
    margin-bottom: 20px;
}

.afm-form-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #ec5f59;
    padding-bottom: 6px;
}

.afm-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.afm-form-group {
    display: flex;
    flex-direction: column;
}

.afm-form-group label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 4px;
    font-size: 13px;
}

.afm-form-group label .required {
    color: #c53030;
    margin-left: 2px;
}

.afm-form-group input,
.afm-form-group select,
.afm-form-group textarea {
    padding: 8px 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.afm-form-group input:focus,
.afm-form-group select:focus,
.afm-form-group textarea:focus {
    outline: none;
    border-color: #ec5f59;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.afm-form-group input:disabled,
.afm-form-group select:disabled,
.afm-form-group input[readonly] {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.afm-form-group .field-error {
    color: #c53030;
    font-size: 12px;
    margin-top: 3px;
}

.afm-table .field-error {
    color: #c53030;
    font-size: 11px;
    margin-top: 2px;
    font-weight: 500;
}

.afm-form-group input.is-invalid,
.afm-form-group select.is-invalid {
    border-color: #feb2b2;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.15);
}

.afm-computed-value {
    padding: 8px 10px;
    background: #f0f4ff;
    border: 1px solid #d0d8f0;
    border-radius: 4px;
    font-size: 13px;
    color: #333;
    min-height: 34px;
    display: flex;
    align-items: center;
}

/* Assessment Tables */
.afm-table-wrapper {
    overflow-x: auto;
    margin-bottom: 16px;
}

.afm-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
}

.afm-table thead th {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
    font-weight: 600;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 2px solid #5a67d8;
    white-space: nowrap;
    font-size: 12px;
}

.afm-table tbody td {
    padding: 6px 8px;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.afm-table tbody tr:last-child td {
    border-bottom: none;
}

.afm-table tbody tr:hover {
    background-color: #f8f9fa;
}

.afm-table input[type="number"],
.afm-table input[type="text"],
.afm-table select {
    width: 100%;
    padding: 5px 7px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 13px;
    box-sizing: border-box;
    min-width: 60px;
}

.afm-table input[type="number"]:focus,
.afm-table input[type="text"]:focus,
.afm-table select:focus {
    outline: none;
    border-color: #ec5f59;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.afm-table input[readonly],
.afm-table input:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

.afm-table .subtest-name {
    font-weight: 500;
    color: #333;
    white-space: nowrap;
}

.afm-table .age-note {
    font-size: 11px;
    color: #888;
    font-style: italic;
    display: block;
}

.afm-table .auto-cell {
    background: #f0f4ff;
    text-align: center;
    border: 1px solid #d0d5e0;
    font-weight: 500;
}

.afm-table th {
    text-align: center !important;
}

.afm-table th:first-child,
.afm-table td.subtest-name {
    text-align: left !important;
}

.afm-table .blocked-cell {
    background: #e9ecef;
    text-align: center;
    color: #aaa;
}

.afm-table .summary-row td {
    background: #f8f9fa;
    font-weight: 600;
    border-top: 2px solid #dee2e6;
}

.afm-table .checkmark-cell {
    text-align: center;
    font-size: 16px;
    color: #ec5f59;
}

/* RAG Colour Classes */
.rag-red { background-color: #f8b4b4 !important; color: #7c1d1d !important; }
.rag-orange { background-color: #fde0a8 !important; color: #7c4a0e !important; }
.rag-yellow { background-color: #fef3b8 !important; color: #6b5e00 !important; }
.rag-light-green { background-color: #c6efb3 !important; color: #2d5a1e !important; }
.rag-dark-green { background-color: #a3d48e !important; color: #1e3a12 !important; }
.rag-purple { background-color: #FDF0EF !important; color: #6f42c1 !important; }
.rag-pink { background-color: #f8d7e8 !important; color: #c2185b !important; }
.rag-grey { background-color: #e9ecef !important; color: #6c757d !important; }
.rag-criterion-met { background-color: #c6efb3 !important; color: #2d5a1e !important; }
.rag-criterion-not-met { background-color: #f8b4b4 !important; color: #7c1d1d !important; }

/* SVG Bar Chart Container */
.afm-chart-container {
    margin: 16px 0;
    padding: 12px;
    background: #fafbfc;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.afm-chart-container h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.afm-chart-container svg {
    display: block;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
}

/* Composite Score Section */
.afm-composite-section {
    margin-top: 16px;
    padding: 14px;
    background: #f0f4ff;
    border: 1px solid #d0d8f0;
    border-radius: 6px;
}

.afm-composite-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.afm-composite-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.afm-composite-item {
    display: flex;
    flex-direction: column;
}

.afm-composite-item label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    margin-bottom: 3px;
}

.afm-composite-item .value {
    padding: 6px 10px;
    background: white;
    border: 1px solid #d0d8f0;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    min-height: 30px;
    display: flex;
    align-items: center;
}

/* TALC Grid Styles */
.afm-talc-grid { table-layout: fixed; }
.afm-talc-grid th:first-child,
.afm-talc-grid td:first-child { width: 25%; }
.afm-talc-grid th:not(:first-child),
.afm-talc-grid td:not(:first-child) { width: 18.75%; text-align: center; }
.afm-talc-grid th { white-space: normal; line-height: 1.3; vertical-align: top; }
.afm-talc-grid input[type="number"] {
    width: 55px;
    text-align: center;
}

.afm-talc-summary {
    font-weight: 600;
}

.competency-yes {
    color: #155724;
    background: #d4edda;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

.competency-no {
    color: #721c24;
    background: #f8d7da;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
}

/* PS CELF Index Grid */
.afm-index-grid {
    overflow-x: auto;
}

.afm-index-grid .afm-table th {
    font-size: 11px;
    padding: 6px 5px;
    text-align: center;
}

.afm-index-grid .afm-table td {
    text-align: center;
    padding: 5px 4px;
}

/* Saving overlay */
.afm-saving-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .assessment-modal-overlay {
        padding: 10px;
    }

    .assessment-modal-overlay .modal-content {
        max-height: 95vh;
    }

    .assessment-modal-overlay .modal-header {
        padding: 12px 16px;
    }

    .assessment-modal-overlay .modal-header h2 {
        font-size: 16px;
    }

    .assessment-modal-overlay .modal-body {
        padding: 16px;
    }

    .assessment-modal-overlay .modal-footer {
        padding: 10px 16px;
        flex-direction: column;
    }

    .assessment-modal-overlay .btn {
        width: 100%;
    }

    .afm-form-grid {
        grid-template-columns: 1fr;
    }

    .afm-table {
        font-size: 12px;
    }

    .afm-table thead th {
        font-size: 11px;
        padding: 6px;
    }

    .afm-table tbody td {
        padding: 4px 6px;
    }
}


/* Read-only mode - disable all inputs for school staff viewing */
.read-only-mode input,
.read-only-mode select,
.read-only-mode textarea {
    pointer-events: none !important;
    opacity: 0.8 !important;
    background-color: #f5f5f5 !important;
    cursor: not-allowed !important;
}


/* ============ SPEECH SCREENER STYLES ============ */

/* Pattern tables */
.ss-pattern-table td {
    color: #372562;
}

/* Indicator dots */
.ss-indicator-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    vertical-align: middle;
}

.ss-dot-green {
    background-color: #d4edda;
}

.ss-dot-amber {
    background-color: #ffc107;
}

.ss-dot-red {
    background-color: #fde8e8;
}

.ss-dot-neutral {
    background-color: #adb5bd;
}

/* Sound acquisition grid */
.ss-sound-group {
    margin-bottom: 16px;
}

.ss-sound-group-title {
    margin: 0 0 8px 0;
    font-size: 14px;
    font-weight: 600;
    color: #372562;
}

.ss-sound-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ss-sound-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    user-select: none;
    min-width: 55px;
}

.ss-sound-item:hover {
    background: #f0f4ff;
    border-color: #ec5f59;
}

.read-only-mode .ss-sound-item {
    cursor: not-allowed;
}

.read-only-mode .ss-sound-item:hover {
    background: transparent;
    border-color: #dee2e6;
}

.ss-sound-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}

.ss-toggle-unset {
    background: #e9ecef;
    color: #adb5bd;
}

.ss-toggle-acquired {
    background: #d4edda;
    color: #155724;
}

.ss-toggle-not-acquired {
    background: #fde8e8;
    color: #c53030;
}

.ss-sound-icon {
    line-height: 1;
}

.ss-sound-label {
    font-size: 14px;
    font-weight: 500;
}

.ss-sound-indicator {
    margin-left: auto;
}

/* Diagnosis selection */
.ss-diagnosis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ss-diagnosis-card {
    display: flex;
    align-items: flex-start;
    padding: 10px 14px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.ss-diagnosis-card:hover {
    background: #f8f9fa;
}

.read-only-mode .ss-diagnosis-card {
    cursor: not-allowed;
}

.ss-diagnosis-selected {
    background: #f0f4ff;
}

.ss-diagnosis-selected.ss-severity-green {
    border-color: #c3e6cb;
}

.ss-diagnosis-selected.ss-severity-amber {
    border-color: #ffc107;
}

.ss-diagnosis-selected.ss-severity-red {
    border-color: #feb2b2;
}

.ss-diagnosis-desc {
    margin: 4px 0 0 0;
    font-size: 12px;
    color: #666;
    font-weight: normal;
}

.ss-diagnosis-error {
    border: 2px solid #feb2b2;
    border-radius: 6px;
    padding: 4px;
}

.ss-diagnosis-error .field-error {
    color: #c53030;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Character counter */
.ss-char-counter {
    text-align: right;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.ss-char-warning {
    color: #c53030;
    font-weight: 500;
}

/* File upload area */
.ss-file-upload-area {
    padding: 12px;
    border: 2px dashed #dee2e6;
    border-radius: 6px;
    background: #fafbfc;
}

.ss-file-display {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    background: #f0f4ff;
    border: 1px solid #d0d8f0;
    border-radius: 6px;
}

.ss-upload-progress {
    margin-top: 8px;
}

.ss-progress-bar {
    width: 100%;
    height: 6px;
    background: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 4px;
}

.ss-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    border-radius: 3px;
    transition: width 0.3s;
}

/* Validation warning overlay */
.ss-warning-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.ss-warning-modal {
    background: white;
    border-radius: 8px;
    padding: 20px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    border-top: 4px solid #ffc107;
}

/* ============ SPEECH SCREENER COMPARISON STYLES ============ */

/* Diagnosis comparison row */
.ss-compare-diagnosis-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.ss-compare-diag-card {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ss-compare-diag-card label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.ss-compare-diag-arrow {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    white-space: nowrap;
}

.ss-arrow-improved {
    background: #c6efb3;
    color: #2d5a1e;
}

.ss-arrow-worsened {
    background: #f8b4b4;
    color: #7c1d1d;
}

.ss-arrow-same {
    background: #e9ecef;
    color: #555;
}

/* Diagnosis badge in comparison */
.ss-diagnosis-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
}

.ss-severity-green {
    background: #d4edda;
    color: #155724;
}

.ss-severity-amber {
    background: #fff3cd;
    color: #856404;
}

.ss-severity-red {
    background: #f8d7da;
    color: #721c24;
}

.ss-severity-grey {
    background: #e9ecef;
    color: #6c757d;
}

/* Present/absent dots in comparison tables */
.ss-present-dot {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.ss-dot-amber {
    background: #fff3cd;
    color: #856404;
}

.ss-dot-red {
    background: #f8d7da;
    color: #721c24;
}

.ss-dot-clear {
    background: #e9ecef;
    color: #6c757d;
}

/* Sound acquisition comparison */
.ss-compare-sound-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ss-compare-sound-group {
    padding: 12px;
    background: #fafbfc;
    border: 1px solid #e9ecef;
    border-radius: 6px;
}

.ss-compare-sound-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}

.ss-compare-sound-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    background: white;
}

.ss-compare-sound-item.ss-sound-gained {
    border-color: #c3e6cb;
    background: #f0fff0;
}

.ss-compare-sound-item.ss-sound-lost {
    border-color: #feb2b2;
    background: #fde8e8;
}

.ss-compare-sound-item.ss-sound-maintained {
    border-color: #c3e6cb;
    background: #f8fff8;
}

.ss-compare-sound-item .ss-sound-label {
    font-weight: 600;
    min-width: 40px;
    color: #372562;
}

.ss-compare-sound-item .ss-sound-arrow {
    color: #adb5bd;
    font-size: 12px;
}

.ss-sound-acquired {
    color: #155724;
    font-weight: 700;
}

.ss-sound-not-acquired {
    color: #c53030;
    font-weight: 700;
}

.ss-sound-unset {
    color: #adb5bd;
}

.ss-sound-earlier,
.ss-sound-later {
    font-size: 16px;
    min-width: 16px;
    text-align: center;
}

/* Clinical notes comparison */
.ss-compare-notes {
    padding: 10px 12px;
    background: #fafbfc;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 13px;
    color: #372562;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
    min-height: 60px;
}
