/* GMP 직원 관리 시스템 - 스타일시트 */

:root {
  --primary: #1a237e;
  --primary-light: #3949ab;
  --secondary: #6c757d;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #ef6c00;
  --info: #0277bd;
  --light: #f8f9fa;
  --dark: #212529;
  --white: #ffffff;
  --border: #dee2e6;
  --shadow: 0 2px 8px rgba(0,0,0,0.1);
  --radius: 8px;
  --sidebar-width: 220px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--light);
  color: var(--dark);
  line-height: 1.5;
}

#app {
  display: flex;
  min-height: 100vh;
}

/* 사이드바 */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary), var(--primary-light));
  color: var(--white);
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h1 {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.sidebar-header small {
  opacity: 0.7;
  font-size: 0.75rem;
}

.nav-menu {
  list-style: none;
  padding: 10px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.1);
  border-left-color: var(--white);
}

.nav-item i {
  font-size: 1.2rem;
  margin-right: 12px;
}

/* 모바일 헤더 */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--primary);
  color: var(--white);
  align-items: center;
  padding: 0 16px;
  z-index: 999;
}

.mobile-header h1 {
  font-size: 1.2rem;
  margin-left: 12px;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
}

/* 메인 콘텐츠 */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 20px;
  min-height: 100vh;
}

/* 페이지 */
.page {
  display: none;
}

.page.active {
  display: block;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--white);
  padding: 16px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.page-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background: var(--primary-light);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--white);
}

.btn-danger {
  background: var(--danger);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--dark);
}

.btn-outline:hover {
  background: var(--light);
}

.btn-icon {
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--secondary);
}

/* 입력 필드 */
input, select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
}

.input-sm { width: 80px; }
.input-md { width: 120px; }
.input-date { width: 150px; }
.select-md { width: 150px; }

.search-box {
  position: relative;
}

.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--secondary);
}

.search-box input {
  padding-left: 32px;
  width: 200px;
}

/* 통계 카드 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.blue { background: #e3f2fd; color: var(--info); }
.stat-icon.green { background: #e8f5e9; color: var(--success); }
.stat-icon.orange { background: #fff3e0; color: var(--warning); }

.stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
}

.stat-label {
  color: var(--secondary);
  font-size: 0.875rem;
}

/* 근무자 섹션 */
.workers-section {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.workers-section h3 {
  margin-bottom: 16px;
  font-size: 1rem;
}

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

.worker-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.worker-header {
  padding: 10px 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.worker-header .badge {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.schedule-A { background: #e3f2fd; }
.schedule-A .badge { background: #1565c0; color: white; }
.schedule-P { background: #fff3e0; }
.schedule-P .badge { background: #ef6c00; color: white; }
.schedule-S { background: #e8f5e9; }
.schedule-S .badge { background: #2e7d32; color: white; }

.worker-list {
  padding: 12px 16px;
  min-height: 60px;
}

.worker-list .badge {
  display: inline-block;
  padding: 4px 10px;
  margin: 2px;
  background: var(--light);
  border-radius: 12px;
  font-size: 0.8rem;
}

.worker-list .empty {
  color: var(--secondary);
  font-size: 0.875rem;
}

/* 테이블 */
.table-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: var(--light);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
}

.data-table td {
  font-size: 0.875rem;
}

.data-table tbody tr:hover {
  background: #f8f9fa;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-active {
  background: #e8f5e9;
  color: var(--success);
}

.status-inactive {
  background: #ffebee;
  color: var(--danger);
}

.action-btns {
  display: flex;
  gap: 4px;
  justify-content: center;
}

.action-btns button {
  padding: 4px 8px;
  font-size: 0.8rem;
}

/* 패널 */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel.hidden {
  display: none;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--light);
  border-bottom: 1px solid var(--border);
}

.panel-header h3 {
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 20px;
}

.form-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.mt-2 { margin-top: 16px; }

/* 스케줄 */
.schedule-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.month-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.month-nav span {
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

.schedule-badges {
  display: flex;
  gap: 6px;
}

.schedule-badges .badge {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
}

/* 캘린더 */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  background: var(--white);
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.cal-header {
  text-align: center;
  padding: 10px;
  font-weight: 600;
  font-size: 0.875rem;
  background: var(--light);
  border-radius: 4px;
}

.cal-header.sun { color: var(--danger); }
.cal-header.sat { color: var(--info); }

.cal-day {
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.cal-day:hover {
  border-color: var(--primary);
  background: #f0f4ff;
}

.cal-day.empty {
  background: var(--light);
  cursor: default;
  border-color: transparent;
}

.cal-day.empty:hover {
  background: var(--light);
  border-color: transparent;
}

.day-num {
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.day-num.sun { color: var(--danger); }
.day-num.sat { color: var(--info); }

.day-sched {
  font-size: 0.75rem;
}

.emp-sched {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px;
  margin-bottom: 2px;
  border-radius: 3px;
  cursor: pointer;
}

.emp-sched:hover {
  background: #e9ecef;
}

.emp-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-cell {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.7rem;
}

/* 스케줄 유형 피커 */
.schedule-type-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sched-type-btn {
  width: 50px;
  height: 50px;
  border: 2px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.sched-type-btn:hover {
  border-color: var(--primary);
}

.sched-type-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(26, 35, 126, 0.2);
}

.sched-type-btn .code {
  font-weight: 700;
  font-size: 0.9rem;
}

.sched-type-btn .name {
  font-size: 0.65rem;
  color: var(--secondary);
}

/* 탭 */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  background: var(--white);
  padding: 8px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.875rem;
  border-radius: 6px;
  transition: all 0.2s;
}

.tab:hover {
  background: var(--light);
}

.tab.active {
  background: var(--primary);
  color: var(--white);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* 설정 */
.settings-grid,
.items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.settings-card,
.item-card {
  background: var(--white);
  padding: 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.settings-card h4,
.item-card h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 1rem;
}

.info-table {
  width: 100%;
}

.info-table td {
  padding: 8px 0;
  font-size: 0.875rem;
}

.info-table td:first-child {
  color: var(--secondary);
}

.item-input {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.item-input input {
  flex: 1;
}

.item-list {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.item-list li {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.item-list li:last-child {
  border-bottom: none;
}

.item-list li:hover {
  background: var(--light);
}

.item-list .drag-handle {
  cursor: grab;
  color: var(--secondary);
  margin-right: 8px;
}

.item-list .item-text {
  flex: 1;
}

.item-list .item-actions {
  display: none;
  gap: 4px;
}

.item-list li:hover .item-actions {
  display: flex;
}

.item-list .item-actions button {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--secondary);
  padding: 2px;
}

.item-list .item-actions button:hover {
  color: var(--primary);
}

.item-list .item-actions button.delete:hover {
  color: var(--danger);
}

/* 모달 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-content.modal-sm {
  max-width: 350px;
}

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

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

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.modal-actions {
  display: flex;
  gap: 8px;
}

/* 폼 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.875rem;
  font-weight: 500;
}

.form-group .required {
  color: var(--danger);
}

.form-group input,
.form-group select {
  width: 100%;
}

/* 로딩 */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* 토스트 */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 3000;
}

.toast {
  background: var(--dark);
  color: var(--white);
  padding: 12px 20px;
  border-radius: 6px;
  margin-top: 8px;
  animation: slideIn 0.3s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.toast.success {
  background: var(--success);
}

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

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

/* 반응형 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-header {
    display: flex;
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 72px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .calendar-grid {
    font-size: 0.8rem;
  }

  .cal-day {
    min-height: 60px;
    padding: 4px;
  }

  .day-num {
    font-size: 0.8rem;
  }

  .schedule-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .tabs {
    flex-wrap: wrap;
  }

  .tab {
    flex: 1;
    text-align: center;
    padding: 8px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .workers-grid {
    grid-template-columns: 1fr;
  }

  .data-table th,
  .data-table td {
    padding: 8px 4px;
    font-size: 0.75rem;
  }
}

/* 유틸리티 */
.hidden { display: none !important; }
.text-muted { color: var(--secondary); }
.text-center { text-align: center; }
