/* ========================================
   병동 대시보드 EMR 스타일
   실제 병원 EMR 레이아웃 적용
   ======================================== */

/* EMR 스타일 테이블 */
.ward-patient-table.emr-style {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    margin-top: 15px;
    border: 1px solid #e9ecef;
    table-layout: fixed; /* 열 너비 고정 - reflow 방지 */
    box-sizing: border-box; /* border 포함 크기 계산 */
}

.ward-patient-table.emr-style thead {
    background: linear-gradient(135deg, #0066cc 0%, #004999 100%);
    color: white;
}

.ward-patient-table.emr-style th {
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    box-sizing: border-box;
}

.ward-patient-table.emr-style td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f1f3f5;
    font-size: 13px;
    vertical-align: middle;
    box-sizing: border-box;
    outline: none; /* focus 시 outline 제거 */
}

/* 행 스타일 */
.ward-patient-table.emr-style tbody tr {
    transition: all 0.15s ease;
    cursor: pointer;
    position: relative;
    box-sizing: border-box;
    outline: none; /* focus 시 outline 제거 */
}

.ward-patient-table.emr-style tbody tr:hover {
    background: #f8f9fa;
}

/* 선택된 행 (좌측 3px 라인으로만 강조, opacity 없음) */
/* box-shadow inset으로 폭 변화 없이 강조 */
.ward-patient-table.emr-style tbody tr.selected {
    background: #f0f7ff;
    box-shadow: inset 3px 0 0 0 #0066cc;
}

/* Bed/No 셀 */
.bed-cell {
    text-align: center !important;
    width: 70px;
    min-width: 70px;
    max-width: 70px;
}

/* 환자명 셀 - 더블클릭 주요 타겟 */
.patient-name-cell {
    font-weight: 500;
    cursor: pointer;
    box-sizing: border-box;
    outline: none; /* focus 시 outline 제거 */
    width: 180px;
    min-width: 180px;
    max-width: 180px;
}

.patient-name-cell:hover {
    background: #e8f4f8;
    box-shadow: inset 0 0 0 1px #0066cc;
}

.patient-name-cell:active {
    background: #d4edda;
}

.patient-name-cell:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px #0066cc;
}

/* 진단명 셀 - 1줄 ellipsis */
.diagnosis-cell {
    max-width: 200px;
    min-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.diagnosis-cell:hover {
    overflow: visible;
    white-space: normal;
    background: #fffef5;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    z-index: 10;
}

/* HD 배지 (인라인) */
.hd-badge-inline {
    display: inline-block;
    background: #e8f4f8;
    color: #0066cc;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.03em;
}

/* HD 셀 */
.hd-cell {
    text-align: center !important;
    width: 60px;
    min-width: 60px;
    max-width: 60px;
}

/* 위험도 배지 - EMR 전용 (센터 컬러와 분리) */
.risk-badge-emr {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.02em;
    min-width: 60px;
    box-sizing: border-box;
}

/* 환자 상태 전용 색상 */
.risk-badge-emr.risk-critical {
    background: #ffe5e5;
    color: #c92a2a;
    border: 1px solid #ffc9c9;
}

.risk-badge-emr.risk-high {
    background: #fff4e6;
    color: #d9480f;
    border: 1px solid #ffe8cc;
}

.risk-badge-emr.risk-moderate {
    background: #fff9db;
    color: #c87800;
    border: 1px solid #ffe066;
}

.risk-badge-emr.risk-low {
    background: #ebfbee;
    color: #2f9e44;
    border: 1px solid #d3f9d8;
}

/* 위험도 셀 */
.risk-cell {
    text-align: center !important;
    width: 80px;
    min-width: 80px;
    max-width: 80px;
}

/* 담당간호사 셀 */
.nurse-cell {
    text-align: center !important;
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

/* 상태/메모 셀 */
.status-cell {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
}

.status-alerts {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.status-tag {
    display: inline-block;
    background: #fff3cd;
    color: #856404;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
    border: 1px solid #ffeaa7;
}

.status-tag-more {
    display: inline-block;
    background: #e9ecef;
    color: #6c757d;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
}

/* 성별 아이콘 */
.fa-mars {
    color: #4A90E2 !important;
}

.fa-venus {
    color: #E24A7F !important;
}

/* 반응형 레이아웃 */
@media (max-width: 1400px) {
    .ward-patient-table.emr-style th,
    .ward-patient-table.emr-style td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .diagnosis-cell {
        max-width: 150px;
    }
}

@media (max-width: 1200px) {
    .status-cell {
        display: none;
    }
}
