/* ========================================
   EMR Medical System Design - 임상실습 오리엔테이션
   Professional Healthcare UI with Deep Blue
   ======================================== */

/* 폰트 Import - Professional Sans-serif */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+KR:wght@300;400;500;600;700;800&display=swap');

/* 루트 변수 - Medical EMR 색상 팔레트 */
:root {
    /* Primary Medical Blue - 진한 파란색 계열 */
    --medical-primary: #003D82;      /* 진한 의료 블루 */
    --medical-primary-dark: #002952;  /* 더 진한 블루 */
    --medical-primary-light: #005EB8; /* 밝은 의료 블루 */
    --medical-accent: #0072CE;        /* 액센트 블루 */
    
    /* 병원 컬러 (EMR 시스템 느낌) */
    --color-ujb: #005EB8;      /* 의정부 - Medical Blue */
    --color-ujb-dark: #003D82;
    --color-ujb-light: #E6F2FF;
    
    --color-nhis: #00A651;     /* 일산 - Medical Green */
    --color-nhis-dark: #008040;
    --color-nhis-light: #E6F7ED;
    
    --color-khu: #D32F2F;      /* 강동경희대 - Medical Red */
    --color-khu-dark: #B71C1C;
    --color-khu-light: #FFEBEE;
    
    /* UI 색상 */
    --bg-primary: #F8FAFB;           /* 밝은 회색-블루 배경 */
    --bg-secondary: #FFFFFF;          /* 순수 화이트 */
    --bg-tertiary: #EBF3F9;          /* 연한 블루 배경 */
    
    --text-primary: #1A1A1A;         /* 진한 검정 (가독성) */
    --text-secondary: #4A5568;       /* 중간 회색 */
    --text-tertiary: #718096;        /* 연한 회색 */
    --text-white: #FFFFFF;
    
    --border-primary: #E2E8F0;       /* 기본 테두리 */
    --border-secondary: #CBD5E0;     /* 진한 테두리 */
    --border-accent: #005EB8;        /* 액센트 테두리 */
    
    /* Shadow - Professional */
    --shadow-sm: 0 1px 3px rgba(0, 61, 130, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 61, 130, 0.12);
    --shadow-lg: 0 8px 24px rgba(0, 61, 130, 0.16);
    --shadow-xl: 0 16px 40px rgba(0, 61, 130, 0.20);
    
    /* Radius - Medical Sharp */
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Status Colors */
    --status-success: #00A651;
    --status-warning: #FF9800;
    --status-error: #D32F2F;
    --status-info: #0072CE;
}

/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Typography - Medical Professional */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--medical-primary-light);
    text-decoration: none;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--medical-primary);
    text-decoration: underline;
}

/* Buttons - EMR Style */
button, .btn {
    font-family: inherit;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.btn-primary {
    background: var(--medical-primary);
    color: var(--text-white);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
}

.btn-primary:hover {
    background: var(--medical-primary-dark);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--medical-primary);
    border: 2px solid var(--medical-primary);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
}

.btn-secondary:hover {
    background: var(--medical-primary);
    color: var(--text-white);
}

/* Cards - Medical Information Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card-primary {
    border-left: 4px solid var(--medical-primary);
}

.card-success {
    border-left: 4px solid var(--status-success);
}

.card-warning {
    border-left: 4px solid var(--status-warning);
}

.card-error {
    border-left: 4px solid var(--status-error);
}

/* Badges - Medical Labels */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-primary {
    background: var(--medical-primary);
    color: var(--text-white);
}

.badge-success {
    background: var(--status-success);
    color: var(--text-white);
}

.badge-warning {
    background: var(--status-warning);
    color: var(--text-white);
}

.badge-error {
    background: var(--status-error);
    color: var(--text-white);
}

.badge-info {
    background: var(--status-info);
    color: var(--text-white);
}

/* Tables - EMR Data Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

thead {
    background: var(--medical-primary);
    color: var(--text-white);
}

thead th {
    padding: 1rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr {
    border-bottom: 1px solid var(--border-primary);
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: var(--bg-tertiary);
}

tbody tr:last-child {
    border-bottom: none;
}

tbody td {
    padding: 1rem;
    color: var(--text-secondary);
}

/* Forms - Medical Input Fields */
input, textarea, select {
    font-family: inherit;
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--medical-primary-light);
    box-shadow: 0 0 0 3px rgba(0, 94, 184, 0.1);
}

input::placeholder, textarea::placeholder {
    color: var(--text-tertiary);
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
}

/* Modals - Medical Dialog */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-primary);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--border-primary);
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.modal-header h3 {
    color: var(--medical-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 2px solid var(--border-primary);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Alerts - Medical Notifications */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: #E6F7ED;
    border-color: var(--status-success);
    color: #00793D;
}

.alert-warning {
    background: #FFF4E5;
    border-color: var(--status-warning);
    color: #E65100;
}

.alert-error {
    background: #FFEBEE;
    border-color: var(--status-error);
    color: #B71C1C;
}

.alert-info {
    background: #E6F2FF;
    border-color: var(--status-info);
    color: #003D82;
}

/* Loading - Medical Spinner */
.loading {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top-color: var(--medical-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scrollbar - Professional */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--medical-primary-light);
    border-radius: 6px;
    border: 3px solid var(--bg-tertiary);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--medical-primary);
}

/* Utility Classes */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.hidden { display: none !important; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }

/* Responsive */
@media (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .container {
        padding: 0 1rem;
    }
    
    .modal-content {
        border-radius: var(--radius-lg);
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    .no-print {
        display: none !important;
    }
    
    .card {
        break-inside: avoid;
    }
}
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--pastel-bg);
    line-height: 1.7;
    color: var(--pastel-text);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    word-break: keep-all;
    word-wrap: break-word;
}

/* 부드러운 카드 */
.soft-card {
    background: var(--pastel-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid var(--pastel-border);
}

.soft-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-2px);
}

.soft-card-flat {
    background: var(--pastel-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--pastel-border);
}

/* 플로팅 카드 */
.floating-card {
    background: var(--pastel-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-float);
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: none;
}

.floating-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

/* 필 버튼 (Pill-shaped) */
.pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    font-weight: 600;
    font-size: 15px;
    background: linear-gradient(135deg, #B8D4F1 0%, #A8C7E7 100%);
    color: #2D3748;
    border: none;
    border-radius: var(--radius-pill);
    box-shadow: 0 4px 16px rgba(184, 212, 241, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.pill-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(184, 212, 241, 0.4);
}

.pill-btn:active {
    transform: translateY(0);
}

.pill-btn-mint {
    background: linear-gradient(135deg, #B8E6D5 0%, #A0DBC5 100%);
    box-shadow: 0 4px 16px rgba(184, 230, 213, 0.3);
}

.pill-btn-mint:hover {
    box-shadow: 0 8px 24px rgba(184, 230, 213, 0.4);
}

.pill-btn-rose {
    background: linear-gradient(135deg, #F5C6CB 0%, #EFB3BB 100%);
    box-shadow: 0 4px 16px rgba(245, 198, 203, 0.3);
}

.pill-btn-rose:hover {
    box-shadow: 0 8px 24px rgba(245, 198, 203, 0.4);
}

.pill-btn-sm {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
}

.pill-btn-outline {
    background: white;
    border: 2px solid var(--pastel-border);
    color: var(--pastel-text);
    box-shadow: none;
}

.pill-btn-outline:hover {
    background: var(--pastel-bg);
    border-color: #D0DBE6;
}

/* 파스텔 태그 */
.pastel-tag {
    display: inline-block;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    background: var(--pastel-accent);
    color: #E91E63;
    border-radius: var(--radius-pill);
    letter-spacing: 0.02em;
}

.pastel-tag-blue {
    background: #E3F2FD;
    color: #1976D2;
}

.pastel-tag-mint {
    background: #E0F7FA;
    color: #00897B;
}

.pastel-tag-rose {
    background: #FCE4EC;
    color: #C2185B;
}

/* 부드러운 인풋 */
.soft-input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 400;
    background: var(--pastel-card);
    border: 2px solid var(--pastel-border);
    border-radius: var(--radius-md);
    box-shadow: inset 0 2px 8px rgba(149, 157, 165, 0.04);
    transition: all 0.3s ease;
    color: var(--pastel-text);
}

.soft-input:focus {
    outline: none;
    border-color: var(--color-ujb);
    box-shadow: 0 0 0 4px rgba(184, 212, 241, 0.15), inset 0 2px 8px rgba(149, 157, 165, 0.04);
}

.soft-input::placeholder {
    color: var(--pastel-text-light);
    font-weight: 300;
}

/* 부드러운 헤더 */
.soft-header {
    background: var(--gradient-soft);
    border-bottom: 1px solid var(--pastel-border);
    box-shadow: 0 2px 16px var(--pastel-shadow);
    backdrop-filter: blur(10px);
}

/* 아코디언 스타일 */
.accordion-header {
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    border-radius: var(--radius-md);
}

.accordion-header:hover {
    background: rgba(184, 212, 241, 0.06);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.accordion-content.expanded {
    max-height: 3000px;
}

/* 로딩 애니메이션 (부드러운 펄스) */
@keyframes softPulse {
    0%, 100% { 
        opacity: 0.4;
        transform: scale(1);
    }
    50% { 
        opacity: 0.8;
        transform: scale(1.05);
    }
}

.soft-loading {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: var(--color-ujb);
    border-radius: 50%;
    margin: 0 6px;
    animation: softPulse 1.5s ease-in-out infinite;
}

.soft-loading:nth-child(2) {
    animation-delay: 0.3s;
}

.soft-loading:nth-child(3) {
    animation-delay: 0.6s;
}

/* 반응형 - 모바일 우선 */
@media (max-width: 768px) {
    :root {
        --radius-lg: 24px;
        --radius-md: 18px;
    }
    
    .pill-btn {
        padding: 14px 20px;
        font-size: 14px;
        width: 100%;
        white-space: normal;
        line-height: 1.5;
        min-height: 48px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.65;
        padding: 0;
    }
    
    h1 { 
        font-size: 22px !important; 
        font-weight: 700;
        line-height: 1.4;
        word-break: keep-all;
    }
    h2 { 
        font-size: 18px !important; 
        font-weight: 700;
        line-height: 1.4;
        word-break: keep-all;
    }
    h3 { 
        font-size: 16px !important; 
        font-weight: 600;
        line-height: 1.5;
        word-break: keep-all;
    }
    h4 { 
        font-size: 15px !important; 
        font-weight: 600;
        line-height: 1.5;
    }
    
    /* 컨테이너 여백 최적화 */
    .container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
    
    /* 카드 내부 패딩 조정 */
    .soft-card {
        padding: 14px !important;
    }
    
    .floating-card {
        padding: 16px !important;
    }
    
    /* 텍스트 가독성 향상 */
    p, span, div {
        word-break: keep-all;
        overflow-wrap: break-word;
        line-height: 1.65;
    }
    
    /* 긴 단어 강제 줄바꿈 */
    .text-readable {
        font-size: 14px;
        line-height: 1.7;
        word-break: keep-all;
        overflow-wrap: anywhere;
    }
}

/* 터치 디바이스 최적화 */
@media (hover: none) {
    .soft-card:hover {
        transform: none;
    }
    
    .floating-card:hover {
        transform: none;
    }
}

/* 스크롤바 스타일 (부드럽게) */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--pastel-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--pastel-border);
    border-radius: 10px;
    border: 2px solid var(--pastel-bg);
}

::-webkit-scrollbar-thumb:hover {
    background: #CBD5E0;
}

/* 유틸리티 클래스 */
.text-pastel {
    color: var(--pastel-text);
}

.text-pastel-light {
    color: var(--pastel-text-light);
}

.bg-gradient-soft {
    background: var(--gradient-soft);
}

.shadow-soft {
    box-shadow: var(--shadow-soft);
}

.shadow-float {
    box-shadow: var(--shadow-float);
}

.rounded-soft {
    border-radius: var(--radius-md);
}

.rounded-soft-lg {
    border-radius: var(--radius-lg);
}

/* 병원별 부드러운 그라디언트 */
.hospital-gradient-ujb {
    background: var(--gradient-blue);
}

.hospital-gradient-nhis {
    background: var(--gradient-mint);
}

.hospital-gradient-khu {
    background: var(--gradient-rose);
}

/* 부드러운 구분선 */
.soft-divider {
    height: 1px;
    background: var(--pastel-border);
    border: none;
    margin: 24px 0;
}

/* 글로우 효과 (매우 미세하게) */
.soft-glow {
    box-shadow: 0 0 40px rgba(184, 212, 241, 0.2);
}

/* 텍스트 가독성 최우선 */
.text-readable {
    font-size: 15px;
    line-height: 1.7;
    color: var(--pastel-text);
    font-weight: 400;
    word-break: keep-all;
    overflow-wrap: break-word;
}

.text-readable strong {
    font-weight: 600;
    color: #2D3748;
}

/* 테이블 및 리스트 모바일 최적화 */
@media (max-width: 768px) {
    table {
        width: 100%;
        table-layout: auto;
        font-size: 13px;
    }
    
    td, th {
        padding: 8px 6px;
        word-break: keep-all;
        overflow-wrap: break-word;
    }
    
    ul, ol {
        padding-left: 20px;
    }
    
    li {
        margin-bottom: 8px;
        word-break: keep-all;
        line-height: 1.6;
    }
}

/* 부드러운 포커스 링 */
*:focus-visible {
    outline: 3px solid rgba(184, 212, 241, 0.4);
    outline-offset: 2px;
    border-radius: 8px;
}

/* 추가 모바일 최적화 */
@media (max-width: 768px) {
    /* 이미지 반응형 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 버튼 터치 영역 최적화 */
    button, a.pill-btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* 입력 필드 확대 방지 */
    input, textarea, select {
        font-size: 16px !important;
    }
    
    /* 가로 스크롤 방지 */
    * {
        max-width: 100%;
    }
    
    /* 테이블 가로 스크롤 */
    .overflow-x-auto {
        -webkit-overflow-scrolling: touch;
    }
}

/* 아이폰 노치 대응 */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
}

/* 갤럭시 폴드 대응 */
@media (max-width: 280px) {
    body {
        font-size: 13px;
    }
    
    h1 { font-size: 18px !important; }
    h2 { font-size: 16px !important; }
    h3 { font-size: 14px !important; }
    
    .pill-btn {
        font-size: 13px;
        padding: 10px 14px;
    }
}
