/* =============================================
   컴포넌트 스타일 — tokens.css 변수만 참조
   v2 styles.css 카카오페이 테마 정리 이식
   ============================================= */

/* === App container — 모바일 dvh === */
#app {
  height: 100dvh;
  min-height: 100dvh;
  background: var(--bg-base);
  max-width: 430px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* === Cards === */
.glass-card,
.bento-card,
.bento-card-wide,
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  text-align: left;
  transition: transform 0.12s, box-shadow 0.12s;
}
.bento-card, .bento-card-wide { padding: 18px; }
.bento-card:active, .glass-card:active, .status-card:active { transform: scale(0.985); }

/* === Status side bar === */
.status-card { display: flex; overflow: hidden; }
.status-bar { width: 5px; flex-shrink: 0; border-radius: 5px 0 0 5px; }
.status-pending { background: linear-gradient(to bottom, #FBBF24, var(--status-amber)); }
.status-active { background: linear-gradient(to bottom, #60A5FA, var(--info-blue)); }
.status-complete { background: linear-gradient(to bottom, #34D399, var(--nh-green)); }
.status-return { background: linear-gradient(to bottom, #C084FC, var(--status-purple)); }
.status-confirm { background: linear-gradient(to bottom, #22D3EE, var(--status-cyan)); }

/* === Chips === */
.chip {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.chip-pending { background: var(--status-amber-soft); color: #8A5A00; }
.chip-active { background: var(--info-blue-soft); color: #0050B3; }
.chip-complete { background: var(--nh-green-light); color: var(--nh-green-deep); }
.chip-return { background: var(--status-purple-soft); color: #4B1FA8; }
.chip-confirm { background: var(--status-cyan-soft); color: #054E5E; }
.dark .chip-pending { color: #FCD34D; }
.dark .chip-active { color: #93C5FD; }
.dark .chip-complete { color: #6EE7B7; }
.dark .chip-return { color: #D8B4FE; }
.dark .chip-confirm { color: #67E8F9; }

/* === Tab Bar === */
.tab-bar {
  display: flex;
  gap: 4px;
  padding: 5px;
  background: #EAECF0;
  border-radius: 16px;
}
.dark .tab-bar { background: var(--bg-soft); }
.tab-item {
  flex: 1;
  padding: 12px 6px;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  border-radius: 12px;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7B7B7B;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.tab-active {
  background: var(--bg-card);
  color: var(--txt-h1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.dark .tab-active { background: #2A2F3A; color: #FFFFFF; }

/* === Forms === */
.input-modern {
  padding: 15px 16px;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  background: var(--bg-card);
  color: var(--txt-h1);
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  min-height: 52px;
  width: 100%;
  box-sizing: border-box;
}
.input-modern:focus {
  border-color: var(--nh-green);
  box-shadow: 0 0 0 3px rgba(0, 154, 78, 0.15);
  outline: none;
}
.form-label {
  display: block;
  font-size: 14px;
  font-weight: 800;
  color: var(--txt-h1);
  margin-bottom: 8px;
}

/* === Buttons === */
.btn-primary {
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  color: #1A1A1A;
  text-align: center;
  background: var(--kp-yellow);
  box-shadow: 0 2px 6px rgba(250, 218, 10, 0.35);
  transition: all 0.12s;
  border: none;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.01em;
}
.btn-primary:active { transform: scale(0.97); background: var(--kp-yellow-deep); }

.btn-outline {
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  color: var(--txt-h1);
  text-align: center;
  background: var(--bg-base);
  border: 1.5px solid var(--line-strong);
  transition: all 0.12s;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-outline:active { background: #E5E7EB; }
.dark .btn-outline:active { background: #20232B; }

.btn-nh {
  padding: 16px 24px;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 800;
  color: #FFFFFF;
  text-align: center;
  background: linear-gradient(135deg, var(--nh-green), #00C261);
  box-shadow: 0 2px 6px rgba(0, 154, 78, 0.3);
  transition: all 0.12s;
  border: none;
  cursor: pointer;
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-nh:active { transform: scale(0.97); }

/* === Header === */
.kp-header {
  flex-shrink: 0;
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(to right, var(--nh-green-deep), var(--nh-green), #00C261);
  position: relative;
  z-index: 40;
  color: #FFFFFF;
}
.dark .kp-header {
  background: linear-gradient(to right, #0a1f17, #0d2b1f, var(--nh-green-deep));
}
.kp-header-btn {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: transparent;
  border: 0;
  color: rgba(255, 255, 255, 0.95);
  cursor: pointer;
  transition: background 0.15s;
}
.kp-header-btn:active { background: rgba(255, 255, 255, 0.18); }
.kp-header-title {
  flex: 1;
  text-align: center;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.kp-header-logo { height: 26px; border-radius: 5px; }

/* === Back Bar === */
.kp-backbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.kp-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: transparent;
  border: 0;
  font-size: 14px;
  font-weight: 800;
  color: var(--nh-green-deep);
  cursor: pointer;
  min-height: 40px;
}
.kp-back-btn:active { background: var(--nh-green-light); }
.dark .kp-back-btn { color: #4ADE80; }
.kp-backbar-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--txt-h3);
}

/* === Bottom Nav === */
.kp-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: var(--bg-card);
  border-top: 1px solid var(--line);
  z-index: 40;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.kp-bottom-nav .nav-row {
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  height: 64px;
  position: relative;
}
.kp-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 0;
  color: #8E939E;
  font-size: 12px;
  font-weight: 700;
  transition: color 0.15s;
  min-height: 56px;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.kp-nav-btn.active { color: var(--txt-h1); }
.dark .kp-nav-btn { color: #7B8290; }
.dark .kp-nav-btn.active { color: #FFFFFF; }
.kp-nav-btn svg { width: 24px; height: 24px; }
.kp-nav-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* === Center FAB === */
.kp-fab-spacer { flex: 1; min-width: 64px; position: relative; }
.kp-fab {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nh-green), #00C261);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-fab), 0 0 0 4px var(--bg-card);
  transition: transform 0.15s;
  color: #FFFFFF;
  cursor: pointer;
  border: 0;
}
.kp-fab:active { transform: translateX(-50%) scale(0.92); }
.kp-fab-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  font-weight: 800;
  color: var(--nh-green);
  white-space: nowrap;
}
.dark .kp-fab-label { color: #4ADE80; }

/* === Register card grid (등록 안내) === */
.kp-reg-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  transition: transform 0.12s, background 0.12s;
  cursor: pointer;
}
.kp-reg-card:active { transform: scale(0.96); background: var(--bg-soft); }
.kp-reg-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
}
.kp-reg-card-label { font-size: 14px; font-weight: 800; color: var(--txt-h1); }
.kp-reg-card-desc { font-size: 12px; font-weight: 600; color: var(--txt-mute); line-height: 1.4; }

/* === Main content === */
main#mainContent {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0));
}

/* === Empty State === */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
}
.empty-state p { font-size: 16px; font-weight: 600; color: var(--txt-h3); }

/* === Side Menu === */
.kp-side-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 199;
}
.kp-side-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: 80%;
  max-width: 340px;
  background: var(--bg-card);
  z-index: 200;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.kp-side-header {
  padding: 22px 20px 20px;
  background: linear-gradient(135deg, var(--nh-green-deep), var(--nh-green), #00C261);
  color: #FFFFFF;
}
.kp-side-title { font-size: 18px; font-weight: 800; }
.kp-side-sub { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.kp-side-body { flex: 1; overflow-y: auto; padding: 8px 0; }
.kp-side-group-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: transparent;
  border: 0;
  font-size: 15px;
  font-weight: 800;
  color: var(--txt-h1);
  cursor: pointer;
}
.kp-side-group-btn:active { background: var(--bg-soft); }
.kp-side-item {
  width: 100%;
  text-align: left;
  padding: 10px 20px 10px 38px;
  background: var(--bg-soft);
  border: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--txt-h3);
  cursor: pointer;
}
.kp-side-item:active { color: var(--nh-green); }
.kp-side-footer { padding: 14px; border-top: 1px solid var(--line); }
.kp-side-logout {
  width: 100%;
  padding: 12px;
  background: var(--bg-soft);
  border: 0;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  color: var(--txt-h3);
  cursor: pointer;
}

/* === Bottom Sheet === */
.kp-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 249;
}
.kp-sheet {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  z-index: 250;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.2);
}
.kp-sheet-header {
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 10;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}
.kp-sheet-grip {
  width: 40px;
  height: 4px;
  background: var(--line-strong);
  border-radius: 999px;
  margin: 0 auto 12px;
}
.kp-sheet-title-row { display: flex; align-items: center; justify-content: space-between; }
.kp-sheet-title { font-size: 18px; font-weight: 800; color: var(--txt-h1); }
.kp-sheet-close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--txt-h3);
  cursor: pointer;
}
.kp-sheet-close:active { background: var(--bg-soft); }
.kp-sheet-body { padding: 20px; }

/* === Toast === */
.kp-toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  padding: 12px 24px;
  background: rgba(26, 26, 26, 0.92);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
  pointer-events: none;
  max-width: 90%;
  white-space: nowrap;
}

/* === Utility === */
.text-nh { color: var(--nh-green); }
.text-mute { color: var(--txt-mute); }
.text-sub { color: var(--txt-h3); }
.bg-soft { background: var(--bg-soft); }
.bg-card { background: var(--bg-card); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
