/* ==============================
   블랙하비 — Minimal Design System
   Inspired by Apple / Toss
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Noto+Sans+KR:wght@300;400;500;600;700&display=swap');

:root {
  /* Colors */
  --bg:        #000000;
  --bg-1:      #0a0a0a;
  --bg-2:      #111111;
  --bg-3:      #1c1c1c;
  --border:    rgba(255,255,255,0.08);
  --border-md: rgba(255,255,255,0.14);
  --white:     #ffffff;
  --gray-1:    #f5f5f5;
  --gray-2:    #e5e5e5;
  --gray-3:    #a0a0a0;
  --gray-4:    #666666;
  --gray-5:    #333333;

  /* Status */
  --green:  #34c759;
  --orange: #ff9f0a;
  --red:    #ff3b30;
  --blue:   #0a84ff;

  /* Typography */
  --font: 'Inter', 'Noto Sans KR', -apple-system, sans-serif;

  /* Spacing */
  --r:   8px;
  --r-lg: 14px;

  /* Transition */
  --t: 0.15s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--white);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font); }

/* ==============================
   Layout
   ============================== */
.wrapper {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.page-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ==============================
   Header
   ============================== */
header {
  height: 60px;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 8px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--white);
  margin-right: 8px;
  flex-shrink: 0;
}

.logo-img {
  height: 26px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* Nav */
nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

nav a {
  color: var(--gray-3);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t);
}

nav a:hover { color: var(--white); background: var(--bg-3); }
nav a.active { color: var(--white); }

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--gray-3);
}

.user-dot {
  width: 28px;
  height: 28px;
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--white);
  flex-shrink: 0;
}

/* ==============================
   Buttons
   ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--t);
  white-space: nowrap;
  letter-spacing: -0.1px;
}

/* Primary — white fill */
.btn-primary {
  background: var(--white);
  color: #000;
}
.btn-primary:hover { background: var(--gray-2); }
.btn-primary:active { background: var(--gray-3); transform: scale(0.98); }

/* Outline */
.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--border-md);
}
.btn-outline:hover { background: var(--bg-3); border-color: rgba(255,255,255,0.25); }

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--gray-3);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-3); color: var(--white); }

/* Danger / Success */
.btn-danger  { background: rgba(255,59,48,0.12);  color: var(--red);   border: 1px solid rgba(255,59,48,0.2); }
.btn-danger:hover  { background: rgba(255,59,48,0.2); }
.btn-success { background: rgba(52,199,89,0.12);  color: var(--green); border: 1px solid rgba(52,199,89,0.2); }
.btn-success:hover { background: rgba(52,199,89,0.2); }

.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 13px 28px; font-size: 15px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none !important; }

/* ==============================
   Cards
   ============================== */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 14px;
  font-weight: 600;
}

/* ==============================
   Forms
   ============================== */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-3);
  margin-bottom: 7px;
  letter-spacing: 0.2px;
}

.form-label .required { color: var(--white); margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  color: var(--white);
  font-family: var(--font);
  font-size: 14px;
  outline: none;
  transition: border-color var(--t), background var(--t);
}

.form-control:focus {
  border-color: rgba(255,255,255,0.4);
  background: var(--bg-3);
}

.form-control::placeholder { color: var(--gray-4); }

select.form-control {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23666' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

textarea.form-control { resize: vertical; min-height: 90px; }

.form-hint  { font-size: 11px; color: var(--gray-4); margin-top: 5px; }
.form-error { font-size: 12px; color: var(--red); margin-top: 5px; display: none; }
.form-error.show { display: block; }

/* File Upload */
.file-upload {
  border: 1px dashed var(--border-md);
  border-radius: var(--r);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t);
  position: relative;
}

.file-upload:hover,
.file-upload.dragover {
  border-color: rgba(255,255,255,0.3);
  background: var(--bg-2);
}

.file-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-upload-icon { font-size: 28px; margin-bottom: 8px; opacity: 0.4; }
.file-upload-text { font-size: 13px; color: var(--gray-3); }
.file-upload-text strong { color: var(--white); font-weight: 500; }

.file-preview { margin-top: 8px; font-size: 12px; color: var(--green); display: none; }
.file-preview.show { display: block; }

/* Checkbox */
.checkbox-wrap { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.checkbox-wrap input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--white); cursor: pointer; }

/* ==============================
   Badges
   ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-gold    { background: rgba(255,255,255,0.08); color: var(--gray-2); border: 1px solid var(--border-md); }
.badge-success { background: rgba(52,199,89,0.1);  color: var(--green); }
.badge-warning { background: rgba(255,159,10,0.1); color: var(--orange); }
.badge-danger  { background: rgba(255,59,48,0.1);  color: var(--red); }
.badge-info    { background: rgba(10,132,255,0.1); color: var(--blue); }
.badge-gray    { background: var(--bg-3); color: var(--gray-3); }

/* ==============================
   Table
   ============================== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r);
  border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; }

thead th {
  padding: 11px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-4);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  background: var(--bg-1);
}

tbody td {
  padding: 13px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-2); }

/* ==============================
   Page Header
   ============================== */
.page-header {
  padding: 28px 0 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-title   { font-size: 20px; font-weight: 700; letter-spacing: -0.4px; margin-bottom: 3px; }
.page-subtitle { font-size: 13px; color: var(--gray-4); }

/* ==============================
   Product Cards
   ============================== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.product-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--t), transform var(--t);
}

.product-card:hover {
  border-color: var(--border-md);
  transform: translateY(-1px);
}

.product-img {
  width: 100%;
  height: 140px;
  background: var(--bg-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--gray-5);
}

.product-body { padding: 14px; }
.product-name { font-weight: 600; font-size: 13px; margin-bottom: 5px; }

.product-barcode {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 10px;
  color: var(--gray-4);
  margin-bottom: 10px;
  letter-spacing: 0.3px;
}

.product-price {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 12px;
}

.product-price small { font-size: 11px; color: var(--gray-4); font-weight: 400; margin-left: 3px; }

.product-qty { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }

.qty-btn {
  width: 30px; height: 30px;
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  color: var(--white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t);
}

.qty-btn:hover { border-color: rgba(255,255,255,0.3); }

.qty-input {
  width: 44px;
  text-align: center;
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  color: var(--white);
  border-radius: 6px;
  padding: 5px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
}

/* ==============================
   Cart Item
   ============================== */
.cart-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 8px;
  transition: border-color var(--t);
}

.cart-item:hover { border-color: var(--border-md); }
.cart-item-info { flex: 1; }
.cart-item-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.cart-item-barcode { font-size: 10px; color: var(--gray-4); font-family: monospace; }
.cart-item-price { font-weight: 700; white-space: nowrap; }

.cart-item-remove {
  background: none; border: none;
  color: var(--gray-5); cursor: pointer; font-size: 16px;
  transition: color var(--t); line-height: 1; flex-shrink: 0;
}
.cart-item-remove:hover { color: var(--red); }

/* ==============================
   Summary Box
   ============================== */
.summary-box {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 7px 0;
  font-size: 13px;
  color: var(--gray-3);
}

.summary-row.total {
  border-top: 1px solid var(--border-md);
  margin-top: 8px;
  padding-top: 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
}

/* ==============================
   Bank Info
   ============================== */
.bank-info {
  background: var(--bg-2);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 16px;
}

.bank-info-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-3);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.bank-detail {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.bank-detail:last-child {
  border-bottom: none;
  font-size: 17px;
  font-weight: 700;
  color: var(--white);
  padding-top: 10px;
}

.bank-detail label { color: var(--gray-4); font-size: 12px; }

/* ==============================
   Toast
   ============================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-3);
  border: 1px solid var(--border-md);
  border-radius: var(--r);
  padding: 12px 16px;
  font-size: 13px;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  animation: toastIn 0.2s ease;
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red);   }
.toast.warning { border-left: 3px solid var(--orange); }
.toast.info    { border-left: 3px solid var(--blue);  }

@keyframes toastIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(20px); opacity: 0; }
}

/* ==============================
   Auth Pages
   ============================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
}

.auth-box {
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 36px;
}

/* Logo: show image if exists, else text wordmark */
.auth-logo-icon {
  width: 180px;
  height: 50px;
  margin: 0 auto 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-icon img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.auth-logo-fallback {
  font-size: 18px;
  font-weight: 800;
  color: var(--white);
  letter-spacing: -0.5px;
}

.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}

.auth-subtitle { font-size: 13px; color: var(--gray-4); }

.auth-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 13px;
  color: var(--gray-4);
}

.auth-footer a { color: var(--white); font-weight: 500; }

/* ==============================
   Empty State
   ============================== */
.empty-state { text-align: center; padding: 50px 20px; color: var(--gray-4); }
.empty-icon  { font-size: 36px; margin-bottom: 12px; opacity: 0.3; }
.empty-text  { font-size: 14px; color: var(--gray-3); margin-bottom: 4px; }
.empty-sub   { font-size: 13px; }

/* Divider */
hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ==============================
   Loading
   ============================== */
.loading-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,0.2);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-primary .loading-spinner {
  border-color: rgba(0,0,0,0.15);
  border-top-color: #000;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ==============================
   Utilities
   ============================== */
.text-white   { color: var(--white); }
.text-gray    { color: var(--gray-3); }
.text-danger  { color: var(--red); }
.text-success { color: var(--green); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.hidden       { display: none !important; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.w-full { width: 100%; }

/* ==============================
   Responsive
   ============================== */
@media (max-width: 768px) {
  .page-header { flex-direction: column; padding: 20px 0 14px; }
  .page-title  { font-size: 18px; }
  nav { display: none; }
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .auth-card { padding: 22px 18px; }
}
