/**
 * ENNU Provider Patients Panel Styles
 *
 * Comprehensive styling for patient list and detail views
 *
 * @package ENNU_Provider_Panel
 * @version 1.0.0
 */

/* ==========================================================================
   Patient List Container
   ========================================================================== */

.ennu-patients-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.ennu-patients-list-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    padding: 24px;
}

.ennu-patients-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.ennu-patients-header h2 {
    margin: 0;
    font-size: 28px;
    color: #1a1a1a;
}

.ennu-patients-actions {
    display: flex;
    gap: 12px;
}

/* ==========================================================================
   Filters
   ========================================================================== */

.ennu-patients-filters {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 24px;
}

.filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
    color: #555;
}

.filter-group select,
.filter-group input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
}

/* ==========================================================================
   DataTable Customizations
   ========================================================================== */

.ennu-patients-table-wrapper {
    overflow-x: auto;
}

#patients-table {
    width: 100% !important;
    border-collapse: collapse;
}

#patients-table thead th {
    background: #2c3e50;
    color: #fff;
    padding: 12px 8px;
    font-weight: 600;
    text-align: left;
    border-bottom: 2px solid #1a252f;
}

#patients-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

#patients-table tbody tr:hover {
    background-color: #f5f5f5;
}

#patients-table tbody td {
    padding: 12px 8px;
    border-bottom: 1px solid #e0e0e0;
}

.patient-link {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.patient-link:hover {
    text-decoration: underline;
}

.score-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

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

.status-discharged {
    background: #f8d7da;
    color: #721c24;
}

/* ==========================================================================
   Patient Detail Container
   ========================================================================== */

.ennu-patient-detail-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ennu-patient-header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: #fff;
    padding: 24px;
    border-radius: 8px 8px 0 0;
}

.patient-back-btn {
    margin-bottom: 16px;
}

.patient-back-btn .ennu-btn-link {
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.patient-info-bar {
    display: flex;
    gap: 24px;
    align-items: center;
}

.patient-avatar img {
    border-radius: 50%;
    border: 4px solid rgba(255,255,255,0.3);
}

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

.patient-basic-info h2 {
    margin: 0 0 12px 0;
    font-size: 32px;
}

.patient-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 14px;
}

.meta-item {
    display: flex;
    gap: 6px;
}

/* Score Circle Widget */
.patient-score-widget {
    position: relative;
}

.score-circle {
    width: 120px;
    height: 120px;
    position: relative;
}

.score-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.score-circle circle {
    fill: none;
    stroke-width: 8;
}

.score-circle .score-bg {
    stroke: rgba(255,255,255,0.2);
}

.score-circle .score-fill {
    stroke: #fff;
    stroke-dasharray: 283;
    stroke-dashoffset: 283;
    transition: stroke-dashoffset 1s ease;
    stroke-linecap: round;
}

.score-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.score-number {
    display: block;
    font-size: 32px;
    font-weight: 700;
}

.score-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.9;
}

/* ==========================================================================
   Tabs Navigation
   ========================================================================== */

.ennu-tabs-container {
    padding: 0;
}

.ennu-tabs-nav {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 2px solid #e0e0e0;
    background: #f8f9fa;
}

.ennu-tabs-nav li {
    flex: 1;
}

.ennu-tabs-nav .tab-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 16px 12px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #555;
    transition: all 0.3s;
}

.ennu-tabs-nav .tab-link:hover {
    background: #e9ecef;
    color: #2563eb;
}

.ennu-tabs-nav .tab-link.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: #fff;
}

.ennu-tabs-nav .tab-link .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Tab Content
   ========================================================================== */

.ennu-tabs-content {
    padding: 24px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-loading {
    text-align: center;
    padding: 40px;
    color: #999;
    font-size: 16px;
}

.tab-loading::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

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

/* ==========================================================================
   Summary Tab
   ========================================================================== */

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.summary-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
}

.summary-card h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-card h3 .dashicons {
    color: #2563eb;
}

.card-content {
    font-size: 14px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.info-row .label {
    font-weight: 600;
    color: #555;
}

.info-row .value {
    color: #333;
}

.no-data {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Four-Engine Scores */
.engine-score-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.engine-name {
    width: 120px;
    font-weight: 600;
    font-size: 13px;
}

.engine-bar {
    flex: 1;
    height: 20px;
    background: #f0f0f0;
    border-radius: 10px;
    overflow: hidden;
}

.engine-fill {
    height: 100%;
    transition: width 1s ease;
}

.engine-value {
    width: 40px;
    text-align: right;
    font-weight: 700;
}

/* Medications List */
.medications-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.medications-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.medications-list li:last-child {
    border-bottom: none;
}

.medications-list .dosage {
    color: #666;
    font-size: 13px;
}

.medications-list small {
    color: #999;
}

/* Vitals Grid */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.vital-item {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
}

.vital-item .label {
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
}

.vital-item .value {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

/* Appointments List */
.appointments-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.appointments-list li {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.appointments-list li:last-child {
    border-bottom: none;
}

/* Alerts List */
.alerts-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.alerts-list li {
    padding: 10px;
    margin-bottom: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
}

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

/* ==========================================================================
   Assessments Tab
   ========================================================================== */

.assessments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.assessment-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.3s;
}

.assessment-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.assessment-header {
    background: #f8f9fa;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.assessment-header h4 {
    margin: 0;
    font-size: 16px;
}

.assessment-score {
    font-size: 24px;
    font-weight: 700;
    color: #2563eb;
}

.assessment-body {
    padding: 16px;
}

.assessment-date,
.assessment-count {
    margin: 4px 0;
    font-size: 13px;
    color: #666;
}

.score-trend {
    margin: 8px 0 0 0;
    font-weight: 600;
}

.assessment-actions {
    padding: 12px 16px;
    border-top: 1px solid #e0e0e0;
}

/* ==========================================================================
   Biomarkers Tab
   ========================================================================== */

.biomarkers-container {
    max-width: 1200px;
}

.biomarkers-header h3 {
    margin: 0 0 24px 0;
    font-size: 24px;
}

.biomarker-category {
    margin-bottom: 32px;
}

.biomarker-category h4 {
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #2563eb;
    color: #2c3e50;
}

.biomarkers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.biomarker-card {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
}

.biomarker-card.status-normal {
    border-color: #4CAF50;
}

.biomarker-card.status-high {
    border-color: #FF9800;
    background: #fff3e0;
}

.biomarker-card.status-low {
    border-color: #2196F3;
    background: #e3f2fd;
}

.biomarker-card.status-critical {
    border-color: #F44336;
    background: #ffebee;
}

.biomarker-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: #2c3e50;
}

.biomarker-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.biomarker-value .unit {
    font-size: 14px;
    font-weight: 400;
    color: #666;
}

.biomarker-range {
    font-size: 11px;
    color: #999;
    margin-bottom: 8px;
}

.biomarker-date {
    font-size: 11px;
    color: #999;
}

/* ==========================================================================
   Protocols Tab
   ========================================================================== */

.protocols-container {
    max-width: 900px;
}

.protocol-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.protocol-header {
    background: #f8f9fa;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e0e0e0;
}

.protocol-header h4 {
    margin: 0;
    font-size: 18px;
}

.protocol-body {
    padding: 20px;
}

.protocol-info {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
}

.protocol-info span {
    font-size: 14px;
}

.compliance-meter {
    margin: 16px 0;
}

.compliance-label {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 13px;
}

.compliance-bar {
    height: 24px;
    background: #f0f0f0;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 4px;
}

.compliance-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #8BC34A 100%);
    transition: width 1s ease;
}

.compliance-value {
    text-align: right;
    font-weight: 700;
    font-size: 14px;
}

.refill-info {
    margin-top: 12px;
    padding: 12px;
    background: #fff3cd;
    border-radius: 4px;
    font-size: 14px;
}

.protocol-medications {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

.protocol-medications h5 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.protocol-medications ul {
    margin: 0;
    padding-left: 20px;
}

.protocol-medications li {
    margin-bottom: 4px;
    font-size: 13px;
}

/* ==========================================================================
   Documents Tab
   ========================================================================== */

.documents-container {
    max-width: 1000px;
}

.document-category {
    margin-bottom: 32px;
}

.document-category h4 {
    margin: 0 0 16px 0;
    font-size: 18px;
    color: #2c3e50;
}

.documents-table {
    width: 100%;
    border-collapse: collapse;
}

.documents-table thead th {
    background: #f8f9fa;
    padding: 12px;
    text-align: left;
    border-bottom: 2px solid #e0e0e0;
    font-weight: 600;
}

.documents-table tbody td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

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

/* ==========================================================================
   History Tab (Timeline)
   ========================================================================== */

.timeline-container {
    max-width: 800px;
    position: relative;
    padding-left: 40px;
}

.timeline-container::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #e0e0e0;
}

.timeline-item {
    position: relative;
    margin-bottom: 24px;
    padding-left: 24px;
}

.timeline-icon {
    position: absolute;
    left: -25px;
    top: 0;
    width: 32px;
    height: 32px;
    background: #2563eb;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.timeline-icon .dashicons {
    color: #fff;
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.timeline-content {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-date {
    font-size: 12px;
    color: #999;
}

.timeline-description {
    font-size: 14px;
    color: #555;
}

/* ==========================================================================
   Notes Tab
   ========================================================================== */

.notes-container {
    max-width: 900px;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.notes-header h3 {
    margin: 0;
}

.note-form {
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 24px;
}

.note-form h4 {
    margin: 0 0 16px 0;
}

.note-form .form-group {
    margin-bottom: 16px;
}

.note-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
}

.note-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
}

.form-actions {
    display: flex;
    gap: 12px;
}

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.note-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 16px;
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0;
}

.note-date {
    font-weight: 600;
    color: #2c3e50;
}

.note-author {
    color: #666;
    font-size: 13px;
}

.note-content {
    font-size: 14px;
}

.soap-section {
    margin-bottom: 12px;
    padding-left: 20px;
}

.soap-section strong {
    color: #2563eb;
    margin-right: 8px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.ennu-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.ennu-btn-primary {
    background: #2563eb;
    color: #fff;
}

.ennu-btn-primary:hover {
    background: #1d4ed8;
}

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

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

.ennu-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.ennu-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.ennu-btn-icon:hover {
    background: #f0f0f0;
}

.ennu-btn-icon .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1024px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .patient-info-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 768px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .ennu-tabs-nav {
        flex-wrap: wrap;
    }

    .ennu-tabs-nav li {
        flex: 1 1 50%;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .ennu-patients-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .ennu-tabs-nav li {
        flex: 1 1 100%;
    }

    .ennu-tabs-nav .tab-link {
        justify-content: flex-start;
    }
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.ennu-error {
    background: #f8d7da;
    color: #721c24;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 16px;
}

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

.mt-16 {
    margin-top: 16px;
}

.mb-16 {
    margin-bottom: 16px;
}
