/* Compact Pupil Summary Modal Styles */

/* Modal Structure */
.modal-content {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

.modal-large {
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1.5rem 2rem;
    background: #f8f9fa;
    border-top: 1px solid #dee2e6;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 2rem;
    line-height: 1;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg);
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 5px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(232, 114, 106, 0.4);
}

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Loading and Error States */
.loading-state {
    text-align: center;
    padding: 3rem;
    color: #666;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 5px;
    border: 1px solid #f5c6cb;
}

/* Summary Content */
.summary-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.summary-section {
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
}

/* Target and Record Items */
.targets-list,
.records-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.target-item,
.record-item {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 1rem;
}

.target-header,
.record-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.target-header h4 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
}

.target-status-badge,
.record-type {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.target-status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.target-status-badge.status-met {
    background: #d4edda;
    color: #155724;
}

.target-status-badge.status-archived {
    background: #e2e3e5;
    color: #383d41;
}

.target-description,
.record-notes {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.target-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: #666;
}

.record-date {
    font-weight: 600;
    color: #ec5f59;
}

.record-type {
    background: #ec5f59;
    color: white;
}

/* Header with Pupil ID */
.modal-header .header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.modal-header .header-content h2 {
    margin: 0;
}

.pupil-id-badge {
    background: #ec5f59;
    color: white;
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

/* Search Bar */
.search-bar-container {
    position: relative;
    margin-bottom: 1.5rem;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: #ec5f59;
    box-shadow: 0 0 0 3px rgba(232, 114, 106, 0.1);
}

.search-input::placeholder {
    color: #999;
}

.clear-search {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
    transition: color 0.2s ease;
}

.clear-search:hover {
    color: #ec5f59;
}

.compact-section {
    padding: 1rem !important;
    margin-bottom: 1rem !important;
}

.compact-details-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.compact-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e9ecef;
}

.compact-row:last-child {
    border-bottom: none;
}

.compact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.compact-item label {
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
    min-width: fit-content;
    margin: 0;
}

.compact-item span {
    color: #333;
    font-size: 0.9rem;
}

.compact-item.full-width {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
}

/* Status Row with Dropdown */
.status-row {
    background: #f8f9fa;
    padding: 0.75rem !important;
    border-radius: 6px;
    border: none !important;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: capitalize;
}

.status-badge.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.status-on-hold {
    background-color: #b8dce8;
    color: #0a4a5c;
}

.status-badge.status-discharged {
    background-color: #e2d9f3;
    color: #5a2d82;
}

.status-badge.status-waiting-list {
    background-color: #ffd6e0;
    color: #c71585;
}

.status-badge.status-assessing {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.status-new_referral {
    background-color: #cce5ff;
    color: #004085;
}

/* Color-coded Status Dropdown */
.status-dropdown {
    padding: 0.4rem 0.75rem;
    border-radius: 4px;
    border: 2px solid #ddd;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 150px;
}

.status-dropdown:hover {
    border-color: #ec5f59;
}

.status-dropdown:focus {
    outline: none;
    border-color: #ec5f59;
    box-shadow: 0 0 0 3px rgba(232, 114, 106, 0.1);
}

/* Color-coded dropdown based on current status */
.status-dropdown-active {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.status-dropdown-on-hold {
    background-color: #b8dce8;
    color: #0a4a5c;
    border-color: #a8d0df;
}

.status-dropdown-discharged {
    background-color: #e2d9f3;
    color: #5a2d82;
    border-color: #d3c5e5;
}

.status-dropdown-waiting-list {
    background-color: #ffd6e0;
    color: #c71585;
    border-color: #ffc9d9;
}

.status-dropdown-assessing {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

/* Color-coded dropdown options */
.status-dropdown option[value="active"] {
    background-color: #d4edda;
    color: #155724;
}

.status-dropdown option[value="on-hold"] {
    background-color: #b8dce8;
    color: #0a4a5c;
}

.status-dropdown option[value="discharged"] {
    background-color: #e2d9f3;
    color: #5a2d82;
}

.status-dropdown option[value="waiting-list"] {
    background-color: #ffd6e0;
    color: #c71585;
}

.status-dropdown option[value="assessing"] {
    background-color: #fff3cd;
    color: #856404;
}

/* Consent Badges */
.consent-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.consent-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.consent-badge-success {
    background: #d4edda;
    color: #155724;
}

.consent-badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.consent-badge-clickable {
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.consent-badge-clickable:hover {
    border-color: #ec5f59;
    box-shadow: 0 2px 6px rgba(232, 114, 106, 0.3);
}

/* Notes Text */
.notes-text {
    margin: 0.5rem 0 0 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9rem;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Compact Target Items */
.compact-target {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.compact-target .target-header h4 {
    font-size: 1rem;
    margin: 0;
}

.compact-target .target-description {
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

.compact-target .target-meta {
    font-size: 0.8rem;
    gap: 1rem;
}

/* Compact Record Items */
.compact-record {
    padding: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.compact-record .record-header {
    margin-bottom: 0.5rem;
}

.compact-record .record-notes {
    font-size: 0.85rem;
    margin: 0.5rem 0;
}

/* Section Headers */
.summary-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #372562;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

/* Empty State */
.empty-state {
    padding: 1.5rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 6px;
}

/* Link Buttons */
.link-btn {
    background: none;
    border: none;
    color: #ec5f59;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

.link-btn:hover {
    color: #5568d3;
    text-decoration: underline;
}

/* Record Actions */
.record-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: nowrap;
    justify-content: flex-start;
}

.record-actions .btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: 4px;
    white-space: nowrap;
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

.record-actions .btn-secondary {
    background: #95a5a6;
    color: white;
}

.record-actions .btn-secondary:hover {
    background: #7f8c8d;
}

.record-actions .btn-primary {
    background: #74b9ff;
    color: white;
}

.record-actions .btn-primary:hover {
    background: #0984e3;
}

.btn-danger {
    background: #ff7675;
    color: white;
}

.btn-danger:hover {
    background: #d63031;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .compact-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .status-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .status-dropdown {
        width: 100%;
    }
}


/* Referral Action Buttons */
.referral-actions-row {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeeba 100%);
    padding: 0.75rem;
    border-radius: 8px;
    margin-top: 0.5rem;
    border: 1px solid #ffc107;
    text-align: center;
}

.referral-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.referral-actions .btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-narrow {
    padding: 0.4rem 0.75rem !important;
    font-size: 0.8rem !important;
    min-width: auto !important;
    width: auto !important;
}

.referral-actions .btn-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.referral-actions .btn-success:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-1px);
}

.referral-actions .btn-warning {
    background: linear-gradient(135deg, #fd7e14 0%, #ffc107 100%);
    color: #212529;
}

.referral-actions .btn-warning:hover {
    background: linear-gradient(135deg, #e96b02 0%, #e0a800 100%);
    transform: translateY(-1px);
}

.referral-actions .btn-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    color: white;
}

.referral-actions .btn-info:hover {
    background: linear-gradient(135deg, #138496 0%, #117a8b 100%);
    transform: translateY(-1px);
}

.referral-actions .btn-info:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.referral-actions .btn-danger {
    background: linear-gradient(135deg, #fde8e8 0%, #feb2b2 100%);
    color: #c53030;
}

.referral-actions .btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, #a71d2a 100%);
    transform: translateY(-1px);
}

.no-consent-warning {
    margin: 0.5rem 0 0 0;
    font-size: 0.75rem;
    color: #856404;
    font-style: italic;
}


/* ===== REOPENED CASE / HISTORICAL DATA STYLES ===== */

.historical-data-wrapper {
    margin-top: 16px;
}

.historical-section {
    background: #F0F7F5;
    border-left: 4px solid #b8a9d4;
    border-radius: 0 8px 8px 0;
    padding: 14px;
    margin-bottom: 16px;
}

.historical-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: #372562;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #C8DDD8;
}

.historical-subsection {
    margin-bottom: 12px;
}

.historical-record-card {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 1px solid #C8DDD8;
    border-radius: 4px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: #372562;
}

/* Pupil History Box */
.history-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-card {
    background: #F0F7F5;
    border: 1px solid #C8DDD8;
    border-left: 4px solid #97c1bc;
    border-radius: 0 6px 6px 0;
    padding: 12px 16px;
}

.history-card-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    font-size: 0.9rem;
}

.history-card-row label {
    font-weight: 600;
    color: #372562;
    min-width: 140px;
}

.history-card-row span {
    color: #372562;
}
