/* =============================================================================
   수술 스케줄링 시스템 - 스타일시트
   ============================================================================= */

/* CSS Variables - Dark Theme (Default) */
:root {
    /* Color Palette - Deep Medical Theme */
    --bg-primary: #0a0f1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: #1a2332;
    --bg-hover: #243044;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #3b82f6;
    --accent-secondary: #06b6d4;
    --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #06b6d4 100%);
    
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --border-color: #374151;
    --border-light: #2d3748;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);
    
    /* Timing */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
    
    /* Spacing */
    --timeline-hour-width: 80px;
    --room-label-width: 120px;
    --header-height: 70px;
    --sidebar-width: 280px;
    --loading-overlay-bg: rgba(10, 15, 26, 0.9);
}

/* Light Theme */
[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --accent-primary: #2563eb;
    --accent-secondary: #0891b2;
    --accent-gradient: linear-gradient(135deg, #2563eb 0%, #0891b2 100%);
    
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    
    --border-color: #cbd5e1;
    --border-light: #e2e8f0;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(37, 99, 235, 0.2);
    --loading-overlay-bg: rgba(255, 255, 255, 0.9);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

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

/* App Container */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
        var(--bg-primary);
    transition: background var(--transition-normal);
}

[data-theme="light"] .app-container {
    background: 
        radial-gradient(ellipse at 20% 20%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(8, 145, 178, 0.04) 0%, transparent 50%),
        var(--bg-primary);
}

/* =============================================================================
   Header
   ============================================================================= */

.header {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1800px;
    margin: 0 auto;
    padding: 0 2rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 36px;
    height: 36px;
    color: var(--accent-primary);
    animation: pulse 3s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.time-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

/* Theme Toggle Button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

/* 다크 테마에서는 달 아이콘, 라이트 테마에서는 해 아이콘 */
.theme-icon-light {
    display: none;
}

.theme-icon-dark {
    display: block;
}

[data-theme="light"] .theme-icon-light {
    display: block;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}

/* Light theme specific overrides */
[data-theme="light"] .header {
    background: rgba(255, 255, 255, 0.95);
}

[data-theme="light"] .logo-icon {
    color: var(--accent-primary);
}

/* =============================================================================
   App Body (Sidebar + Main)
   ============================================================================= */

.app-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* =============================================================================
   Sidebar
   ============================================================================= */

.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: var(--transition-normal);
    position: fixed;
    left: 0;
    top: var(--header-height);
    bottom: 0;
    height: calc(100vh - var(--header-height));
    z-index: 90;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    transform: translateX(0);
    overflow: hidden;
}

.sidebar.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
}

.sidebar-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-header h3 svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.sidebar-toggle {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.sidebar-toggle:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.sidebar-toggle svg {
    width: 16px;
    height: 16px;
    transition: var(--transition-fast);
}

.sidebar.collapsed .sidebar-toggle svg {
    transform: rotate(180deg);
}

.sidebar-actions {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.btn-new {
    width: 100%;
    background: var(--accent-gradient);
    color: white;
    border: none;
    justify-content: center;
}

.btn-new:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-save {
    width: 100%;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    justify-content: center;
}

.btn-save:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.schedules-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
}

.schedules-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.schedules-empty svg {
    width: 40px;
    height: 40px;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.schedules-empty p {
    font-size: 0.85rem;
}

/* 날짜 그룹 */
.schedule-date-group {
    margin-bottom: 1rem;
}

.schedule-date-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

/* 스케줄 아이템 */
.schedule-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.schedule-item:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.schedule-item.active {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.schedule-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.schedule-item-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.schedule-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.schedule-date {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
    flex-shrink: 0;
    padding: 2px 6px;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.schedule-delete-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.schedule-item:hover .schedule-delete-btn {
    opacity: 1;
}

.schedule-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.schedule-delete-btn svg {
    width: 12px;
    height: 12px;
}

.schedule-stats {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.schedule-stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.schedule-stat svg {
    width: 12px;
    height: 12px;
}

/* 사이드바 토글 버튼 (접힌 상태에서 보이는) */
.sidebar-expand-btn {
    position: fixed;
    left: 0;
    top: calc(var(--header-height) + 1rem);
    width: 32px;
    height: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: var(--transition-fast);
}

.sidebar-expand-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-primary);
}

.sidebar-expand-btn svg {
    width: 16px;
    height: 16px;
}

.sidebar.collapsed ~ .sidebar-expand-btn,
.app-body:has(.sidebar.collapsed) .sidebar-expand-btn {
    display: flex;
}

/* =============================================================================
   Main Content
   ============================================================================= */

.main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* =============================================================================
   Control Panel
   ============================================================================= */

.control-panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.panel-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: var(--transition-normal);
}

.panel-section:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-glow);
}

.panel-section h2 {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.panel-section h2 svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-normal);
    background: rgba(59, 130, 246, 0.02);
}

.upload-area:hover,
.upload-area.drag-over {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.08);
}

.upload-area svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.upload-area p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.file-info {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.file-name {
    font-weight: 500;
    color: var(--text-primary);
}

.case-count {
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* 업로드된 파일 목록 */
.uploaded-files-list {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.uploaded-file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    transition: var(--transition-fast);
}

.uploaded-file-item:hover {
    border-color: var(--accent-primary);
}

.uploaded-file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.uploaded-file-info svg {
    width: 20px;
    height: 20px;
    color: var(--accent-secondary);
    flex-shrink: 0;
}

.uploaded-file-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.uploaded-file-cases {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-secondary);
    flex-shrink: 0;
    margin-left: 0.5rem;
}

.uploaded-file-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-left: 0.75rem;
}

.uploaded-file-download,
.uploaded-file-delete {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.uploaded-file-download:hover {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-primary);
}

.uploaded-file-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.uploaded-file-download svg,
.uploaded-file-delete svg {
    width: 16px;
    height: 16px;
}

.file-summary {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.3);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-cases {
    font-weight: 600;
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.btn svg {
    width: 18px;
    height: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.btn-accent {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-accent:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), 0 0 20px rgba(16, 185, 129, 0.3);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-buttons .btn {
    width: 100%;
    justify-content: center;
}

/* =============================================================================
   Schedule Section
   ============================================================================= */

.schedule-section {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

/* .schedule-header h2 {
    min-width: 30px;
    font-size: 1.25rem;
    font-weight: 600;
} */

.schedule-section h2 {
    min-width: 120px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.schedule-section h2 svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.schedule-legend {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

/* Timeline */
.timeline-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: auto;
}

.timeline-header {
    display: flex;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 10;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.room-label-spacer {
    width: var(--room-label-width);
    min-width: var(--room-label-width);
}

.time-labels {
    display: flex;
    flex: 1;
}

.time-label {
    width: var(--timeline-hour-width);
    min-width: var(--timeline-hour-width);
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    padding: 0.5rem 0;
    border-left: 1px solid var(--border-light);
}

.time-label:first-child {
    border-left: none;
}

/* Rooms Container */
.rooms-container {
    margin-top: 0.5rem;
    min-height: 300px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 300px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state p {
    font-size: 1rem;
}

/* 수술방 추가 버튼 (가로 전체) */
.add-room-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    margin-top: 0.75rem;
    background: var(--bg-tertiary);
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition-normal);
}

.add-room-btn svg {
    width: 20px;
    height: 20px;
    transition: var(--transition-fast);
}

.add-room-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.add-room-btn:hover svg {
    transform: scale(1.1);
}

.add-room-btn:active {
    transform: scale(0.98);
}

/* Room Row */
.room-row {
    display: flex;
    margin-bottom: 0.5rem;
    min-height: 80px;
}

.room-label {
    width: var(--room-label-width);
    min-width: var(--room-label-width);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.room-label-text {
    flex: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: var(--transition-fast);
}

.room-label-text:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.room-label-input {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--accent-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
}

.room-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
}

.room-row:hover .room-delete-btn {
    opacity: 1;
}

.room-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.room-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* Timeline Track */
.timeline-track {
    flex: 1;
    position: relative;
    background: 
        repeating-linear-gradient(
            90deg,
            var(--bg-tertiary) 0px,
            var(--bg-tertiary) 1px,
            transparent 1px,
            transparent var(--timeline-hour-width)
        );
    border-radius: 8px;
    min-height: 100px;
    border: 1px solid var(--border-light);
}

.timeline-track.drag-over {
    background-color: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-primary);
}

/* Surgery Block */
.surgery-block {
    position: absolute;
    top: 8px;
    bottom: 8px;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    cursor: grab;
    transition: var(--transition-fast);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.surgery-block:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-primary);
    z-index: 10;
}

.surgery-block.dragging {
    opacity: 0.8;
    cursor: grabbing;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.surgery-block-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.surgery-case-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    display: flex;
    align-items: center;
}

.surgery-dept {
    font-size: 0.65rem;
    font-weight: 500;
    margin-left: 0.5rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
}

.surgery-delete-btn {
    width: 18px;
    height: 18px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition-fast);
    flex-shrink: 0;
}

.surgery-block:hover .surgery-delete-btn {
    opacity: 1;
}

.surgery-delete-btn:hover {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

.surgery-delete-btn svg {
    width: 12px;
    height: 12px;
}

.surgery-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.surgery-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    margin-top: 4px;
}

/* 컴팩트 모드 (짧은 수술) */
.surgery-block-compact {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    padding: 0.25rem 0.5rem;
}

.surgery-dept-badge-compact {
    width: 18px;
    height: 18px;
    min-width: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

.surgery-compact-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.surgery-delete-btn-compact {
    position: relative;
    opacity: 0;
    width: 16px;
    height: 16px;
    min-width: 16px;
}

.surgery-block-compact:hover .surgery-delete-btn-compact {
    opacity: 1;
}

/* =============================================================================
   Status Panel
   ============================================================================= */

.status-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.status-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.25rem;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition-normal);
}

.status-card:hover {
    border-color: var(--accent-primary);
}

.status-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-icon svg {
    width: 24px;
    height: 24px;
}

.status-icon.scheduled {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-icon.unscheduled {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-icon.rooms {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-primary);
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-primary);
}

.status-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* 미배치 항목 영역 */
.unscheduled-area {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 0.5rem;
}

.unscheduled-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-light);
}

.unscheduled-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--warning);
}

.unscheduled-header h4 svg {
    width: 18px;
    height: 18px;
}

.unscheduled-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.unscheduled-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.unscheduled-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    cursor: grab;
    transition: var(--transition-fast);
    min-width: 180px;
    max-width: 240px;
}

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

.unscheduled-item.dragging {
    opacity: 0.8;
    cursor: grabbing;
    z-index: 100;
    box-shadow: var(--shadow-lg);
}

.unscheduled-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}

.unscheduled-surgeon {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.unscheduled-dept {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    font-weight: 500;
}

.unscheduled-surgery-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.unscheduled-duration {
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-muted);
}

.unscheduled-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.unscheduled-empty svg {
    width: 24px;
    height: 24px;
    color: var(--success);
}

/* =============================================================================
   Loading Overlay
   ============================================================================= */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--loading-overlay-bg);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay.active {
    display: flex;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--bg-tertiary);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
}

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

.loading-content p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Progress Info (SSE 스트리밍) */
.progress-info {
    min-width: 350px;
    max-width: 450px;
}

.progress-title {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.progress-bar {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-stats {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: var(--accent-secondary);
    margin-bottom: 1.5rem;
}

.progress-current {
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border: 1px solid var(--border-color);
}

.current-case-id {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent-primary);
    font-weight: 600;
}

.current-case-name {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.current-case-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: var(--success);
    font-weight: 600;
}

.progress-reasoning {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border-left: 3px solid var(--accent-secondary);
    max-height: 100px;
    overflow-y: auto;
}

.reasoning-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-secondary);
    margin-right: 0.5rem;
}

.reasoning-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    z-index: 1001;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

.toast.info {
    border-color: var(--accent-primary);
}

.toast-icon {
    width: 20px;
    height: 20px;
}

.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.info .toast-icon { color: var(--accent-primary); }

.toast-message {
    flex: 1;
    font-size: 0.95rem;
    color: var(--text-primary);
}

/* =============================================================================
   Modal
   ============================================================================= */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 15, 26, 0.9);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

.modal-content.modal-small {
    max-width: 400px;
}

@keyframes modalIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-close svg {
    width: 18px;
    height: 18px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: 60vh;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

.detail-reasoning {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
}

.detail-reasoning .detail-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--accent-secondary);
}

.reasoning-content {
    background: var(--bg-tertiary);
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

/* 미배치 모달 스타일 */
.modal-section {
    margin-bottom: 1.5rem;
}

.modal-section h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.field-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.field-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

.field-value.highlight {
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
}

.field-value.dept-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    color: white;
    font-size: 0.8rem;
}

.unscheduled-notice {
    padding: 1rem;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--warning);
}

/* =============================================================================
   Responsive
   ============================================================================= */

/* =============================================================================
   Form Styles
   ============================================================================= */

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input[type="text"],
.form-group input[type="date"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition-fast);
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-group input[type="text"]::placeholder {
    color: var(--text-muted);
}

.form-group input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 1200px) {
    .control-panel {
        grid-template-columns: 1fr 1fr;
    }
    
    .action-buttons {
        flex-direction: row;
    }
    
    .sidebar {
        width: 240px;
        min-width: 240px;
    }
}

/* =============================================================================
   Tutorial
   ============================================================================= */

.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
}

.tutorial-overlay.active {
    display: block;
}

.tutorial-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.tutorial-content {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    width: 400px;
    max-width: calc(100vw - 40px);
    z-index: 1001;
    animation: tutorialFadeIn 0.3s ease;
}

@keyframes tutorialFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.tutorial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
}

.tutorial-step-indicator {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.tutorial-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.tutorial-close:hover {
    background: var(--bg-hover);
    color: var(--danger);
}

.tutorial-close svg {
    width: 16px;
    height: 16px;
}

.tutorial-body {
    padding: 1.5rem 1.25rem;
}

.tutorial-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tutorial-step-content {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.tutorial-step-content p {
    margin-bottom: 0.75rem;
}

.tutorial-step-content p:last-child {
    margin-bottom: 0;
}

.tutorial-step-content strong {
    color: var(--text-primary);
    font-weight: 600;
}

.tutorial-footer {
    display: flex;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    gap: 1rem;
}

.tutorial-footer .btn {
    flex: 1;
}

/* 튜토리얼 하이라이트 */
.tutorial-highlight {
    position: relative;
    z-index: 1002;
    box-shadow: 0 0 0 4px var(--accent-primary), 0 0 20px rgba(59, 130, 246, 0.4);
    border-radius: 8px;
}

/* 사이드바는 이미 position: fixed이므로 유지 */
.sidebar.tutorial-highlight {
    position: fixed;
}

/* 튜토리얼 도움말 버튼 */
.tutorial-help-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-gradient);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-fast);
    z-index: 100;
}

.tutorial-help-btn:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.tutorial-help-btn svg {
    width: 24px;
    height: 24px;
}

/* =============================================================================
   Responsive
   ============================================================================= */

@media (max-width: 768px) {
    .control-panel {
        grid-template-columns: 1fr;
    }
    
    .schedule-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .status-panel {
        grid-template-columns: 1fr;
    }
    
    :root {
        --timeline-hour-width: 60px;
        --room-label-width: 100px;
    }
    
    .tutorial-help-btn {
        bottom: 1rem;
        right: 1rem;
        width: 40px;
        height: 40px;
    }
    
    .tutorial-content {
        width: calc(100vw - 40px);
    }
}

