/**
 * Patient Quick Overview - Styles
 * ملف المريض - نظرة سريعة
 *
 * @package Smart_Hospital_Enhanced
 */

/* ========================================
   Overview Header - الشريط العلوي
======================================== */
.quick-overview-header {
    background: linear-gradient(135deg, var(--primary, #0077b6) 0%, #023e8a 100%);
}

.patient-quick-overview {
    padding: 16px;
    background: #f8fafc;
    min-height: calc(100vh - 60px);
}

.patient-overview-header {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.patient-identity {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.patient-avatar-quick {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary, #0077b6) 0%, #023e8a 100%);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.patient-main-info {
    flex: 1;
}

.patient-name-quick {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px 0;
}

.patient-basic-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: #f1f5f9;
    border-radius: 20px;
    font-size: 0.85rem;
    color: #475569;
}

.meta-badge svg {
    opacity: 0.7;
}

/* Status Row */
.patient-status-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
}

.patient-status-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.patient-status-badge.status-stable {
    background: #dcfce7;
    color: #166534;
}

.patient-status-badge.status-critical {
    background: #fee2e2;
    color: #991b1b;
}

.patient-status-badge.status-recovering {
    background: #dbeafe;
    color: #1e40af;
}

.functional-level-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.functional-level-badge.level-independent {
    background: #d1fae5;
    color: #065f46;
}

.functional-level-badge.level-moderate {
    background: #fef3c7;
    color: #92400e;
}

.functional-level-badge.level-high {
    background: #fee2e2;
    color: #991b1b;
}

.functional-level-badge.level-total {
    background: #fecaca;
    color: #7f1d1d;
}

.care-goals-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.care-goals-badge.goals-rehabilitation {
    background: #e0e7ff;
    color: #3730a3;
}

.care-goals-badge.goals-palliative {
    background: #fef9c3;
    color: #854d0e;
}

.care-goals-badge.goals-transition {
    background: #f3e8ff;
    color: #6b21a8;
}

/* Primary Diagnoses */
.primary-diagnoses-bar {
    background: #f8fafc;
    padding: 12px 16px;
    border-radius: 10px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

.diagnoses-label {
    font-weight: 600;
    color: #64748b;
    font-size: 0.9rem;
    white-space: nowrap;
}

.diagnoses-text {
    color: #334155;
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ========================================
   Services Panels Grid
======================================== */
.services-panels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

@media (max-width: 700px) {
    .services-panels-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   Service Panel Base Styles
======================================== */
.service-panel {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-panel:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: linear-gradient(135deg, var(--panel-color) 0%, color-mix(in srgb, var(--panel-color) 80%, black) 100%);
    color: white;
}

.panel-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    flex: 1;
}

.panel-subtitle {
    font-size: 0.75rem;
    opacity: 0.8;
}

.panel-content {
    padding: 16px;
}

/* ========================================
   Panel Sections
======================================== */
.panel-section {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

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

.section-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Lists */
.diagnoses-list,
.goals-list,
.meds-list,
.changes-list,
.problems-list,
.cultures-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.diagnoses-list li,
.goals-list li,
.changes-list li,
.problems-list li {
    padding: 6px 0;
    font-size: 0.9rem;
    color: #334155;
    border-bottom: 1px dashed #e2e8f0;
}

.diagnoses-list li:last-child,
.goals-list li:last-child,
.changes-list li:last-child,
.problems-list li:last-child {
    border-bottom: none;
}

.diagnoses-list li::before,
.goals-list li::before {
    content: "•";
    color: var(--panel-color, #64748b);
    font-weight: bold;
    margin-left: 8px;
}

/* Active Plans */
.active-plans {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.plan-tag {
    background: #f1f5f9;
    color: #334155;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
}

/* Next Appointment */
.next-appointment {
    background: #f0fdf4;
    margin: -16px;
    margin-top: 0;
    padding: 12px 16px !important;
    border-bottom: none !important;
}

.appointment-date {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: #166534;
}

/* ========================================
   Vitals Mini Grid
======================================== */
.vitals-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.vital-mini {
    background: #f8fafc;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.vital-label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 4px;
}

.vital-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
}

.vital-mini.pain-level-low {
    background: #dcfce7;
}

.vital-mini.pain-level-moderate {
    background: #fef3c7;
}

.vital-mini.pain-level-high {
    background: #fee2e2;
}

/* Latest Note */
.latest-note {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
    margin: 0;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    border-right: 3px solid #3498db;
}

/* ========================================
   Rehab Stats
======================================== */
.rehab-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-mini {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #27ae60;
}

.stat-label {
    font-size: 0.75rem;
    color: #64748b;
}

.progress-indicator {
    flex: 1;
}

.progress-bar,
.calories-bar,
.compliance-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.calories-fill {
    height: 100%;
    background: linear-gradient(90deg, #e67e22, #f39c12);
    border-radius: 4px;
}

.compliance-fill {
    height: 100%;
    background: linear-gradient(90deg, #16a085, #1abc9c);
    border-radius: 4px;
}

.progress-text,
.calories-text,
.compliance-text {
    font-size: 0.8rem;
    color: #64748b;
}

/* ========================================
   Device Settings
======================================== */
.device-settings {
    background: #f5f3ff;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #5b21b6;
    font-weight: 500;
}

.efficiency-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.efficiency-badge.good {
    background: #dcfce7;
    color: #166534;
}

.efficiency-badge.moderate {
    background: #fef3c7;
    color: #92400e;
}

.efficiency-badge.poor {
    background: #fee2e2;
    color: #991b1b;
}

/* Risk Badges */
.risk-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.risk-badge.risk-low {
    background: #dcfce7;
    color: #166534;
}

.risk-badge.risk-moderate {
    background: #fef3c7;
    color: #92400e;
}

.risk-badge.risk-high {
    background: #fee2e2;
    color: #991b1b;
}

/* ========================================
   Palliative Panel
======================================== */
.preferences-text {
    font-size: 0.9rem;
    color: #475569;
    line-height: 1.5;
    margin: 0;
}

.pain-scale {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pain-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.2s ease;
}

.pain-dot.active:nth-child(-n+3) {
    background: #22c55e;
}

.pain-dot.active:nth-child(n+4):nth-child(-n+6) {
    background: #f59e0b;
}

.pain-dot.active:nth-child(n+7) {
    background: #ef4444;
}

.pain-number {
    margin-right: 10px;
    font-weight: 700;
    color: #334155;
}

.interventions-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.intervention-tag {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

/* ========================================
   Medication Panel
======================================== */
.high-risk-meds {
    background: #fef2f2;
    margin: -16px -16px 14px -16px;
    padding: 16px !important;
    border-bottom: none !important;
}

.meds-list li {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.high-risk-med {
    background: #fee2e2;
    border-radius: 6px;
    color: #991b1b;
    margin-bottom: 6px;
}

.high-risk-med::before {
    content: "⚠️";
    margin-left: 6px;
}

.warning-alert {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fef3c7;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #92400e;
}

.warning-alert svg {
    flex-shrink: 0;
}

/* ========================================
   Nutrition Panel
======================================== */
.diet-info {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.diet-type-badge {
    background: #fed7aa;
    color: #9a3412;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
}

.feeding-method {
    color: #78716c;
    font-size: 0.85rem;
}

.calories-comparison {
    margin-top: 8px;
}

/* ========================================
   Psychosocial Panel
======================================== */
.mental-status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
}

.mental-status-badge.status-stable {
    background: #dcfce7;
    color: #166534;
}

.mental-status-badge.status-anxious {
    background: #fef3c7;
    color: #92400e;
}

.mental-status-badge.status-depressed {
    background: #e0e7ff;
    color: #3730a3;
}

.mental-status-badge.status-confused {
    background: #fee2e2;
    color: #991b1b;
}

.support-level {
    display: flex;
    gap: 2px;
}

.support-star {
    font-size: 1.2rem;
    color: #e2e8f0;
}

.support-star.active {
    color: #f59e0b;
}

.risk-indicators {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.risk-tag {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.depression-risk {
    background: #e0e7ff;
    color: #3730a3;
}

.isolation-risk {
    background: #fef3c7;
    color: #92400e;
}

/* ========================================
   Infection Panel
======================================== */
.isolation-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 600;
}

.isolation-badge.active {
    background: #fee2e2;
    color: #991b1b;
}

.isolation-badge.inactive {
    background: #dcfce7;
    color: #166534;
}

.cultures-list li {
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 6px;
}

.positive-culture {
    background: #fee2e2;
    color: #991b1b;
}

.positive-culture::before {
    content: "🦠";
    margin-left: 6px;
}

.compliance-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.compliance-indicator .compliance-bar {
    flex: 1;
}

/* ========================================
   Supportive Panel
======================================== */
.qol-score {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.qol-number {
    font-size: 2rem;
    font-weight: 700;
    color: #16a085;
}

.qol-max {
    font-size: 1rem;
    color: #64748b;
}

.independence-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 8px;
    font-weight: 600;
}

.independence-badge.level-independent {
    background: #dcfce7;
    color: #166534;
}

.independence-badge.level-minimal {
    background: #dbeafe;
    color: #1e40af;
}

.independence-badge.level-moderate {
    background: #fef3c7;
    color: #92400e;
}

.independence-badge.level-dependent {
    background: #fee2e2;
    color: #991b1b;
}

.services-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.service-tag {
    background: #d1fae5;
    color: #065f46;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
}

/* ========================================
   Quick Actions Bar
======================================== */
.quick-overview-actions {
    display: flex;
    gap: 10px;
    padding: 16px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
    position: sticky;
    bottom: 16px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.action-btn.btn-primary {
    background: linear-gradient(135deg, var(--primary, #0077b6) 0%, #023e8a 100%);
    color: white;
}

.action-btn.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 182, 0.3);
}

.action-btn.btn-secondary {
    background: #f1f5f9;
    color: #334155;
}

.action-btn.btn-secondary:hover {
    background: #e2e8f0;
}

.action-btn.btn-outline {
    background: transparent;
    border: 2px solid var(--primary, #0077b6);
    color: var(--primary, #0077b6);
}

.action-btn.btn-outline:hover {
    background: var(--primary, #0077b6);
    color: white;
}

/* ========================================
   Print Styles
======================================== */
@media print {
    .quick-overview-header,
    .quick-overview-actions {
        display: none !important;
    }
    
    .patient-quick-overview {
        padding: 0;
        background: white;
    }
    
    .services-panels-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .service-panel {
        box-shadow: none;
        border: 1px solid #e2e8f0;
        break-inside: avoid;
    }
    
    .patient-overview-header {
        box-shadow: none;
        border: 1px solid #e2e8f0;
    }
}

/* ========================================
   Responsive
======================================== */
@media (max-width: 480px) {
    .patient-identity {
        flex-direction: column;
        text-align: center;
    }
    
    .patient-status-row {
        justify-content: center;
    }
    
    .quick-overview-actions {
        flex-direction: column;
    }
    
    .vitals-mini-grid {
        grid-template-columns: 1fr;
    }
}
