/* Timeline Navigator Styles */

.timeline-navigator {
    position: fixed;
    top: 64px;  /* 헤더 높이에 맞춤 */
    left: 280px;
    right: 0;
    background: linear-gradient(to bottom, #ffffff 0%, #f8f9fa 100%);
    border-bottom: 2px solid #0066cc; /* 시스템 블루 고정 */
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    z-index: 999;
    padding: 8px 24px 12px 24px;  /* 좌우 24px 통일 */
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: auto;
    overflow: visible;
    pointer-events: auto;
}

/* 타임라인 숨김 상태 */
.timeline-navigator.collapsed {
    height: 0;
    padding: 0 24px;
    border-bottom-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    overflow: hidden;
}

/* 타임라인 토글 버튼 */
.timeline-toggle-btn {
    position: fixed;
    top: 64px;  /* 헤더 높이에 맞춤 */
    left: 280px;
    right: 0;
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%); /* 시스템 블루 고정 */
    color: white;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 998;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.timeline-toggle-btn:hover {
    background: linear-gradient(135deg, #0052a3 0%, #004080 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.timeline-toggle-btn i {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.timeline-toggle-btn.expanded i.fa-chevron-down {
    transform: rotate(180deg);
}

/* 타임라인이 펼쳐졌을 때 버튼 숨김 */
.timeline-toggle-btn.hidden {
    display: none;
}

/* Timeline Header */
.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;  /* 16px → 8px (절반) */
    position: relative;
}

/* 타임라인 패널 내부 접기 버튼 (우측 상단) */
.timeline-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: #dc3545;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    z-index: 10;
}

.timeline-close-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.timeline-close-btn:active {
    transform: scale(0.95);
}

/* 뇌신경센터: 파란색 접기 버튼 */
body:not(.trauma-center) .timeline-close-btn {
    background: rgba(0, 102, 204, 0.1);
    border-color: rgba(0, 102, 204, 0.3);
    color: #0066cc;
}

body:not(.trauma-center) .timeline-close-btn:hover {
    background: #0066cc;
    color: white;
    border-color: #0066cc;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.3);
}

.timeline-title {
    display: flex;
    align-items: center;
    gap: 6px;  /* 8px → 6px */
    font-size: 13px;  /* 15px → 13px */
    font-weight: 600;
    color: #0066cc;
}

.timeline-title i {
    font-size: 15px;  /* 18px → 15px */
}

.timeline-meta {
    display: flex;
    align-items: center;
    gap: 12px;  /* 16px → 12px */
    font-size: 11px;  /* 13px → 11px */
    color: #666;
}

.total-days {
    background: #e3f2fd;
    color: #0066cc;
    padding: 2px 8px;  /* 4px 12px → 2px 8px (절반) */
    border-radius: 10px;  /* 12px → 10px */
    font-weight: 600;
}

.admission-date {
    color: #666;
}

/* Timeline Track */
.timeline-track {
    position: relative;
    padding: 10px 0;  /* 20px 0 → 10px 0 (절반) */
}

.timeline-progress-bar {
    position: absolute;
    top: 18px;  /* 35px → 18px (절반 정도) */
    left: 50px;
    right: 50px;
    height: 3px;  /* 4px → 3px */
    background: #e0e0e0;
    border-radius: 2px;
    overflow: hidden;
}

.progress-line {
    height: 100%;
    background: linear-gradient(to right, #0066cc 0%, #00a8e8 100%);
    width: 0%;
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* Timeline Days Container */
.timeline-days {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    gap: 8px;
}

/* Individual Timeline Day */
.timeline-day {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.timeline-day:hover {
    transform: translateY(-4px);
}

.timeline-day:hover .day-content {
    background: #f0f7ff;
    box-shadow: 0 6px 16px rgba(0,102,204,0.2);
}

/* Day Marker (Dot) */
.day-marker {
    position: relative;
    width: 30px;  /* 40px → 30px */
    height: 30px;  /* 40px → 30px */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;  /* 8px → 4px (절반) */
    z-index: 2;
}

.day-dot {
    width: 12px;  /* 16px → 12px */
    height: 12px;  /* 16px → 12px */
    background: white;
    border: 3px solid #ccc;  /* 4px → 3px */
    border-radius: 50%;
    transition: all 0.3s ease;
}

.timeline-day:hover .day-dot {
    border-color: #0066cc;
    transform: scale(1.3);
}

.timeline-day.active .day-dot {
    width: 16px;  /* 20px → 16px */
    height: 16px;  /* 20px → 16px */
    border-color: #0066cc;
    background: #0066cc;
    box-shadow: 0 0 0 3px rgba(0,102,204,0.2);  /* 4px → 3px */
}

/* Day Content Card */
.day-content {
    background: white;
    padding: 8px 16px 10px 16px;  /* 좌우 16px 통일 */
    border-radius: 8px;
    text-align: center;
    min-width: 70px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.timeline-day.active .day-content {
    background: linear-gradient(135deg, #0066cc 0%, #00a8e8 100%);
    color: white;
    border-color: #0066cc;
    box-shadow: 0 8px 16px rgba(0,102,204,0.3);
    transform: scale(1.05);
}

.day-number {
    font-size: 10px;  /* 11px → 10px */
    font-weight: 700;
    opacity: 0.8;
    margin-bottom: 2px;  /* 4px → 2px (절반) */
    letter-spacing: 0.5px;
}

.timeline-day.active .day-number {
    opacity: 1;
}

.day-date {
    display: none;  /* 중복 날짜 숨김 */
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 3px;
}

.day-label {
    font-size: 10px;  /* 12px → 10px */
    font-weight: 500;
    margin-bottom: 3px;  /* 6px → 3px (절반) */
    opacity: 0.9;
}

.timeline-day.active .day-label {
    opacity: 1;
}

.day-icon {
    font-size: 18px;  /* 22px → 18px */
    margin-top: 2px;  /* 4px → 2px (절반) */
}

/* Timeline Info */
.timeline-info {
    text-align: center;
    margin-top: 8px;  /* 16px → 8px (절반) */
    padding-top: 6px;  /* 12px → 6px (절반) */
    border-top: 1px solid #e9ecef;
}

.current-day-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;  /* 8px → 6px */
    font-size: 11px;  /* 13px → 11px */
    color: #0066cc;
    font-weight: 500;
}

.current-day-text i {
    font-size: 14px;
}

/* Tooltip */
.timeline-tooltip {
    position: absolute;
    background: #2d3748;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.6;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 280px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.timeline-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #2d3748;
}

.timeline-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.tooltip-content {
    white-space: pre-line;
}

.tooltip-content strong {
    display: block;
    margin-bottom: 6px;
    color: #90cdf4;
    font-size: 14px;
}

.tooltip-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.tooltip-content li {
    padding: 3px 0;
    padding-left: 16px;
    position: relative;
}

.tooltip-content li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: #90cdf4;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .timeline-navigator {
        left: 260px;
    }
    
    .day-content {
        min-width: 75px;
        padding: 10px 6px;
    }
    
    .day-date {
        font-size: 13px;
    }
    
    .day-label {
        font-size: 11px;
    }
    
    .day-icon {
        font-size: 18px;
    }
}

@media (max-width: 1200px) {
    .timeline-meta {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
    
    .admission-date {
        font-size: 11px;
    }
}

@media (max-width: 992px) {
    .timeline-navigator {
        left: 0;
        top: 70px;
    }
    
    .timeline-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .timeline-meta {
        align-items: flex-start;
    }
    
    .timeline-days {
        gap: 4px;
    }
    
    .day-content {
        min-width: 60px;
        padding: 8px 4px;
    }
    
    .day-number {
        font-size: 10px;
    }
    
    .day-date {
        font-size: 12px;
    }
    
    .day-label {
        font-size: 10px;
    }
    
    .day-icon {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .timeline-navigator {
        padding: 12px 16px;
    }
    
    .timeline-progress-bar {
        left: 30px;
        right: 30px;
    }
    
    .day-marker {
        width: 30px;
        height: 30px;
    }
    
    .day-dot {
        width: 12px;
        height: 12px;
        border-width: 3px;
    }
    
    .timeline-day.active .day-dot {
        width: 16px;
        height: 16px;
    }
    
    .day-content {
        min-width: 50px;
        padding: 6px 3px;
    }
    
    .day-number {
        font-size: 9px;
    }
    
    .day-date {
        font-size: 11px;
        margin-bottom: 4px;
    }
    
    .day-label {
        font-size: 9px;
        margin-bottom: 4px;
    }
    
    .day-icon {
        font-size: 14px;
    }
    
    .timeline-info {
        margin-top: 12px;
        padding-top: 10px;
    }
    
    .current-day-text {
        font-size: 11px;
    }
}

/* Animation for progress line */
@keyframes progressAnimation {
    from {
        width: 0%;
    }
}

.progress-line {
    animation: progressAnimation 1s ease-out;
}

/* Pulse animation for active day */
@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(0,102,204,0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(0,102,204,0);
    }
}

.timeline-day.active .day-dot {
    animation: pulse 2s infinite;
}

/* Hover effects for better UX */
.timeline-day:not(.active):hover .day-content {
    border-color: #0066cc;
}

.timeline-day:not(.active):hover .day-number,
.timeline-day:not(.active):hover .day-label {
    color: #0066cc;
}

/* Accessibility improvements */
.timeline-day:focus {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
    border-radius: 8px;
}

.timeline-day:focus-visible {
    outline: 2px solid #0066cc;
    outline-offset: 2px;
}

/* Loading state */
.timeline-navigator.loading {
    opacity: 0.6;
    pointer-events: none;
}

.timeline-navigator.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0066cc;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Print styles */
@media print {
    .timeline-navigator {
        display: none;
    }
}
