/* Trauma Timeline - EMR 표준 포맷 스타일 */
/* 한 줄 카드 + 상세 펼침, 무채색 기반, Alert만 빨강 */

.trauma-timeline-emr {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* ==================== 핵심 정보 3개 고정 바 ==================== */

.trauma-summary-bar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.summary-item {
    display: flex;
    gap: 6px;
    font-size: 12px;
    line-height: 1.4;
}

.summary-label {
    font-weight: 600;
    color: #6c757d;
}

.summary-value {
    color: #212529;
    font-family: var(--font-mono);
    letter-spacing: var(--letter-spacing-tight);
}

/* ==================== Phase 트랙 (칩 형태) ==================== */

.trauma-phase-track {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
    padding: 12px;
    background: var(--bg-white);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow-x: auto;
}

.phase-chip {
    flex-shrink: 0;
    padding: 6px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    white-space: nowrap;
    transition: all 0.2s;
}

.phase-chip.current {
    background: #e8f4f8;
    border-left: 3px solid #0066cc;
    color: #0066cc;
    font-weight: 600;
    padding-left: 10px;
}

.phase-arrow {
    color: #dee2e6;
    font-size: 12px;
    flex-shrink: 0;
}

/* ==================== X-ABCDE 체크리스트 (고정) ==================== */

.xabcde-checklist-fixed {
    background: var(--bg-white);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
    position: sticky;
    top: 80px;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.xabcde-title {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #0066cc;
}

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

.xabcde-category {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
}

.category-title {
    font-size: 12px;
    font-weight: 600;
    color: #0066cc;
    margin: 0 0 8px 0;
    text-align: left;
    letter-spacing: var(--letter-spacing-tight);
}

.category-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.xabcde-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    line-height: 1.4;
}

.xabcde-item.completed .check-icon {
    color: #28a745;
}

.xabcde-item.incomplete .check-icon {
    color: #adb5bd;
}

.xabcde-item.completed .item-text {
    color: #212529;
    font-weight: 500;
}

.xabcde-item.incomplete .item-text {
    color: #6c757d;
}

.check-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.item-text {
    flex: 1;
    text-align: left;
    letter-spacing: var(--letter-spacing-tight);
}

/* ==================== OR/IR Timeline (고정 라인) ==================== */

.orir-timeline-fixed {
    background: #fff9e6;
    border: 1px solid #ffd700;
    border-left: 3px solid #ffa500;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.orir-title {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffd700;
}

.orir-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.orir-event {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    padding: 8px 12px;
    background: var(--bg-white);
    border: 1px solid #e9ecef;
    border-radius: 4px;
}

.orir-time {
    font-weight: 600;
    color: #212529;
    font-family: var(--font-mono);
    min-width: 45px;
    flex-shrink: 0;
}

.orir-event-name {
    font-weight: 600;
    color: #0066cc;
    min-width: 120px;
    flex-shrink: 0;
    text-align: center;
}

.orir-detail {
    flex: 1;
    color: #495057;
    letter-spacing: var(--letter-spacing-tight);
}

/* ==================== Device Timeline (별도 섹션) ==================== */

.device-timeline-section {
    background: var(--bg-white);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 24px;
}

.device-title {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #6c757d;
}

.device-groups {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.device-group {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 12px;
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
}

.device-name {
    font-size: 13px;
    font-weight: 600;
    color: #212529;
}

.device-type {
    font-size: 11px;
    font-weight: 500;
    color: #6c757d;
    background: var(--bg-white);
    padding: 3px 8px;
    border-radius: 3px;
    border: 1px solid #dee2e6;
}

.device-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.device-event {
    background: var(--bg-white);
    border: 1px solid #e9ecef;
    border-left: 3px solid #dee2e6;
    border-radius: 4px;
    padding: 10px 12px;
}

.device-event-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.device-time {
    font-size: 11px;
    font-weight: 600;
    color: #212529;
    font-family: var(--font-mono);
    min-width: 45px;
}

.device-action {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.device-action.action-insertion {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 3px solid #17a2b8;
}

.device-action.action-status {
    background: #f8f9fa;
    color: #6c757d;
    border-left: 3px solid #6c757d;
}

.device-action.action-removal {
    background: #d4edda;
    color: #155724;
    border-left: 3px solid #28a745;
}

.device-action.action-intubation {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 3px solid #17a2b8;
}

.device-action.action-extubation {
    background: #d4edda;
    color: #155724;
    border-left: 3px solid #28a745;
}

.device-location {
    font-size: 11px;
    color: #6c757d;
    margin-left: 55px;
    margin-bottom: 2px;
    font-style: italic;
}

.device-detail {
    font-size: 11px;
    color: #495057;
    margin-left: 55px;
    line-height: 1.5;
    letter-spacing: var(--letter-spacing-tight);
}

/* ==================== 이벤트 타임라인 ==================== */

/* 섹션 제목 */
.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    margin: 0 0 12px 0;
    padding: 8px 0;
    border-bottom: 2px solid #dee2e6;
}

.trauma-events-section {
    margin-top: 24px;
}

.trauma-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 이벤트 카드 (한 줄 포맷) */
.trauma-event-card {
    background: var(--bg-white);
    border: 1px solid #dee2e6;
    border-left: 3px solid #dee2e6;
    border-radius: 4px;
    padding: 12px 14px;
    transition: all 0.15s ease;
}

.trauma-event-card:hover {
    border-left-color: #0066cc;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

/* Alert 카드 (빨강 강조) */
.trauma-event-card.alert {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.trauma-event-card.alert:hover {
    border-left-color: #dc3545;
    box-shadow: 0 2px 6px rgba(220,53,69,0.15);
}

.trauma-event-card.alert .event-title {
    color: #dc3545;
    font-weight: 600;
}

/* 한 줄 표시 */
.event-oneline {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.event-time {
    font-size: 12px;
    font-weight: 600;
    color: #212529;
    font-family: var(--font-mono);
    min-width: 45px;
    flex-shrink: 0;
}

.event-title {
    font-size: 13px;
    font-weight: 500;
    color: #212529;
    flex: 1;
    letter-spacing: var(--letter-spacing-tight);
}

.event-category {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.expand-icon {
    font-size: 11px;
    color: #6c757d;
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

/* 한 줄 요약 */
.event-summary {
    font-size: 12px;
    color: #6c757d;
    line-height: 1.5;
    margin-left: 57px;
    letter-spacing: var(--letter-spacing-tight);
}

/* 상세 정보 (펼침/접기) */
.event-details {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e9ecef;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.15s ease;
}

.event-details.expanded {
    max-height: 1000px;
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-left: 57px;
}

.detail-list li {
    font-size: 11px;
    color: #495057;
    line-height: 1.6;
    padding: 3px 0 3px 10px;
    position: relative;
    letter-spacing: var(--letter-spacing-tight);
}

.detail-list li::before {
    content: '−';
    position: absolute;
    left: 0;
    color: #6c757d;
}

/* ==================== 빈 상태 ==================== */

.trauma-timeline-empty {
    padding: 60px 20px;
    text-align: center;
    color: #6c757d;
}

.trauma-timeline-empty i {
    font-size: 48px;
    color: #dee2e6;
    margin-bottom: 16px;
}

.trauma-timeline-empty p {
    font-size: 14px;
    margin: 8px 0;
}

/* ==================== 반응형 ==================== */

@media (max-width: 768px) {
    .trauma-summary-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .trauma-phase-track {
        overflow-x: scroll;
    }
    
    .event-summary,
    .detail-list {
        margin-left: 0;
    }
    
    .event-oneline {
        flex-wrap: wrap;
    }
    
    .xabcde-checklist-fixed {
        position: relative;
        top: 0;
    }
    
    .xabcde-categories {
        grid-template-columns: 1fr;
    }
    
    .orir-event {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .orir-event-name {
        min-width: auto;
        text-align: left;
    }
    
    .device-location,
    .device-detail {
        margin-left: 0;
    }
}
