/* ============================================
   공무원 업무관리 시스템 - 스타일시트
   ============================================ */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --sidebar-width: 260px;
  --header-height: 60px;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #6366f1;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Malgun Gothic', sans-serif; }

/* ---- 레이아웃 ---- */
#app-layout { display: flex; min-height: 100vh; }

/* ---- 사이드바 ---- */
#sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e3a5f 0%, #1e40af 100%);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
  overflow-y: auto;
}
#sidebar .logo-area {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
#sidebar .logo-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
#sidebar .logo-title { font-size: 14px; font-weight: 700; line-height: 1.3; }
#sidebar .logo-subtitle { font-size: 11px; color: rgba(255,255,255,0.6); }

#sidebar nav { padding: 12px 8px; flex: 1; }
.nav-section { margin-bottom: 4px; }
.nav-section-title {
  font-size: 10px; font-weight: 600;
  color: rgba(255,255,255,0.4);
  padding: 8px 12px 4px;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  color: rgba(255,255,255,0.75);
  font-size: 13px; font-weight: 500;
  text-decoration: none;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.12); color: white; }
.nav-item.active { background: rgba(255,255,255,0.2); color: white; font-weight: 600; }
.nav-item .nav-icon { width: 18px; text-align: center; font-size: 14px; }

#sidebar .user-area {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
}

/* ---- 메인 콘텐츠 ---- */
#main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ---- 헤더 ---- */
#top-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center;
  padding: 0 20px;
  position: sticky; top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#menu-toggle { display: none; }

/* ---- 페이지 콘텐츠 ---- */
#page-content { padding: 20px; flex: 1; }

/* ---- 카드 ---- */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  border: 1px solid #f0f0f0;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: #1f2937; }
.card-body { padding: 16px 20px; }

/* ---- 통계 카드 ---- */
.stat-card {
  background: white;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  border: 1px solid #f0f0f0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-value { font-size: 26px; font-weight: 700; color: #1f2937; }
.stat-label { font-size: 12px; color: #6b7280; }

/* ---- 상태/우선순위 뱃지 ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-todo { background: #f3f4f6; color: #6b7280; }
.badge-in-progress { background: #dbeafe; color: #1d4ed8; }
.badge-review { background: #fef3c7; color: #d97706; }
.badge-done { background: #d1fae5; color: #065f46; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-urgent { background: #fee2e2; color: #dc2626; }
.badge-high { background: #ffedd5; color: #ea580c; }
.badge-normal { background: #eff6ff; color: #3b82f6; }
.badge-low { background: #f0fdf4; color: #16a34a; }

/* ---- 버튼 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s; border: none; text-decoration: none;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f3f4f6; color: #374151; }
.btn-secondary:hover { background: #e5e7eb; }
.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* ---- 폼 요소 ---- */
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 12px;
  border: 1px solid #d1d5db; border-radius: 8px;
  font-size: 13px; color: #374151;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-label { display: block; font-size: 12px; font-weight: 600; color: #374151; margin-bottom: 4px; }
.form-group { margin-bottom: 14px; }

/* ---- 테이블 ---- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: #f9fafb; padding: 10px 14px;
  text-align: left; font-size: 12px; font-weight: 600;
  color: #6b7280; border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 13px; color: #374151;
}
.data-table tr:hover td { background: #f9fafb; }
.data-table tr:last-child td { border-bottom: none; }

/* ---- 진행률 ---- */
.progress-bar { height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; }

/* ---- 모달 ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; pointer-events: all; }
.modal {
  background: white; border-radius: 16px;
  width: 100%; max-width: 600px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.95);
  transition: transform 0.2s;
}
.modal-overlay.show .modal { transform: scale(1); }
.modal-header {
  padding: 18px 20px;
  border-bottom: 1px solid #f3f4f6;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; border-radius: 16px 16px 0 0;
}
.modal-title { font-size: 16px; font-weight: 700; color: #1f2937; }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid #f3f4f6; display: flex; justify-content: flex-end; gap: 8px; }

/* ---- 캘린더 ---- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.calendar-header-cell {
  text-align: center; padding: 10px 4px;
  font-size: 12px; font-weight: 600; color: #6b7280;
}
.calendar-cell {
  min-height: 90px; padding: 4px;
  border: 1px solid #f0f0f0;
  position: relative; cursor: pointer;
  transition: background 0.1s;
}
.calendar-cell:hover { background: #f9fafb; }
.calendar-cell.today { background: #eff6ff; }
.calendar-cell.today .cell-date { background: var(--primary); color: white; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }
.calendar-cell.other-month { background: #fafafa; }
.calendar-cell.other-month .cell-date { color: #d1d5db; }
.cell-date { font-size: 12px; font-weight: 600; color: #374151; padding: 2px; }
.cell-event {
  font-size: 10px; padding: 1px 4px; border-radius: 3px;
  margin-bottom: 1px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; cursor: pointer; color: white;
}
.calendar-cell.sun .cell-date { color: #ef4444; }
.calendar-cell.sat .cell-date { color: #3b82f6; }

/* ---- 칸반 ---- */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; }
.kanban-column {
  min-width: 250px; flex-shrink: 0;
  background: #f9fafb; border-radius: 12px; padding: 12px;
}
.kanban-title { font-size: 13px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.kanban-card {
  background: white; border-radius: 8px; padding: 10px 12px;
  margin-bottom: 8px; border: 1px solid #e5e7eb;
  cursor: pointer; transition: box-shadow 0.2s;
  font-size: 13px;
}
.kanban-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.1); }

/* ---- 뷰 탭 ---- */
.view-tabs { display: flex; gap: 4px; background: #f3f4f6; border-radius: 8px; padding: 3px; }
.view-tab { padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer; transition: all 0.2s; color: #6b7280; }
.view-tab.active { background: white; color: var(--primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }

/* ---- 알림 토스트 ---- */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 10px;
  background: white; box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  font-size: 13px; color: #374151;
  animation: slideIn 0.3s ease;
  min-width: 260px; max-width: 380px;
}
.toast-success { border-left: 3px solid #10b981; }
.toast-error { border-left: 3px solid #ef4444; }
.toast-info { border-left: 3px solid #3b82f6; }
.toast-warning { border-left: 3px solid #f59e0b; }
@keyframes slideIn { from { opacity:0; transform:translateX(100px); } to { opacity:1; transform:translateX(0); } }
@keyframes slideOut { from { opacity:1; transform:translateX(0); } to { opacity:0; transform:translateX(100px); } }

/* ---- 필터/검색 바 ---- */
.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-box { position: relative; }
.search-box input { padding-left: 32px; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #9ca3af; font-size: 12px; }

/* ---- D-day ---- */
.dday-badge { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 4px; }
.dday-past { background: #fee2e2; color: #dc2626; }
.dday-today { background: #fef3c7; color: #d97706; }
.dday-soon { background: #dbeafe; color: #2563eb; }
.dday-normal { background: #f3f4f6; color: #6b7280; }

/* ---- 빈 상태 ---- */
.empty-state { text-align: center; padding: 60px 20px; color: #9ca3af; }
.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 14px; }

/* ---- 반응형 ---- */
@media (max-width: 768px) {
  #sidebar {
    transform: translateX(-100%);
    width: 280px;
  }
  #sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0; }
  #menu-toggle { display: flex; }
  #page-content { padding: 12px; }
  .kanban-board { flex-direction: column; }
  .kanban-column { min-width: 100%; }
  .calendar-cell { min-height: 60px; }
  .cell-event { display: none; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .modal { max-width: 100%; margin: 0; border-radius: 16px 16px 0 0; align-self: flex-end; }
  .modal-overlay { align-items: flex-end; }
}

@media (max-width: 480px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .data-table { display: block; overflow-x: auto; }
}

/* ---- 드롭다운 ---- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: 100%; right: 0;
  background: white; border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  border: 1px solid #e5e7eb;
  min-width: 160px; z-index: 200;
  display: none;
}
.dropdown-menu.show { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; font-size: 13px; cursor: pointer;
  color: #374151; transition: background 0.1s;
}
.dropdown-item:hover { background: #f9fafb; }
.dropdown-item.danger { color: #ef4444; }

/* ---- 섹션 헤더 ---- */
.section-title { font-size: 20px; font-weight: 700; color: #1f2937; }
.section-subtitle { font-size: 13px; color: #6b7280; }

/* ---- 태그 ---- */
.tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px; background: #eff6ff;
  color: #3b82f6; border-radius: 20px;
  font-size: 11px; font-weight: 500;
}

/* ---- 연락처 카드 ---- */
.contact-card {
  background: white; border-radius: 12px;
  padding: 16px; border: 1px solid #f0f0f0;
  transition: box-shadow 0.2s; cursor: pointer;
}
.contact-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }

/* ---- 주간보고 ---- */
.week-nav-btn {
  padding: 6px 12px; background: white; border: 1px solid #e5e7eb;
  border-radius: 8px; cursor: pointer; font-size: 13px;
  transition: all 0.2s; color: #374151;
}
.week-nav-btn:hover { background: #f3f4f6; }

/* ---- 스크롤바 ---- */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

/* ---- 로딩 ---- */
.loading-spinner { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ---- 사이드바 오버레이 (모바일) ---- */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
#sidebar-overlay.show { display: block; }
