/* ========================================
   MAR (Medication Administration Record) 탭 스타일
   ======================================== */

.mar-container {
    padding: 20px;
}

/* MAR 헤더 */
.mar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid #dee2e6;
}

.mar-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.mar-info i {
    color: #0066cc;
    font-size: 20px;
}

/* MAR 범례 */
.mar-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6c757d;
}

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

.status-badge.status-given {
    background: #d3f9d8;
    color: #2f9e44;
    border: 1px solid #8ce99a;
}

.status-badge.status-hold {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.status-badge.status-refused {
    background: #ffe5e5;
    color: #c92a2a;
    border: 1px solid #ffc9c9;
}

.status-badge.status-not-given {
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

/* MAR 테이블 */
.mar-table-wrapper {
    overflow-x: auto;
    margin-bottom: 24px;
}

.mar-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

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

.mar-table th {
    padding: 14px 12px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.mar-table th.med-info-col {
    min-width: 250px;
}

.mar-table th.frequency-col {
    min-width: 100px;
    text-align: center;
}

.mar-table th.time-col {
    min-width: 120px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
}

.mar-table tbody tr {
    border-bottom: 1px solid #e9ecef;
}

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

.mar-table tbody tr.discontinued {
    opacity: 0.5;
    text-decoration: line-through;
}

.mar-table td {
    padding: 12px;
    font-size: 13px;
    vertical-align: middle;
}

/* 약물 정보 셀 */
.med-info-cell {
    border-right: 2px solid #dee2e6;
}

.med-name {
    font-size: 14px;
    font-weight: 600;
    color: #212529;
    margin-bottom: 4px;
}

.med-details {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
}

.med-details .dose {
    font-weight: 500;
    color: #495057;
}

.med-details .route {
    padding: 2px 6px;
    background: #e9ecef;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.hold-params {
    margin-top: 6px;
    padding: 6px 8px;
    background: #fff3cd;
    border-left: 3px solid #ffc107;
    font-size: 11px;
    color: #856404;
    border-radius: 4px;
}

.hold-params i {
    margin-right: 4px;
}

/* Frequency 셀 */
.frequency-cell {
    text-align: center;
    border-right: 2px solid #dee2e6;
}

.frequency-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e7f5ff;
    color: #1971c2;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

/* 시간대 셀 */
.time-cell {
    text-align: center;
    position: relative;
}

.time-cell.not-scheduled {
    background: #f8f9fa;
    color: #adb5bd;
}

.time-cell.scheduled {
    background: #f1f3f5;
}

.slot-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.slot-content i {
    font-size: 18px;
}

.slot-content span {
    font-size: 11px;
    font-weight: 500;
}

.nurse-initials {
    margin-top: 4px;
    font-size: 10px;
    color: #868e96;
    font-style: italic;
}

/* 시간대 셀 - 상태별 색상 */
.time-cell.given {
    background: #d3f9d8;
}

.time-cell.given i {
    color: #2f9e44;
}

.time-cell.hold {
    background: #fff3cd;
}

.time-cell.hold i {
    color: #c87800;
}

.time-cell.refused {
    background: #ffe5e5;
}

.time-cell.refused i {
    color: #c92a2a;
}

.time-cell.not-given {
    background: #f1f3f5;
}

.time-cell.not-given i {
    color: #868e96;
}

/* 툴팁 */
.reason-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 8px;
    padding: 10px 12px;
    background: #212529;
    color: white;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    min-width: 200px;
    max-width: 300px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.time-cell:hover .reason-tooltip {
    display: block;
}

.reason-tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    color: #ffc107;
}

/* MAR 노트 */
.mar-notes {
    margin-top: 24px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #0066cc;
}

.notes-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #495057;
}

.notes-header i {
    color: #0066cc;
}

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

.note-item {
    padding: 10px 12px;
    background: white;
    border-radius: 6px;
    border-left: 3px solid #dee2e6;
}

.note-item.status-hold {
    border-left-color: #ffc107;
    background: #fffef5;
}

.note-item.status-refused {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.note-item.status-not-given {
    border-left-color: #6c757d;
    background: #f8f9fa;
}

.note-time {
    font-size: 11px;
    color: #868e96;
    margin-bottom: 4px;
    font-weight: 500;
}

.note-content {
    font-size: 13px;
    color: #212529;
    margin-bottom: 6px;
    line-height: 1.4;
}

.note-content strong {
    color: #c92a2a;
}

.note-meta {
    display: flex;
    justify-content: flex-end;
    font-size: 11px;
    color: #868e96;
}

.note-meta .nurse {
    font-style: italic;
}

/* 반응형 */
@media (max-width: 1200px) {
    .mar-legend {
        flex-wrap: wrap;
    }
    
    .mar-table th.time-col {
        min-width: 100px;
    }
}
