/* ─── 전역 리셋 ──────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', -apple-system, sans-serif; background: #f0f2f5; color: #1a1a1a; font-size: 13px; }
button { cursor: pointer; border: none; font-family: inherit; font-size: 13px; }
input, select, textarea { font-family: inherit; font-size: 13px; }

/* ─── 로그인 ─────────────────────────────────── */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%); }
.login-box { background: #fff; padding: 36px 40px; border-radius: 16px; width: 420px; max-width: 95vw; box-shadow: 0 25px 60px rgba(0,0,0,0.4); }
.login-error { background: #fef2f2; color: #dc2626; text-align: center; margin-bottom: 14px; font-size: 12px; padding: 10px 14px; border-radius: 6px; border: 1px solid #fecaca; }

/* ─── 전체 레이아웃 ──────────────────────────── */
.app-layout { display: flex; height: 100vh; }
.sidebar { width: 210px; background: linear-gradient(180deg, #4338ca 0%, #7c5ce7 30%, #6d28d9 70%, #4338ca 100%); color: #1e293b; display: flex; flex-direction: column; flex-shrink: 0; overflow: hidden; }
.sidebar-header { padding: 24px 16px 28px; position: relative; overflow: hidden; }
.sidebar-header::before { content: ''; position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,0.08); }
.sidebar-header::after { content: ''; position: absolute; bottom: -10px; right: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,0.06); }
.sidebar-header-title { font-size: 26px; font-weight: 800; color: #fff; letter-spacing: -0.5px; }
.sidebar-header-sub { font-size: 13px; color: rgba(255,255,255,0.65); letter-spacing: 2px; font-weight: 600; text-transform: uppercase; margin-top: 1px; }
.sidebar-header-desc { font-size: 15px; color: rgba(255,255,255,0.75); margin-top: 6px; line-height: 1.4; }
.sidebar-menu { flex: 1; padding: 10px; overflow-y: auto; background: #fafbfc; border-radius: 20px 20px 0 0; }
.sidebar-section { font-size: 13px; font-weight: 700; color: #94a3b8; text-transform: uppercase; letter-spacing: 1px; padding: 14px 8px 6px; }
.sidebar-item { display: flex; align-items: center; padding: 12px 14px; color: #475569; cursor: pointer; transition: all 0.2s; font-size: 16px; font-weight: 500; border-radius: 10px; margin-bottom: 2px; gap: 10px; }
.sidebar-item:hover { background: #ede9fe; color: #4338ca; }
.sidebar-item.active { background: linear-gradient(135deg, #4338ca, #7c5ce7); color: #fff; box-shadow: 0 3px 10px rgba(67,56,202,0.25); }
.sidebar-item .sidebar-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 10px; font-size: 18px; flex-shrink: 0; }
.sidebar-item:not(.active) .sidebar-icon { background: #f1f0ff; color: #6366f1; }
.sidebar-item.active .sidebar-icon { background: rgba(255,255,255,0.2); color: #fff; }
.sidebar-item .sidebar-arrow { margin-left: auto; font-size: 10px; color: #94a3b8; transition: transform 0.2s; }
.sidebar-item.active .sidebar-arrow { color: rgba(255,255,255,0.7); }
.sidebar-divider { height: 1px; background: #e8ecf1; margin: 4px 10px; }
.sidebar-agent { margin: 0; padding: 12px 14px; background: linear-gradient(135deg, #4338ca, #7c5ce7); border-radius: 0; border: none; font-size: 14px; color: #fff; }
.sidebar-agent-row { display: flex; align-items: center; gap: 6px; }
.sidebar-agent-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.sidebar-bottom { padding: 4px 0 60px; background: #fafbfc; }
.sidebar-usercard { background: linear-gradient(135deg, #4338ca, #7c5ce7); border-radius: 0; padding: 14px; border: none; margin: 0 0 4px; }
.sidebar-usercard-welcome { font-size: 15px; color: rgba(255,255,255,0.85); font-weight: 700; margin-bottom: 10px; letter-spacing: -0.3px; }
.sidebar-usercard-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.sidebar-usercard-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); border: 2px solid rgba(255,255,255,0.3); display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 14px; flex-shrink: 0; }
.sidebar-usercard-info { flex: 1; min-width: 0; }
.sidebar-usercard-name { font-size: 16px; font-weight: 700; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-usercard-id { font-size: 13px; color: rgba(255,255,255,0.55); margin-top: 2px; }
.sidebar-usercard-expiry { font-size: 13px; color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.sidebar-usercard-bar { height: 3px; background: rgba(255,255,255,0.15); border-radius: 2px; margin-top: 4px; overflow: hidden; }
.sidebar-usercard-logout { width: 100%; padding: 10px; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.15s; text-align: center; }
.sidebar-usercard-logout:hover { background: rgba(255,255,255,0.25); color: #fff; }

/* ─── 메인 영역 ──────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* ─── 탭 바 ──────────────────────────────────── */
.tab-bar { display: flex; background: #fff; border-bottom: none; padding: 0 16px; flex-shrink: 0; margin-bottom: 0; padding-bottom: 0; }
.tab-item { padding: 10px 16px; cursor: pointer; color: #6b7280; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.15s; white-space: nowrap; font-size: 15px; }
.tab-item:hover { color: #1d4ed8; }
.tab-item.active { color: #1d4ed8; border-bottom-color: #1d4ed8; }

/* ─── 탭 콘텐츠 ──────────────────────────────── */
.tab-content { flex: 1; overflow-y: auto; padding: 10px 16px 16px 16px; }

/* ─── 서브탭 ─────────────────────────────────── */
.sub-tabs { display: flex; gap: 4px; margin-bottom: 12px; flex-wrap: wrap; }
.sub-tab { padding: 6px 14px; border-radius: 6px; background: #f1f5f9; color: #475569; cursor: pointer; font-size: 12px; font-weight: 500; }
.sub-tab:hover { background: #e2e8f0; }
.sub-tab.active { background: #1d4ed8; color: #fff; }

/* ─── 툴바 ───────────────────────────────────── */
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input, .toolbar select { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; }
.toolbar input:focus, .toolbar select:focus { outline: none; border-color: #1d4ed8; }
.btn { padding: 6px 14px; border-radius: 6px; font-weight: 500; transition: all 0.15s; display: inline-flex; align-items: center; gap: 4px; }
.btn-primary { background: #1d4ed8; color: #fff; }
.btn-primary:hover { background: #1e40af; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #6b7280; color: #fff; }
.btn-secondary:hover { background: #4b5563; }
.btn-outline { background: #fff; color: #374151; border: 1px solid #d1d5db; }
.btn-outline:hover { background: #f9fafb; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ─── 날짜 버튼 ──────────────────────────────── */
.date-buttons { display: flex; gap: 4px; }
.date-btn { padding: 4px 10px; border-radius: 4px; background: #f1f5f9; color: #475569; font-size: 13px; cursor: pointer; border: 1px solid #e2e8f0; height: 32px; display: inline-flex; align-items: center; box-sizing: border-box; }
.date-btn:hover { background: #e2e8f0; }
.date-btn.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

/* ─── 깜박임 애니메이션 ─────────────────────── */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ─── 테이블/그리드 ──────────────────────────── */
.data-grid-wrapper { overflow: auto; border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; }
.data-grid { border-collapse: collapse; font-size: 12px; }
.data-grid thead { position: sticky; top: 0; z-index: 1; }
.data-grid th { background: #f8fafc; padding: 8px 10px; text-align: left; font-weight: 600; color: #475569; border-bottom: 2px solid #e5e7eb; white-space: nowrap; user-select: none; }
.data-grid td { padding: 6px 10px; border-bottom: 1px solid #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.data-grid tr:hover td { background: #f0f9ff; }
.data-grid tr.selected td { background: #dbeafe; }
.data-grid td input { width: 100%; border: 1px solid transparent; padding: 2px 4px; border-radius: 3px; background: transparent; font-size: 12px; }
.data-grid td input:focus { border-color: #1d4ed8; background: #fff; outline: none; }
.data-grid .checkbox-col { width: 30px; text-align: center; }

/* ─── 상태 뱃지 ──────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 500; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-yellow { background: #fef3c7; color: #d97706; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-gray { background: #f1f5f9; color: #64748b; }

/* ─── 진행 바 ────────────────────────────────── */
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 8px 0; }
.progress-bar-fill { height: 100%; background: #1d4ed8; border-radius: 4px; transition: width 0.3s; }
.progress-bar-fill.indeterminate { width: 30% !important; animation: indeterminate 1.5s infinite linear; }
@keyframes indeterminate { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
.progress-text { font-size: 12px; color: #6b7280; }

/* ─── 배너 ───────────────────────────────────── */
.info-banner { background: #dbeafe; border: 1px solid #93c5fd; border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; color: #1e40af; font-size: 13px; }

/* ─── 모달 ───────────────────────────────────── */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal, .modal-content { background: #fff; border-radius: 12px; padding: 24px; min-width: 480px; max-width: 700px; max-height: 80vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal h3 { margin-bottom: 16px; color: #1e293b; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ─── 폼 ─────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-group label { display: block; margin-bottom: 4px; color: #374151; font-weight: 500; font-size: 12px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #1d4ed8; box-shadow: 0 0 0 3px rgba(29,78,216,0.1); }

/* ─── 유틸 ───────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ─── 멀티선택 드롭다운 ──────────────────────── */
.multi-select { position: relative; display: inline-block; }
.multi-select-btn { padding: 6px 10px; border: 1px solid #d1d5db; border-radius: 6px; background: #fff; cursor: pointer; min-width: 150px; text-align: left; font-size: 12px; display: flex; align-items: center; justify-content: space-between; }
.multi-select-dropdown { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #d1d5db; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 100; min-width: 200px; max-height: 250px; overflow-y: auto; }
.multi-select-item { padding: 6px 10px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; }
.multi-select-item:hover { background: #f0f9ff; }

/* ─── 카드 정보 ──────────────────────────────── */
.stats-row { display: flex; gap: 12px; margin-bottom: 12px; }
.stat-card { flex: 1; background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 12px 16px; }
.stat-card .label { font-size: 12px; color: #6b7280; }
.stat-card .value { font-size: 20px; font-weight: 700; color: #1e293b; margin-top: 4px; }

/* ─── 라디오/체크박스 ────────────────────────── */
.radio-group { display: flex; gap: 12px; align-items: center; }
.radio-group label { display: flex; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; }

/* ─── 스크롤바 ───────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
.data-grid-wrapper::-webkit-scrollbar { width: 20px; height: 20px; }
.data-grid-wrapper::-webkit-scrollbar-track { background: #fce4ec; }
.data-grid-wrapper::-webkit-scrollbar-thumb { background: #f06292; border-radius: 10px; border: 4px solid #fce4ec; }
.data-grid-wrapper::-webkit-scrollbar-thumb:hover { background: #ec407a; }

/* ─── 탭 색상 ────────────────────────────────── */
.tab-item[data-color="blue"].active { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.tab-item[data-color="green"].active { color: #059669; border-bottom-color: #059669; }
.tab-item[data-color="purple"].active { color: #7c3aed; border-bottom-color: #7c3aed; }
.tab-item[data-color="orange"].active { color: #e85d04; border-bottom-color: #e85d04; }
.tab-item[data-color="yellow"].active { color: #ff9900; border-bottom-color: #ff9900; }
.tab-item[data-color="red"].active { color: #dc2626; border-bottom-color: #dc2626; }

/* ═══ SmartStore WPF 동일 스타일 ═══════════════ */

/* ─── 서브 탭 바 (WPF 동일: 가로 배치) ────────── */
.ss-tab-bar {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 0 !important;
  margin-bottom: 10px;
  margin-top: 0px;
  border-bottom: none;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  min-height: 42px;
  align-items: center;
}
.ss-tab {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: #6b7280;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
  white-space: nowrap;
  background: transparent;
}
.ss-tab:hover { color: #374151; background: #f1f5f9; border-radius: 20px; }
.ss-tab.active { color: #fff !important; border-bottom: none !important; transition: all 0.2s ease; }
.ss-tab-icon { font-size: 20px; line-height: 1; }
.ss-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  border-radius: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 0 6px;
  margin-left: 4px;
}

/* ─── 툴바 행 (WPF 동일: 가로 한 줄) ─────────── */
.ss-toolbar {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
  min-height: 36px;
  padding: 2px 0;
}
.ss-toolbar-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}
.ss-toolbar-divider { color: #d1d5db; font-size: 16px; margin: 0 4px; }
.ss-toolbar .ss-cell-select {
  height: 32px;
  padding: 4px 8px;
  font-size: 13px;
  box-sizing: border-box;
  border-radius: 4px;
}
.ss-date-input {
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  width: 130px;
  height: 32px;
  box-sizing: border-box;
}
.ss-date-input:focus { outline: none; border-color: #1d4ed8; }

/* ─── 액션 버튼 (WPF 동일) ──────────────────── */
.ss-action-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
  margin: 0 !important;
  height: 32px;
  box-sizing: border-box;
}
.ss-action-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ss-action-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.ss-action-primary:hover { background: #1d4ed8; }
.ss-action-blue { background: #eff6ff; color: #2563eb; border-color: #93c5fd; }
.ss-action-blue:hover { background: #dbeafe; }
.ss-action-red { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }
.ss-action-red:hover { background: #fee2e2; }

/* ─── 네비게이션 버튼 ────────────────────────── */
.ss-nav-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 7px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  height: 34px;
  min-width: 130px;
  box-sizing: border-box;
  line-height: 1;
}
.ss-nav-btn:hover { opacity: 0.85; }
.ss-nav-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── 상태 정보 (WPF 우측: 초록 점 + 텍스트) ── */
.ss-status-info {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.ss-status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── 셀 내 드롭다운/입력 (WPF 동일) ────────── */
.ss-cell-select {
  width: 100%;
  padding: 2px 4px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 12px;
  background: #fff;
  cursor: pointer;
}
.ss-cell-select:focus { border-color: #2563eb; outline: none; }
.ss-cell-input {
  width: 100%;
  padding: 2px 6px;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 12px;
  background: #fff;
}
.ss-cell-input:focus { border-color: #2563eb; outline: none; background: #eff6ff; }
.ss-cell-input::placeholder { color: #9ca3af; font-style: italic; }

/* 컬럼 리사이즈 핸들 */
.ss-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  z-index: 1;
}
.ss-resize-handle:hover,
.ss-resize-handle:active {
  background: #2563eb;
}

/* 컬럼 드래그 리오더 */
.data-grid th[draggable] {
  cursor: grab;
}
.data-grid th[draggable]:active {
  cursor: grabbing;
}
.data-grid th.ss-drag-over {
  border-left: 3px solid #2563eb !important;
  background: #dbeafe !important;
  transition: background 0.1s;
}
.data-grid th.ss-dragging {
  opacity: 0.4;
  background: #e0e7ff !important;
}
.data-grid td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
