﻿/* ================================================================
   core.css — 앱셸 레이아웃 + 공통 컴포넌트
   모든 페이지에서 로드됩니다.
================================================================ */

/* ── 리셋 & 기본 ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Noto Sans KR', -apple-system, sans-serif; background: #f4f5f7; color: #1a1d23; }

/* ── 앱셸 ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── 사이드바 ── */
.sidebar {
  width: 240px; min-width: 240px;
  background: #fff; border-right: 1px solid #e8eaed;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 200;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
}
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px 18px; border-bottom: 1px solid #f0f1f3;
  text-decoration: none;
}
.sidebar-logo-img { width: 34px; height: 34px; object-fit: contain; background: #f0f4ff; border-radius: 8px; padding: 3px; }
.sidebar-logo-text { display: flex; flex-direction: column; line-height: 1.25; }
.sidebar-logo-text strong { font-size: 13px; font-weight: 700; color: #1a1d23; letter-spacing: -.2px; }
.sidebar-logo-text span   { font-size: 11px; color: #8b95a3; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-section-label { font-size: 10px; font-weight: 600; color: #b0b8c4; letter-spacing: .8px; text-transform: uppercase; padding: 8px 10px 4px; }
.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  text-decoration: none; color: #4a5568;
  font-size: 13.5px; font-weight: 500;
  transition: background .15s, color .15s;
  width: 100%; border: none; background: none;
  text-align: left; cursor: pointer;
}
.sidebar-nav-item:hover  { background: #f4f5f7; color: #1a1d23; }
.sidebar-nav-item.active { background: #eef1ff; color: #3b5bdb; font-weight: 600; }
.sidebar-nav-item .nav-icon { width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0; }
.sidebar-nav-item .nav-badge { margin-left: auto; background: #3b5bdb; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px; line-height: 1.6; }
.sidebar-footer { padding: 14px 10px 18px; border-top: 1px solid #f0f1f3; }
.sidebar-footer-info { font-size: 11px; color: #b0b8c4; padding: 4px 12px; line-height: 1.6; }

/* 색상표 안내 배너 */
.sidebar-color-guide {
  margin: 0 2px 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
  border-radius: 10px;
}
.sidebar-color-guide-label {
  font-size: 11px;
  font-weight: 700;
  color: #92400e;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.sidebar-color-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  text-align: left;
}
.sidebar-color-btn:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0,0,0,.12); }
.sidebar-color-btn:active { transform: translateY(0); }
.sidebar-color-btn--thread { background: #fff7ed; border: 1px solid #fed7aa; }
.sidebar-color-btn--fabric { background: #f0fdf4; border: 1px solid #bbf7d0; }
.sidebar-color-btn-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-color-btn-title { font-size: 12px; font-weight: 700; color: #1a1d23; }
.sidebar-color-btn-sub   { font-size: 10px; font-weight: 500; color: #6b7280; }

/* ── 메인 영역 ── */
.main-content { margin-left: 240px; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: #fff; border-bottom: 1px solid #e8eaed;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; position: sticky; top: 0; z-index: 100;
}
.topbar-left  { display: flex; align-items: center; gap: 8px; min-width: 0; flex-shrink: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-back {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; background: #f4f5f7;
  border: 1px solid #e2e5ea; border-radius: 6px;
  font-size: 12px; color: #4a5568; text-decoration: none;
  font-weight: 500; white-space: nowrap; transition: background .15s;
}
.topbar-back:hover { background: #e8eaed; }
.topbar-title { font-size: 15px; font-weight: 700; color: #1a1d23; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub   { font-size: 12px; font-weight: 400; color: #8b95a3; white-space: nowrap; }
.topbar-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 20px; flex-shrink: 0; }
.topbar-badge.locked   { background: #fef3c7; color: #92400e; }
.topbar-badge.unlocked { background: #f0fdf4; color: #166534; }
.topbar-badge.step     { background: #f4f5f7; color: #8b95a3; }

.page-body { padding: 24px 28px 48px; }

/* ── 모바일 토글 ── */
.sidebar-toggle {
  display: none; position: fixed; top: 14px; left: 14px;
  z-index: 300; width: 36px; height: 36px;
  background: #fff; border: 1px solid #e2e5ea; border-radius: 8px;
  align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px;
}
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 190; }

/* ── 공통 버튼 ── */
.jk-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 5px; padding: 8px 16px; border-radius: 6px;
  font-size: 13px; cursor: pointer; border: 1px solid #d1d5db;
  background: #f9fafb; color: #374151; text-decoration: none;
  transition: background .15s; font-family: inherit; line-height: 1.4;
}
.jk-btn:hover      { background: #f3f4f6; }
.jk-btn-sm         { padding: 5px 12px; font-size: 12px; }
.jk-btn-sub        { background: #6366f1; border-color: #6366f1; color: #fff; }
.jk-btn-sub:hover  { background: #4f46e5; }
.jk-btn-primary    { background: #3b5bdb; color: #fff; border-color: #3b5bdb; }
.jk-btn-primary:hover { background: #3451c7; }
.jk-btn-outline    { background: transparent; color: #4a5568; border: 1px solid #dde1e7; }
.jk-btn-outline:hover { background: #f4f5f7; }
.jk-btn-cancel     { color: #6b7280; }
.jk-btn-del        { color: #ef4444; border-color: #fca5a5; background: transparent; }
.jk-btn-del:hover  { background: #fef2f2; }
.jk-btn-submit     { background: #4f46e5; border-color: #4f46e5; color: #fff; padding: 10px 28px; font-size: 15px; }
.jk-btn-submit:hover { background: #4338ca; }
.jk-btn-lock       { background: #dc2626 !important; color: #fff !important; border: none !important; }
.jk-btn-lock:hover { background: #b91c1c !important; }
.jk-btn-unlock     { background: #16a34a !important; color: #fff !important; border: none !important; }
.jk-btn-unlock:hover { background: #15803d !important; }
.jk-btn-locked     { background: #f3f4f6 !important; color: #9ca3af !important; cursor: not-allowed !important; border: 1px solid #e5e7eb !important; }
.jk-btns           { display: flex; gap: 8px; justify-content: flex-end; }

/* ── 공통 입력 ── */
.jk-inp       { width: 100%; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; box-sizing: border-box; font-family: inherit; }
.jk-inp:focus { outline: none; border-color: #6366f1; box-shadow: 0 0 0 2px rgba(99,102,241,.15); }
.jk-inp-full  { width: 100% !important; }
.jk-inp-sm    { width: 80px; }
.jk-sel       { padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 12px; background: #fff; font-family: inherit; }
.jk-ta        { width: 100%; min-height: 70px; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; resize: vertical; box-sizing: border-box; font-family: inherit; }
.jk-ta:focus  { outline: none; border-color: #6366f1; }
.jk-req       { color: #ef4444; }
.jk-cost-tag  { display: inline-block; font-size: 10px; color: #ef4444; border: 1px solid #fca5a5; border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.jk-lb        { font-size: 13px; color: #374151; }
.jk-lb-sm     { font-size: 12px; color: #374151; white-space: nowrap; }

/* ── 공통 카드 ── */
.jk-wrap      { max-width: 760px; margin: 0 auto; padding: 16px; }
.jk-section   { background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 20px; margin-bottom: 16px; }
.jk-sh        { font-size: 14px; font-weight: 700; color: #374151; margin: 0 0 14px; padding-bottom: 8px; border-bottom: 1px solid #f3f4f6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jk-sh-sub    { font-size: 12px; font-weight: 400; color: #9ca3af; margin-left: 8px; }
.jk-card      { border: 1px solid #e5e7eb; border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.jk-card-head { background: #f9fafb; padding: 14px 20px; border-bottom: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.jk-card-title{ font-size: 15px; font-weight: 700; color: #111827; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jk-card-body { padding: 0; }
.jk-meta      { font-size: 12px; color: #9ca3af; }
.jk-v-bar     { display: none; }

/* ── 상태 배지 (list + view 공용) ── */
.jk-st       { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 12px; }
.jk-st-wait  { background: #f3f4f6; color: #6b7280; }
.jk-st-recv  { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; }
.jk-st-paid  { background: #d1fae5; color: #065f46; }
.jk-st-make  { background: #fef3c7; color: #92400e; }
.jk-st-done  { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }

/* ── 잠금 배지 ── */
.jk-lock-badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; vertical-align: middle; margin-left: 8px; }
.jk-lock-on    { background: #fef2f2; color: #dc2626; border: 1px solid #fca5a5; }
.jk-lock-off   { background: #f0fdf4; color: #16a34a; border: 1px solid #86efac; }

/* ── 견본 이미지 모달 (list + view 공용) ── */
.jk-modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.65); z-index: 9999; align-items: center; justify-content: center; padding: 16px; }
.jk-modal-box     { background: #fff; border-radius: 12px; max-width: 720px; width: 100%; max-height: 85vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.jk-modal-head    { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #e5e7eb; flex-shrink: 0; }
.jk-modal-title-text { font-weight: 700; font-size: 15px; color: #111827; }
.jk-modal-close   { background: none; border: none; font-size: 18px; cursor: pointer; color: #6b7280; padding: 4px 6px; line-height: 1; border-radius: 4px; }
.jk-modal-close:hover { background: #f3f4f6; color: #111; }
.jk-modal-body    { padding: 20px; overflow-y: auto; }
.jk-modal-empty   { text-align: center; color: #9ca3af; font-size: 14px; line-height: 1.9; padding: 48px 0; }
.jk-sample-grid   { display: grid; grid-template-columns: repeat(var(--cols,4), 1fr); gap: 12px; }
.jk-sample-item   { display: flex; flex-direction: column; gap: 6px; }
.jk-sample-item img { width: 100%; aspect-ratio: 1/1; object-fit: cover; border: 2px solid #e5e7eb; border-radius: 8px; cursor: zoom-in; transition: border-color .15s, transform .15s; }
.jk-sample-item img:hover { border-color: #6366f1; transform: scale(1.03); }
.jk-sample-item span { font-size: 12px; color: #374151; text-align: center; font-weight: 500; }
.jk-img-zoom-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 10000; justify-content: center; cursor: zoom-out; padding: 24px; }
.jk-img-zoom-overlay img { max-width: 90vw; max-height: 90vh; border-radius: 8px; box-shadow: 0 8px 40px rgba(0,0,0,.5); pointer-events: none; }
.jk-img-zoom-close { position: fixed; top: 16px; right: 20px; color: #fff; font-size: 24px; font-weight: 700; cursor: pointer; line-height: 1; text-shadow: 0 1px 4px rgba(0,0,0,.5); }

/* ── 반응형 ── */
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 6px 0 24px rgba(0,0,0,.12); }
  .sidebar-toggle { display: flex; }
  .sidebar-overlay.open { display: block; }
  .main-content { margin-left: 0; }
  .topbar { padding-left: 60px; }
}
@media (max-width: 600px) {
  .page-body { padding: 14px 14px 40px; }
  .topbar { padding: 0 14px 0 60px; }
  .jk-sample-grid { grid-template-columns: repeat(2,1fr) !important; }
  .jk-modal-box { max-height: 92vh; }
}
/* ── 관리자 주문 현황 사이드바 블록 ── */
.sidebar-order-summary {
  margin: 0 2px 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: 10px;
}
.sidebar-order-summary-label {
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.sidebar-order-admin-badge {
  background: #1d4ed8;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  letter-spacing: .3px;
}
.sidebar-order-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 10px;
}
.sidebar-order-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.sidebar-order-row-key  { color: #4b5563; }
.sidebar-order-row-val  { font-weight: 600; color: #1e3a8a; }
.sidebar-order-row-add  { color: #d97706; }
.sidebar-order-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px dashed #93c5fd;
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
}
.sidebar-order-total-amount {
  font-size: 15px;
  font-weight: 800;
  color: #1d4ed8;
}

/* ── 리스트: 전체 과 총합 블록 ── */
.sidebar-order-summary--list { margin-bottom: 10px; }
.sidebar-ls-dept-list {
  max-height: 180px;
  overflow-y: auto;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  scrollbar-width: thin;
  scrollbar-color: #93c5fd #eff6ff;
}
.sidebar-ls-dept-list::-webkit-scrollbar { width: 4px; }
.sidebar-ls-dept-list::-webkit-scrollbar-track { background: #eff6ff; border-radius: 4px; }
.sidebar-ls-dept-list::-webkit-scrollbar-thumb { background: #93c5fd; border-radius: 4px; }
.sidebar-ls-dept-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 6px;
  background: rgba(255,255,255,0.55);
  border-radius: 5px;
  gap: 6px;
}
.sidebar-ls-dept-name {
  font-size: 11px;
  color: #1e3a8a;
  font-weight: 600;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-ls-dept-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  flex-shrink: 0;
}
.sidebar-ls-dept-people {
  font-size: 10px;
  color: #6b7280;
}
.sidebar-ls-dept-amount {
  font-size: 11px;
  font-weight: 700;
  color: #1d4ed8;
  white-space: nowrap;
}