/* 처치테이블 공통 스타일 */

@import url('https://cdn.jsdelivr.net/npm/pretendard@latest/dist/web/variable/pretendardvariable.min.css');

:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-alt: #F3F2EE;
  --text: #1A1A18;
  --text-2: #6B6A66;
  --text-3: #9C9B96;
  --border: #E5E4DF;
  --border-h: #D0CFCA;
  --blue: #2563EB;
  --blue-bg: #EFF6FF;
  --blue-t: #1E40AF;
  --green: #16A34A;
  --green-bg: #ECFDF5;
  --green-t: #166534;
  --amber: #D97706;
  --amber-bg: #FFFBEB;
  --amber-t: #92400E;
  --red: #DC2626;
  --red-bg: #FEF2F2;
  --red-t: #991B1B;
  --radius: 10px;
  --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Pretendard Variable', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* 헤더 */
.hdr {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}
.hdr-title { font-weight: 700; font-size: 15px; }

/* 탭 바 (하단) */
.tab-bar {
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--surface);
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
}
.tab-bar .tab {
  flex: 1;
  text-align: center;
  padding: 10px 4px;
  font-size: 11px;
  color: var(--text-3);
  position: relative;
  cursor: pointer;
  transition: all .2s;
}
.tab-bar .tab.on {
  color: var(--text);
  font-weight: 600;
}
.tab-bar .tab.on::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}
.tab-bar .tab .badge {
  position: absolute;
  top: 3px;
  margin-left: 1px;
  font-size: 9px;
  background: var(--red);
  color: #fff;
  min-width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* 상단 탭 */
.top-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.top-tabs .tab {
  flex: 1;
  text-align: center;
  padding: 10px 8px;
  font-size: 12px;
  color: var(--text-3);
  position: relative;
  cursor: pointer;
}
.top-tabs .tab.on {
  color: var(--text);
  font-weight: 600;
}
.top-tabs .tab.on::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 15%;
  right: 15%;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
}

/* 버튼 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border-h);
  background: var(--surface);
  cursor: pointer;
  color: var(--text);
  transition: all .2s;
}
.btn:hover { opacity: .85; }
.btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-sm {
  padding: 4px 8px;
  font-size: 11px;
}
.btn-block { width: 100%; }

/* 카드 */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 6px;
}
.card-warning {
  border-color: var(--amber);
  background: var(--amber-bg);
}

/* 입력 */
.input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border-h);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--surface);
  font-family: inherit;
}
.input-label {
  font-size: 11px;
  color: var(--text-2);
  margin-bottom: 3px;
  display: block;
}

/* 뱃지 */
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
}
.badge-amber { background: var(--amber-bg); color: var(--amber-t); }
.badge-red { background: var(--red-bg); color: var(--red-t); }
.badge-green { background: var(--green-bg); color: var(--green-t); }
.badge-blue { background: var(--blue-bg); color: var(--blue-t); }
.badge-gray { background: var(--surface-alt); color: var(--text-2); }

/* 정보 박스 */
.info-box {
  background: var(--blue-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 11px;
  color: var(--blue-t);
}
.warn-box {
  background: var(--red-bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--red-t);
  font-weight: 600;
  text-align: center;
  line-height: 1.5;
}

/* 이미지 썸네일 */
.img-thumb {
  width: 48px;
  height: 48px;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--text-3);
  flex-shrink: 0;
  object-fit: cover;
}
.img-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* 메뉴 아이템 */
.menu-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background .2s;
}
.menu-item.soldout { opacity: .4; }
.menu-item .name { font-weight: 600; font-size: 13px; }
.menu-item .price { font-size: 12px; color: var(--text-2); }
.menu-item .meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* 수량 조절 */
.qty-ctrl {
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 3px;
}
.qty-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border-h);
  background: var(--surface);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s;
  user-select: none;
}
.qty-btn:hover { background: var(--surface-alt); }
.qty-btn:disabled {
  opacity: .3;
  cursor: not-allowed;
}
.qty-val {
  font-weight: 600;
  font-size: 13px;
  min-width: 20px;
  text-align: center;
}

/* 주문 바 */
.order-bar {
  padding: 10px 14px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 50px; /* 탭 바 위 */
  left: 0;
  right: 0;
  z-index: 90;
}
.order-bar .total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-2);
}
.order-bar .total .amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* 3단계 가이드 */
.step-guide {
  display: flex;
  gap: 4px;
  justify-content: center;
  align-items: flex-start;
  padding: 10px 14px;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
}
.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
}
.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--blue-bg);
  color: var(--blue-t);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.step-num.alert {
  background: var(--red);
  color: #fff;
}
.step-text {
  font-size: 10px;
  color: var(--text-2);
  text-align: center;
  line-height: 1.3;
}
.step-text.alert {
  color: var(--red-t);
  font-weight: 600;
}
.step-arrow {
  color: var(--text-3);
  font-size: 10px;
  padding-top: 6px;
}

/* 판매자 카드 */
.seller-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.seller-card .seller-hdr {
  padding: 7px 10px;
  background: var(--surface-alt);
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
}
.seller-card .seller-body { padding: 10px; }

/* 주문 카드 */
.order-card {
  border-left: 3px solid var(--border-h);
  padding: 10px;
  margin-bottom: 6px;
  border-radius: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.order-card.cooking { border-left-color: var(--amber); }
.order-card.ready {
  border-left-color: var(--green);
  background: var(--green-bg);
}
.order-card.pending { border-left-color: var(--border-h); }
.order-card.paid { border-left-color: var(--blue); }
.order-card.completed { border-left-color: var(--text-3); opacity: .6; }
.order-card.cancelled { border-left-color: var(--red); opacity: .6; }

/* 유틸리티 */
.flex { display: flex; }
.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.mb-2 { margin-bottom: 2px; }
.mb-4 { margin-bottom: 4px; }
.mb-6 { margin-bottom: 6px; }
.mb-8 { margin-bottom: 8px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mt-2 { margin-top: 2px; }
.mt-4 { margin-top: 4px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.p-14 { padding: 14px; }
.p-16 { padding: 16px; }
.text-center { text-align: center; }
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-sm { font-size: 11px; }
.text-xs { font-size: 10px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.w-full { width: 100%; }
.border-t { border-top: 1px solid var(--border); }
.pt-8 { padding-top: 8px; }

/* 모달 */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 400px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

/* 로딩 */
.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-3);
  font-size: 12px;
}

/* 숨김 */
.hidden { display: none !important; }

/* 컨텐츠 영역 (하단 탭/주문바 위) */
.content {
  padding-bottom: 120px; /* 탭바(50px) + 주문바(70px) */
  min-height: 100vh;
}
.content.no-order-bar {
  padding-bottom: 60px; /* 탭바만 */
}
