/* Modern Professional App Styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  /* Color Palette */
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --secondary-light: #94a3b8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #06b6d4;
  
  /* Neutrals */
  --white: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Borders */
  --border-radius: 8px;
  --border-radius-sm: 4px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  
  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  
  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--gray-700);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--gray-50);
}

.sidebar {
  width: 264px;
  background: linear-gradient(135deg, var(--gray-900) 0%, var(--gray-800) 100%);
  color: var(--white);
  flex-shrink: 0;
  box-shadow: var(--shadow-xl);
  border-right: 1px solid var(--gray-200);
  position: fixed;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: var(--space-8) var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
}

.sidebar-logo {
  max-width: 100%;
  height: auto;
  max-height: 80px;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  margin-left: -8px;
}

.sidebar-nav {
  padding: var(--space-4) 0;
  flex: 1;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin: 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  padding: var(--space-4) var(--space-6);
  color: var(--gray-300);
  text-decoration: none;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
  font-weight: 500;
  font-size: calc(var(--text-sm) + 1px);
}

.sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
  border-left-color: var(--primary-light);
}

.sidebar-nav a.active {
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border-left-color: var(--white);
  box-shadow: inset var(--shadow-sm);
}

.sidebar-nav a i {
  width: 22px;
  margin-right: var(--space-3);
  text-align: center;
  font-size: calc(var(--text-base) + 2px);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: auto;
}

.user-info {
  display: flex;
  flex-direction: column;
  margin-bottom: var(--space-3);
  padding: var(--space-2) 0;
}

.user-info span {
  color: var(--white);
  font-size: calc(var(--text-sm) + 1px);
  font-weight: 500;
}

.user-role {
  color: var(--gray-300);
  font-size: calc(var(--text-xs) + 1px);
  font-weight: 400;
}

.logout-btn {
  display: inline-block;
  width: 100%;
  padding: var(--space-2) var(--space-4);
  background: rgba(239, 68, 68, 0.9);
  color: var(--white);
  text-decoration: none;
  border-radius: var(--border-radius);
  font-size: calc(var(--text-sm) + 1px);
  font-weight: 500;
  text-align: center;
  transition: background 0.2s ease;
}

.logout-btn:hover {
  background: var(--danger);
}

.main-content {
  flex: 1;
  margin-left: 264px;
  background: var(--gray-50);
  min-height: 100vh;
}

.content-wrapper {
  max-width: 1600px;
  margin: 0 auto;
  padding: var(--space-8);
}

/* Container */
.container {
  max-width: 1600px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--gray-200);
}

/* Headers */
.header {
  text-align: center;
  margin-bottom: var(--space-8);
  padding: var(--space-8);
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
}

.header h1 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-3);
  font-weight: 700;
  letter-spacing: -0.025em;
}

.header .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: var(--text-base);
  font-weight: 400;
}

/* Sections */
.section {
  margin-bottom: var(--space-8);
  background: var(--white);
  border-radius: var(--border-radius-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.section:hover {
  box-shadow: var(--shadow-md);
}

.section-title {
  background: linear-gradient(135deg, var(--gray-800) 0%, var(--gray-700) 100%);
  color: var(--white);
  padding: var(--space-4) var(--space-6);
  font-weight: 600;
  font-size: var(--text-lg);
  border: none;
  letter-spacing: -0.015em;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  background: var(--white);
}

th, td {
  border: 1px solid var(--gray-200);
  padding: var(--space-4);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--gray-50);
  font-weight: 600;
  color: var(--gray-700);
  font-size: var(--text-sm);
  letter-spacing: 0.025em;
  text-transform: uppercase;
}

td {
  background: var(--white);
}

tr:hover td {
  background: var(--gray-50);
}

/* Forms */
input, select, textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  font-family: inherit;
  transition: all 0.2s ease;
  background: var(--white);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:disabled, select:disabled, textarea:disabled {
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  min-height: 40px;
  letter-spacing: 0.025em;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--white);
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-400);
}

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

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning) 0%, #d97706 100%);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  min-height: 32px;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  min-height: 48px;
}

/* Grid Systems */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

/* Form Groups */
.form-group {
  margin-bottom: var(--space-5);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  color: var(--gray-700);
  font-size: var(--text-sm);
}

.form-group label.required::after {
  content: " *";
  color: var(--danger);
}

/* Checkbox & Radio Groups */
.checkbox-group, .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

.checkbox-group label, .radio-group label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: 0;
  cursor: pointer;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius);
  transition: background 0.2s ease;
  font-weight: normal;
  white-space: nowrap;
}

.checkbox-group label:hover, .radio-group label:hover {
  background: var(--gray-50);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  overflow: hidden;
  transition: all 0.2s ease;
}

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

.card-header {
  padding: var(--space-6);
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.card-body {
  padding: var(--space-6);
}

.card-footer {
  padding: var(--space-6);
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: 9999px;
  letter-spacing: 0.025em;
}

.badge-primary {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-dark);
}

.badge-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
}

.badge-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
}

.badge-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
}

/* Alerts */
.alert {
  padding: var(--space-4) var(--space-6);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-4);
  border-left: 4px solid;
  font-weight: 500;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  color: #065f46;
  border-left-color: var(--success);
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #991b1b;
  border-left-color: var(--danger);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  border-left-color: var(--warning);
}

.alert-info {
  background: rgba(6, 182, 212, 0.1);
  color: #0e7490;
  border-left-color: var(--info);
}

/* Loading States */
.loading {
  opacity: 0.6;
  pointer-events: none;
  position: relative;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--gray-300);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s ease-in-out infinite;
}

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

/* Animations */
.fade-in {
  animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.slide-up {
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    width: 244px;
  }
  
  .main-content {
    margin-left: 244px;
  }
  
  .content-wrapper {
    padding: var(--space-6);
  }
}

@media (max-width: 768px) {
  .sidebar {
    position: fixed !important;
    top: 60px !important;
    left: -264px !important;
    height: calc(100vh - 60px) !important;
    z-index: 1002 !important;
    transition: left 0.3s ease !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25) !important;
    background: linear-gradient(135deg, #111827 0%, #1f2937 100%) !important;
    width: 264px !important;
    display: flex !important;
    flex-direction: column !important;
  }
  
  .sidebar.mobile-open {
    left: 0 !important;
  }
  
  /* 모바일 사이드바 오버레이 */
  .sidebar.mobile-open::before {
    content: '';
    position: fixed;
    top: 60px;
    left: 264px;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: var(--space-4);
  }
  
  .grid-2 {
    grid-template-columns: 1fr;
  }
  
  .grid-3 {
    grid-template-columns: 1fr;
  }
  
  .header h1 {
    font-size: var(--text-2xl);
  }
  
  .section-title {
    font-size: var(--text-base);
    padding: var(--space-3) var(--space-4);
  }
  
  .checkbox-group, .radio-group {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

@media (max-width: 480px) {
  .content-wrapper {
    padding: var(--space-3);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .btn + .btn {
    margin-top: var(--space-2);
  }
}

/* Print Styles */
@media print {
  .sidebar {
    display: none;
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .content-wrapper {
    padding: 0;
    max-width: none;
  }
  
  .section {
    box-shadow: none;
    border: 1px solid #ccc;
    margin-bottom: var(--space-4);
    break-inside: avoid;
  }
  
  .btn {
    display: none;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Focus States for Accessibility */
*:focus {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

button:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  border-color: var(--primary);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --gray-100: #ffffff;
    --gray-200: #e5e5e5;
    --gray-300: #cccccc;
    --gray-800: #1a1a1a;
    --gray-900: #000000;
  }
}

/* Survey Form Specific Styles (Backward Compatibility) */
.button-group {
  text-align: center;
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-300);
  background: var(--gray-50);
  padding: var(--space-6);
  border-radius: var(--border-radius-lg);
  margin: var(--space-8) 0;
}

.button-group .btn {
  min-width: 120px;
  padding: var(--space-3) var(--space-6);
  font-weight: 500;
  font-size: var(--text-sm);
  border-radius: var(--border-radius);
  transition: all 0.2s ease;
  margin: 0 var(--space-2);
}

/* 테이블 열 너비 균등 분배를 위한 colgroup 스타일 */
table colgroup col {
  background-color: transparent;
}

/* 시간 입력 필드 스타일 */
input[type="time"] {
  padding: var(--space-2) var(--space-3);
  width: 100px;
  font-family: inherit;
}

/* 급여제공계획 테이블 컬럼 너비 조정 */
.service-table {
  table-layout: fixed;
}

.service-table th:nth-child(1),
.service-table td:nth-child(1) {
  width: 7%; /* 급여종류 컬럼 */
}

.service-table th:nth-child(2),
.service-table td:nth-child(2) {
  width: 9%; /* 필요영역 컬럼 축소 */
}

.service-table th:nth-child(3),
.service-table td:nth-child(3) {
  width: 24%; /* 필요내용 컬럼 축소 */
}

.service-table th:nth-child(4),
.service-table td:nth-child(4) {
  width: 20%; /* 제공/미제공 컬럼 */
}

.service-table th:nth-child(5),
.service-table td:nth-child(5) {
  width: 40%; /* 확인내용 컬럼 확대 */
}

/* 질병 카테고리 스타일 */
.disease-category {
  background: rgba(37, 99, 235, 0.1);
  padding: var(--space-2) var(--space-3);
  margin: var(--space-4) 0 var(--space-3) 0;
  border-radius: var(--border-radius);
  font-weight: 600;
  color: var(--primary-dark);
  border-left: 4px solid var(--primary);
}

/* 심신상태 변화 테이블 개선 */
.change-table {
  table-layout: fixed;
  width: 100%;
}

/* 헤더 컬럼 너비 */
.change-table .state-header {
  width: 30%;
  text-align: left;
  font-weight: 600;
  background: var(--gray-50);
  padding: var(--space-3) var(--space-4);
}

.change-table .radio-header {
  width: 5%;
  text-align: center;
  font-weight: 600;
  background: var(--gray-50);
  padding: var(--space-3) var(--space-2);
  font-size: var(--text-xs);
}

.change-table .reason-header {
  width: 55%;
  text-align: left;
  font-weight: 600;
  background: var(--gray-50);
  padding: var(--space-3) var(--space-4);
}

/* 일반 셀 스타일 */
.change-table td {
  text-align: center;
  vertical-align: middle;
  padding: var(--space-3) var(--space-2);
  border: 1px solid var(--gray-300);
}

/* 메인 카테고리 (나. 신체상태) */
.change-table .main-category {
  width: 15%;
  text-align: left;
  font-weight: 600;
  padding: var(--space-4);
  background: rgba(37, 99, 235, 0.05);
  vertical-align: top;
  border-right: 2px solid var(--primary);
}

/* 서브 카테고리 (가) 보행, 나) 신체기능 등) */
.change-table .sub-category {
  width: 15%;
  text-align: left;
  font-weight: 500;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-50);
}

/* 일반 카테고리 (colspan="2" 항목들) */
.change-table td[colspan="2"] {
  width: 30%;
  text-align: left;
  font-weight: 500;
  padding: var(--space-3) var(--space-4);
  background: var(--white);
}

/* 판단근거 textarea 셀 */
.change-table td:last-child {
  text-align: left;
  padding: var(--space-2);
}

/* 라디오 버튼 스타일 */
.change-table input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* textarea 스타일 */
.change-table textarea {
  min-height: 50px;
  width: 100%;
  resize: vertical;
  padding: var(--space-2);
  font-size: var(--text-sm);
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius);
}

/* 상담 섹션 개선 */
.consultation-wrapper {
  position: relative;
}

.consultation-wrapper textarea {
  min-height: 150px;
  padding: var(--space-4);
  line-height: 1.8;
  background: var(--gray-50);
  border: 2px solid var(--gray-300);
}

/* 서명 테이블 최적화 */
.signature-table input {
  max-width: 150px;
}

/* 방문일시 섹션 스타일 */
.visit-datetime-wrapper {
  display: flex;
  gap: var(--space-8);
  align-items: flex-start;
}

.visit-datetime-inputs {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.visit-date-input {
  width: 160px;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  transition: border-color 0.2s;
}

.visit-date-input:focus {
  border-color: var(--primary);
}

.visit-time-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--gray-50);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-300);
}

.visit-time-wrapper input[type="time"] {
  width: 110px;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
}

.visit-time-wrapper span {
  font-weight: 500;
  color: var(--gray-700);
  font-size: var(--text-base);
}

.visit-type-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  background: rgba(37, 99, 235, 0.05);
  border-radius: var(--border-radius);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.visit-type-options label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--white);
  border-radius: var(--border-radius);
  border: 2px solid var(--gray-300);
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  color: var(--gray-700);
  font-size: var(--text-sm);
}

.visit-type-options label:hover {
  border-color: var(--primary);
  background: var(--gray-50);
}

.visit-type-options input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.visit-type-options input[type="radio"]:checked + label {
  border-color: var(--primary);
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary-dark);
}

/* 방문장소 스타일 */
.visit-place-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.visit-place-wrapper label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
  padding: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.visit-place-wrapper input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.other-place-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
  margin: 0;
  padding: var(--space-1) var(--space-2);
  font-size: var(--text-sm);
}

.other-place-input {
  width: 200px;
  height: 30px;
  padding: var(--space-2) var(--space-3);
  margin: 0 0 0 var(--space-2);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  vertical-align: middle;
}

/* 방문불가 사유 스타일 */
.other-reason-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
  min-height: 32px;
  padding: var(--space-1) var(--space-2);
}

.other-reason-input {
  width: auto;
  min-width: 120px;
  max-width: 200px;
  height: 26px;
  padding: var(--space-1) var(--space-2);
  margin: 0;
  vertical-align: middle;
}

/* 서명 관련 스타일 */
.signature-info-table {
  table-layout: fixed;
}

.signature-info-table th {
  width: 15%;
}

.signature-info-table td {
  width: 35%;
}

.signature-preview {
  display: none;
  height: 40px;
  vertical-align: middle;
  margin-left: var(--space-3);
}

.btn-sign {
  padding: var(--space-2) var(--space-4);
  margin-left: var(--space-3);
  background: var(--info);
  color: var(--white);
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: 500;
  transition: background 0.2s;
}

.btn-sign:hover {
  background: #0891b2;
}

/* 영양상태 스타일 */
.nutrition-detail {
  margin-top: var(--space-3);
}

.other-nutrition-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.other-nutrition-input {
  width: 150px;
  margin-left: var(--space-2);
}

/* 질병 관련 스타일 */
.disease-status {
  margin-bottom: var(--space-4);
}

.disease-group {
  margin-bottom: var(--space-4);
}

/* 기능 관련 기타 입력 */
.other-function-input {
  width: 150px;
  margin-left: var(--space-2);
}

.other-urination-label,
.other-defecation-label,
.other-living-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

/* 인지 및 행동증상 스타일 */
.cognitive-status,
.behavior-status {
  margin-bottom: var(--space-3);
}

/* Survey Form Checkbox/Radio Override */
.section .checkbox-group,
.section .radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-start;
}

.section .checkbox-group label,
.section .radio-group label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: var(--space-1) var(--space-2);
  cursor: pointer;
  font-weight: normal;
  white-space: nowrap;
  font-size: var(--text-sm);
  border-radius: var(--border-radius-sm);
  transition: background 0.2s ease;
  min-height: 32px;
  vertical-align: top;
}

.section .checkbox-group label:hover,
.section .radio-group label:hover {
  background: var(--gray-50);
}

.section .checkbox-group input[type="checkbox"],
.section .checkbox-group input[type="radio"],
.section .radio-group input[type="checkbox"],
.section .radio-group input[type="radio"] {
  width: auto;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}

/* 질병 그룹 특별 스타일 */
.disease-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.disease-group label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  margin: 0;
  white-space: nowrap;
  font-size: var(--text-sm);
  cursor: pointer;
  border-radius: var(--border-radius-sm);
  transition: background 0.2s ease;
}

.disease-group label:hover {
  background: var(--gray-50);
}

/* 영양상태 상세 */
.nutrition-detail {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.nutrition-detail label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
  margin: 0;
  padding: var(--space-1);
}

/* 기타 입력 라벨 스타일 - 라디오/체크박스와 인풋이 함께 있는 경우 */
.other-nutrition-label,
.other-reason-label,
.other-place-label,
.other-function-input {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

/* 기타 입력 필드가 포함된 라벨의 특별 스타일 */
.section .checkbox-group label.other-nutrition-label,
.section .checkbox-group label.other-reason-label,
.section .checkbox-group label.other-place-label,
.section .radio-group label.other-nutrition-label,
.section .radio-group label.other-reason-label,
.section .radio-group label.other-place-label {
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  white-space: nowrap;
}

/* 기타 입력 필드 자체 스타일 */
.other-nutrition-input,
.other-reason-input,
.other-place-input,
.other-function-input {
  width: auto;
  min-width: 120px;
  max-width: 200px;
  padding: var(--space-1) var(--space-2);
  margin: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-sm);
  height: 26px;
  line-height: 1.4;
  vertical-align: middle;
}

/* 라디오/체크박스 그룹 내에서 인풋이 있는 라벨의 높이 맞춤 */
.section .checkbox-group,
.section .radio-group {
  align-items: flex-start;
}

.section .checkbox-group label,
.section .radio-group label {
  min-height: 32px;
  align-items: center;
  padding: var(--space-1) var(--space-2);
}

/* 체크박스/라디오 버튼 자체 정렬 */
.section input[type="checkbox"],
.section input[type="radio"] {
  margin: 0;
  vertical-align: middle;
  flex-shrink: 0;
}

/* 기본정보 섹션 테이블 열 너비 통일 */
.section:first-child table {
  table-layout: fixed;
  width: 100%;
}

/* 기본정보 섹션의 모든 테이블 헤더 통일 */
.section:first-child table th {
  width: 15%;
  min-width: 120px;
  white-space: nowrap;
  text-align: left;
  vertical-align: middle;
}

.section:first-child table td {
  width: 35%;
  vertical-align: middle;
}

/* 첫 번째 테이블의 4번째 열 */
.section:first-child table:first-child tr td:nth-child(4) {
  width: 35%;
}

/* colspan이 있는 td의 경우 */
.section:first-child table td[colspan="3"] {
  width: 85%;
}

/* 방문일시, 방문장소가 있는 테이블 */
.section:first-child table:not(:first-child) th {
  width: 15%;
}

.section:first-child table:not(:first-child) td {
  width: 85%;
}

/* 2. 욕구조사 섹션 테이블 스타일 */
.section:nth-child(2) table {
  table-layout: fixed;
  width: 100%;
  margin-bottom: var(--space-4);
}

/* 욕구조사 섹션의 기본 헤더와 내용 */
.section:nth-child(2) table th {
  width: 15%;
  min-width: 120px;
  white-space: nowrap;
  text-align: left;
  vertical-align: top;
  padding: var(--space-4);
}

.section:nth-child(2) table td {
  width: 85%;
  vertical-align: top;
  padding: var(--space-4);
}

/* 신체상태 테이블 - rowspan이 있는 복합 테이블 */
.section:nth-child(2) table th[rowspan] {
  width: 12%;
  vertical-align: top;
  min-width: 100px;
}

.section:nth-child(2) table th:not([rowspan]) {
  width: 18%;
  min-width: 120px;
}

.section:nth-child(2) table td {
  width: 70%;
  min-width: 300px;
}

/* 라. 일상생활기능 테이블 - 단일 헤더 */
.section:nth-child(2) table:last-of-type th {
  width: 15%;
  min-width: 120px;
}

.section:nth-child(2) table:last-of-type td {
  width: 85%;
}

/* grid-2 레이아웃 개선 */
.section:nth-child(2) .grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  width: 100%;
}

.section:nth-child(2) .grid-2 > div {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.section:nth-child(2) .grid-2 label {
  font-weight: 500;
  color: var(--gray-700);
  margin-bottom: var(--space-1);
  font-size: var(--text-sm);
}

.section:nth-child(2) .grid-2 select {
  width: 100%;
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
}

/* 욕구조사 섹션의 select 박스 통일 */
.section:nth-child(2) select {
  padding: var(--space-2) var(--space-3);
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  font-size: var(--text-sm);
  background: var(--white);
  min-width: 200px;
}

.section:nth-child(2) select:focus {
  border-color: var(--primary);
  outline: none;
}

/* 욕구조사 섹션의 기타 입력 필드 스타일 조정 */
.section:nth-child(2) .other-urination-label,
.section:nth-child(2) .other-defecation-label,
.section:nth-child(2) .other-living-label {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  white-space: nowrap;
  margin: 0;
  padding: var(--space-1) var(--space-2);
}

.section:nth-child(2) .other-function-input {
  width: auto;
  min-width: 120px;
  max-width: 180px;
  height: 26px;
  padding: var(--space-1) var(--space-2);
  margin: 0;
  border: 1px solid var(--gray-300);
  border-radius: var(--border-radius-sm);
  font-size: var(--text-sm);
  vertical-align: middle;
}

/* Sidebar 도입문의 섹션 스타일 */
.sidebar .contact-section {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  margin: 20px 15px;
  padding: 22px 18px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.sidebar .contact-section:hover {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.sidebar .contact-header h3 {
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px 0;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.sidebar .contact-header h3 i {
  margin-right: 8px;
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.sidebar .contact-description {
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  text-align: center;
  margin-bottom: 18px;
  line-height: 1.4;
  font-weight: 400;
}

.sidebar .contact-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.sidebar .contact-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar .contact-item:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateX(3px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.sidebar .contact-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  font-size: 12px;
  flex-shrink: 0;
  transition: all 0.3s ease;
}

.sidebar .phone-icon {
  background: linear-gradient(135deg, #4CAF50, #45a049);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.sidebar .email-icon {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.sidebar .web-icon {
  background: linear-gradient(135deg, #FF9800, #F57C00);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.3);
}

.sidebar .contact-item:hover .contact-icon {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.sidebar .contact-icon i {
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.sidebar .contact-content {
  flex: 1;
  min-width: 0;
}

.sidebar .contact-content a {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: block;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.sidebar .phone-icon + .contact-content a:hover {
  color: #4CAF50;
  text-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

.sidebar .email-icon + .contact-content a:hover {
  color: #2196F3;
  text-shadow: 0 0 8px rgba(33, 150, 243, 0.6);
}

.sidebar .web-icon + .contact-content a:hover {
  color: #FF9800;
  text-shadow: 0 0 8px rgba(255, 152, 0, 0.6);
}

.sidebar .contact-footer {
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 500;
}

.sidebar .contact-footer i {
  margin-right: 5px;
  color: #FFD700;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* 모바일 반응형 */
@media (max-width: 768px) {
  .sidebar .contact-section {
    margin: 15px 10px;
    padding: 18px 15px;
  }
  
  .sidebar .contact-item {
    padding: 6px 10px;
  }
  
  .sidebar .contact-icon {
    width: 24px;
    height: 24px;
    margin-right: 8px;
  }
  
  .sidebar .contact-content a {
    font-size: 11px;
  }
  
  /* 모바일 사이드바 디자인 업데이트 */
  .sidebar {
    background: #ffffff !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15) !important;
    border-right: 1px solid #e5e7eb !important;
  }
  
  /* 모바일에서 로고 숨기기 */
  .sidebar-header {
    display: none !important;
  }
  
  /* 모바일 네비게이션 스타일 업데이트 */
  .sidebar-nav {
    padding-top: 20px;
  }
  
  .sidebar-nav a {
    color: #374151 !important;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 500;
    border-left: 4px solid transparent;
  }
  
  .sidebar-nav a i {
    color: #6b7280;
    font-size: 18px;
    width: 24px;
    margin-right: 12px;
  }
  
  .sidebar-nav a:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
    border-left-color: #3b82f6 !important;
  }
  
  .sidebar-nav a:hover i {
    color: #3b82f6;
  }
  
  .sidebar-nav a.active {
    background: #eff6ff !important;
    color: #1e40af !important;
    border-left-color: #3b82f6 !important;
    box-shadow: none !important;
  }
  
  .sidebar-nav a.active i {
    color: #3b82f6;
  }
  
  /* 모바일 사이드바 푸터 스타일 업데이트 */
  .sidebar-footer {
    background: #f9fafb;
    border-top: 1px solid #e5e7eb !important;
    padding: 16px 24px;
  }
  
  .user-info {
    color: #374151;
  }
  
  .user-info span {
    color: #111827;
    font-weight: 500;
  }
  
  .user-info .user-role {
    color: #6b7280;
    font-size: 13px;
    font-weight: 400;
  }
  
  .logout-btn {
    background: #ef4444 !important;
    color: white !important;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    transition: all 0.2s ease;
  }
  
  .logout-btn:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.25);
  }
  
  /* 모바일 사이드바 오버레이 업데이트 */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    display: none;
  }
  
  .sidebar.mobile-open ~ .sidebar-overlay {
    display: block;
  }
}