/* =============================================================
   tokens.css — Bakery Sales Calendar 디자인 토큰
   라이트 테마 / 모바일 퍼스트 PWA
   ============================================================= */

@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.css');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* -------------------------------------------------------------
   :root 토큰
   ------------------------------------------------------------- */
:root {
  /* 배경 */
  --bg-base:     #f1f5f9;
  --bg-surface:  #ffffff;
  --bg-card:     #ffffff;
  --bg-elevated: #f8fafc;
  --bg-hover:    #e2e8f0;

  /* 브랜드 */
  --color-primary:      #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-glow: rgba(37,99,235,0.12);
  --color-secondary:    #7c3aed;
  --color-accent:       #16a34a;
  --color-warning:      #d97706;
  --color-danger:       #dc2626;
  --color-success:      #16a34a;
  --color-info:         #0891b2;

  /* 텍스트 */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;
  --text-inverse:   #ffffff;

  /* 테두리 */
  --border-subtle: rgba(0,0,0,0.08);
  --border-light:  rgba(0,0,0,0.13);
  --border-focus:  rgba(37,99,235,0.45);

  /* 글래스 */
  --glass-bg:     rgba(255,255,255,0.85);
  --glass-border: rgba(0,0,0,0.09);
  --glass-strong: rgba(255,255,255,0.95);

  /* 그림자 */
  --shadow-sm:   0 1px 4px rgba(0,0,0,0.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:   0 12px 40px rgba(0,0,0,0.13);
  --shadow-glow: 0 0 40px rgba(37,99,235,0.10);
  --shadow-card: 0 1px 8px rgba(0,0,0,0.07), 0 0 0 1px rgba(0,0,0,0.04);

  /* 레이아웃 */
  --header-height:  56px;
  --bottom-nav-h:   64px;
  --radius-xs:  4px;
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* 트랜지션 */
  --ease-out:    cubic-bezier(0.0,0.0,0.2,1);
  --ease-in-out: cubic-bezier(0.4,0.0,0.2,1);
  --transition:      all 0.3s var(--ease-in-out);
  --transition-fast: all 0.15s var(--ease-out);

  /* 폰트 패밀리 */
  --font-sans: 'Pretendard', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-num:  'Inter', 'Pretendard', sans-serif;
}

/* -------------------------------------------------------------
   기본 리셋 & body
   ------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }
ul, ol { list-style: none; }

/* -------------------------------------------------------------
   스크롤바
   ------------------------------------------------------------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
* { scrollbar-width: thin; scrollbar-color: var(--border-light) transparent; }

/* -------------------------------------------------------------
   텍스트 헬퍼
   ------------------------------------------------------------- */
.text-primary-c   { color: var(--text-primary) !important; }
.text-secondary-c { color: var(--text-secondary) !important; }
.text-muted-c     { color: var(--text-muted) !important; }
.text-accent-c    { color: var(--color-accent) !important; }
.text-brand-c     { color: var(--color-primary) !important; }
.text-success-c   { color: var(--color-success) !important; }
.text-warning-c   { color: var(--color-warning) !important; }
.text-danger-c    { color: var(--color-danger) !important; }
.text-info-c      { color: var(--color-info) !important; }

.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.num    { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------
   배지
   ------------------------------------------------------------- */
.badge-custom {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  line-height: 1.4;
}
.badge-primary { background: var(--color-primary-glow);      color: var(--color-primary); }
.badge-accent  { background: rgba(22,163,74,0.12);           color: var(--color-accent); }
.badge-success { background: rgba(22,163,74,0.12);           color: var(--color-success); }
.badge-warning { background: rgba(217,119,6,0.12);           color: var(--color-warning); }
.badge-danger  { background: rgba(220,38,38,0.12);           color: var(--color-danger); }
.badge-info    { background: rgba(8,145,178,0.12);           color: var(--color-info); }
.badge-muted   { background: var(--glass-bg);                color: var(--text-secondary); }

/* -------------------------------------------------------------
   아이콘 버튼
   ------------------------------------------------------------- */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 16px;
  transition: var(--transition-fast);
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.btn-icon:active { transform: scale(0.94); }

/* -------------------------------------------------------------
   버튼
   ------------------------------------------------------------- */
.btn-primary-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  box-shadow: 0 4px 16px var(--color-primary-glow);
}
.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--color-primary-glow);
}
.btn-primary-custom:active { transform: translateY(0) scale(0.99); }
.btn-primary-custom:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--glass-bg);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition-fast);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-danger-custom {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(220,38,38,0.10);
  color: var(--color-danger);
  border: 1px solid rgba(220,38,38,0.20);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition-fast);
}
.btn-danger-custom:hover { background: rgba(220,38,38,0.16); }

/* -------------------------------------------------------------
   카드
   ------------------------------------------------------------- */
.card-dark {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.card-glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

/* -------------------------------------------------------------
   폼 요소
   ------------------------------------------------------------- */
.form-label-custom {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.form-control-custom {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition-fast);
  outline: none;
}
.form-control-custom::placeholder { color: var(--text-muted); }
.form-control-custom:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}
select.form-control-custom {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* -------------------------------------------------------------
   테이블
   ------------------------------------------------------------- */
.table-dark-custom {
  width: 100%;
  border-collapse: collapse;
}
.table-dark-custom thead th {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 10px 16px;
  text-align: left;
}
.table-dark-custom tbody tr { transition: background var(--transition-fast); }
.table-dark-custom tbody tr:hover { background: var(--glass-bg); }
.table-dark-custom tbody td {
  padding: 14px 16px;
  color: var(--text-primary);
  vertical-align: middle;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}
.table-dark-custom tbody tr:last-child td { border-bottom: none; }

/* -------------------------------------------------------------
   탭 (상단 가로 탭)
   ------------------------------------------------------------- */
.tabs-custom {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 8px;
}
.tab-custom {
  position: relative;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 12px 16px;
  transition: var(--transition-fast);
}
.tab-custom:hover { color: var(--text-primary); }
.tab-custom.active { color: var(--color-primary); }
.tab-custom.active::after {
  content: '';
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
}

/* -------------------------------------------------------------
   진행 바
   ------------------------------------------------------------- */
.progress-custom {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.progress-custom .progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease-out);
}

/* -------------------------------------------------------------
   칩
   ------------------------------------------------------------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  line-height: 1.4;
}
.chip i { font-size: 12px; }

/* -------------------------------------------------------------
   구분선
   ------------------------------------------------------------- */
.glow-divider {
  height: 1px;
  border: none;
  background: linear-gradient(90deg, transparent, var(--border-light), transparent);
  margin: 16px 0;
}

/* -------------------------------------------------------------
   SweetAlert2 오버라이드
   ------------------------------------------------------------- */
.swal2-popup {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-lg) !important;
  color: var(--text-primary) !important;
  box-shadow: var(--shadow-lg) !important;
}
.swal2-title { color: var(--text-primary) !important; font-weight: 700 !important; }
.swal2-html-container { color: var(--text-secondary) !important; }
.swal2-confirm {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark)) !important;
  border-radius: var(--radius-md) !important;
  font-weight: 600 !important;
  box-shadow: none !important;
}
.swal2-cancel {
  background: var(--bg-elevated) !important;
  color: var(--text-secondary) !important;
  border: 1px solid var(--border-subtle) !important;
  border-radius: var(--radius-md) !important;
  font-weight: 600 !important;
}
.swal2-icon { border-color: var(--border-light) !important; }
.swal2-timer-progress-bar { background: var(--color-primary) !important; }
.swal2-input,
.swal2-textarea {
  background: var(--bg-elevated) !important;
  border: 1px solid var(--border-light) !important;
  border-radius: var(--radius-md) !important;
  color: var(--text-primary) !important;
  box-shadow: none !important;
}

/* SweetAlert2 토스트 */
.swal2-toast {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-light) !important;
  box-shadow: var(--shadow-md) !important;
}

/* -------------------------------------------------------------
   로그인 페이지
   ------------------------------------------------------------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  overflow: hidden;
  position: relative;
  padding: 24px;
}
.orb {
  position: fixed;
  border-radius: var(--radius-full);
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
  animation: orb-drift 12s ease-in-out infinite alternate;
}
.orb-primary   { width: 400px; height: 400px; background: rgba(37,99,235,0.08);  top: -80px;    left: -80px; }
.orb-secondary { width: 320px; height: 320px; background: rgba(124,58,237,0.06); bottom: -60px; right: -60px; animation-delay: -6s; }
.orb-accent    { width: 260px; height: 260px; background: rgba(22,163,74,0.05);  top: 40%;      right: 15%;  animation-delay: -3s; }

@keyframes orb-drift {
  0%   { transform: translate(0,0) scale(1); }
  50%  { transform: translate(30px,-20px) scale(1.06); }
  100% { transform: translate(-20px,30px) scale(0.95); }
}
