/* Patient Management Page Improvements */

.pm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.pm-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    margin-top: 20px;
}

.pm-sidebar {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: fit-content;
}

.pm-main {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.expanddetail {
    background: linear-gradient(135deg, #e8b500 0%, #ffc107 100%);
    color: #856404;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 10px;
    display: block;
}

#patient_filter {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 14px;
}

#patients {
    width: 100%;
    padding: 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 15px;
    background: white;
    font-family: monospace; /* Better for hierarchical structure */
}

/* Hierarchy structure for patients select */
#patients option.optlabel {
    padding: 8px;
    background: linear-gradient(135deg, #35486E 0%, #4A5F7A 100%);
    color: white;
    font-weight: 600;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
}

#patients option.optlabel:hover {
    background: linear-gradient(135deg, #4A5F7A 0%, #35486E 100%);
}

#patients option.specific {
    padding: 4px 8px 4px 24px; /* Indent child items */
    background: #f8f9fa;
    color: #495057;
    border-bottom: 1px solid #e9ecef;
    font-size: 13px;
    cursor: pointer;
    border-left: 3px solid #35486E;
    margin-left: 2px;
}

#patients option.specific:hover {
    background-color: #e3f2fd;
    color: #1976d2;
    border-left-color: #1976d2;
}

/* Status color coding for patient options */
#patients option.specific[value*="Active"] {
    border-left-color: #28a745;
}

#patients option.specific[value*="Pending"] {
    border-left-color: #ffc107;
}

#patients option.specific[value*="Completed"] {
    border-left-color: #007bff;
}

#patients option.specific[value*="Dropped"] {
    border-left-color: #dc3545;
}

#patients option.specific[value*="Screening"] {
    border-left-color: #17a2b8;
}

/* Hide specific options by default (JavaScript controls visibility) */
#patients option.specific {
    display: none;
}

/* When JavaScript shows the specific options */
#patients option.specific[style*="display: block"],
#patients option.specific[style*="display:block"] {
    display: block !important;
}

.pm-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Enhanced styling for Show All / Hide All buttons */
.pm-buttons .formbutton {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pm-buttons .formbutton:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(23, 162, 184, 0.3);
}

/* Improved select list styling */
#patients {
    border: 2px solid #dee2e6;
    border-radius: 8px;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-height: 300px;
    overflow-y: auto;
}

/* Custom scrollbar for patients list */
#patients::-webkit-scrollbar {
    width: 8px;
}

#patients::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

#patients::-webkit-scrollbar-thumb {
    background: #35486E;
    border-radius: 4px;
}

#patients::-webkit-scrollbar-thumb:hover {
    background: #2a3a56;
}

.pm_field {
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.pm_field:not(.lock):focus {
    border-color: #35486E;
    box-shadow: 0 0 0 3px rgba(53, 72, 110, 0.1);
}

.pm_field.lock {
    background-color: #f8f9fa;
    color: #6c757d;
}

.demofields {
    padding: 15px;
    border-radius: 6px;
    margin: 15px 0;
}

.pm-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.visits_info {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    border-radius: 6px;
    margin: 8px 0;
    border: 1px solid #dee2e6;
}

/* Status indicators */
.status-active { color: #28a745; font-weight: 600; }
.status-pending { color: #ffc107; font-weight: 600; }
.status-completed { color: #007bff; font-weight: 600; }
.status-dropped { color: #dc3545; font-weight: 600; }
.status-screening { color: #17a2b8; font-weight: 600; }

@media (max-width: 768px) {
    .pm-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .pm-sidebar {
        order: 2;
    }
    
    .pm-main {
        order: 1;
    }
}
