/* ──────────────────────────────────────────
   CareNara 컴포넌트 스타일
   ────────────────────────────────────────── */

/* ── 모바일 헤더 (햄버거 메뉴) ── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--header-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 200;
  box-shadow: var(--shadow);
}

.mobile-header .logo-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--color-text);
}

.mobile-header .logo-text {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.hamburger-btn {
  width: 36px; height: 36px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius);
  padding: 4px;
}
.hamburger-btn:hover { background: var(--color-bg); }
.hamburger-btn span {
  display: block;
  width: 20px; height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* 사이드바 열렸을 때 햄버거 → ✕ */
.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── 모바일 오버레이 ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── 사이드바 ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: #1e293b;   /* 짙은 슬레이트 */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* 로고 영역 */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 36px; height: 36px;
  background: #2563eb;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.01em;
}

.logo-sub {
  font-size: 0.6875rem;
  color: #94a3b8;
  margin-top: 1px;
}

/* 네비게이션 */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.nav-section-label {
  padding: 12px 20px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: .08em;
  color: #475569;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  margin: 1px 8px;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: transparent;
  width: calc(100% - 16px);
  text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
.nav-item.active { background: rgba(37,99,235,.25); color: #93c5fd; }
.nav-item.active .nav-icon { color: #3b82f6; }

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  opacity: .75;
}
.nav-item.active .nav-icon { opacity: 1; }

/* ── 사이드바 토글 스트립 (logoLink와 nav 사이) ── */
.sidebar-toggle-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08);
  color: #94a3b8;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  user-select: none;
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,.22); color: #fff; }

/* 접힘 상태 — 토글 스트립 중앙 정렬 */
.sidebar-collapsed .sidebar-toggle-strip {
  justify-content: center;
  padding: 6px 0;
}

/* 접힘 상태 — 로고 영역 */
.sidebar-collapsed .sidebar-logo {
  justify-content: center;
  padding: 14px 8px;
  gap: 0;
}
.sidebar-collapsed .logo-name,
.sidebar-collapsed .logo-sub    { display: none; }

/* 접힘 상태 — 네비 레이블·섹션 */
.sidebar-collapsed .nav-section-label { display: none; }
.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 10px 6px;
  margin: 1px 6px;
}
.sidebar-collapsed .nav-item > span:last-child { display: none; }
.sidebar-collapsed .nav-icon { width: 20px; height: 20px; opacity: .85; }

/* 접힘 상태 — 사용자 정보 */
.sidebar-collapsed .user-info,
.sidebar-collapsed .logout-btn span { display: none; }
.sidebar-collapsed .user-card { justify-content: center; }
.sidebar-collapsed .sidebar-footer { padding: 10px 6px; }

/* 접힘 상태 — 토글 버튼 (▶)은 _applyCollapse에서 텍스트로 직접 설정) */

/* hover 시 툴팁 (접힘 상태 전용) */
.sidebar-collapsed .nav-item { position: relative; }
.sidebar-collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%; transform: translateY(-50%);
  background: #0f172a;
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  z-index: 200;
}
.sidebar-collapsed .nav-item:hover::after { opacity: 1; }

/* 사이드바 하단 사용자 정보 */
.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 12px;
  flex-shrink: 0;
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info { min-width: 0; }
.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 1px;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #94a3b8;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.logout-btn:hover { background: rgba(220,38,38,.15); color: #f87171; }

/* ── 모달 ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 500;
  padding: 40px 16px;
  overflow-y: auto;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 580px;
  margin: auto;
  animation: modal-in .2s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(-16px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

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

.modal-title { font-size: 1.0625rem; font-weight: 700; }

.modal-close {
  width: 30px; height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { background: var(--color-bg); color: var(--color-text); }

.modal-body {
  padding: 24px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
}

/* ── 토스트 ── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 280px;
  max-width: 380px;
  pointer-events: all;
  animation: toast-in .25s ease;
  font-size: 0.875rem;
  background: var(--color-surface);
  border-left: 4px solid var(--color-border);
}
.toast.removing { animation: toast-out .2s ease forwards; }

.toast-icon { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-title { font-weight: 600; color: var(--color-text); margin-bottom: 2px; }
.toast-message { color: var(--color-text-muted); line-height: 1.4; }
.toast-close {
  background: none; border: none; cursor: pointer;
  color: var(--color-text-muted); font-size: 1rem; flex-shrink: 0;
}

.toast-success { border-left-color: var(--color-success); }
.toast-error   { border-left-color: var(--color-danger); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-info    { border-left-color: var(--color-primary); }

@keyframes toast-in  { from { opacity: 0; transform: translateX(20px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(20px); } }

/* ── 로그인 페이지 ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #0ea5e9 100%);
  padding: 24px;
}

.login-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 32px;
}

.login-logo-icon {
  width: 64px; height: 64px;
  background: var(--color-primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(37,99,235,.35);
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.login-subtitle {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.login-error {
  background: var(--color-danger-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 0.875rem;
  color: var(--color-danger);
  margin-bottom: 16px;
  display: none;
}
.login-error.show { display: block; }

/* ── 대시보드 현황표 ── */
.today-label {
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  margin-bottom: 20px;
}

.schedule-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-scheduled  { background: #eff6ff; color: #2563eb; }
.status-in_progress{ background: #fef3c7; color: #d97706; }
.status-completed  { background: #dcfce7; color: #16a34a; }
.status-cancelled  { background: #f1f5f9; color: #64748b; }
.status-absent     { background: #fee2e2; color: #dc2626; }

/* ── 백업 페이지 ── */
.backup-list-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.backup-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.backup-filename {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--color-text);
}

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

/* ── 어드민 대시보드 ── */
.admin-hero {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  border-radius: var(--radius-lg);
  padding: 32px;
  color: white;
  margin-bottom: 24px;
}
.admin-hero h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 6px; }
.admin-hero p  { opacity: .8; font-size: 0.875rem; }

.admin-center-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: box-shadow var(--transition);
}
.admin-center-card:hover { box-shadow: var(--shadow-md); }

.center-type-badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.center-type-home_care { background: #eff6ff; color: #2563eb; }
.center-type-day_care  { background: #f0fdf4; color: #16a34a; }
.center-type-combined  { background: #fdf4ff; color: #9333ea; }

/* ── 탭 ── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--color-border);
  margin-bottom: 20px;
}
.tab-btn {
  padding: 10px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color var(--transition), border-color var(--transition);
}
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-btn:hover  { color: var(--color-text); }
