/* 와싸비 Design System */

:root {
  /* Wasabi-inspired palette */
  --wasabi:        #7ab648;
  --wasabi-dark:   #5a8c35;
  --wasabi-light:  #e8f5d8;
  --wasabi-glow:   rgba(122, 182, 72, 0.15);

  --bg:            #0c0f0a;
  --bg-card:       #161a14;
  --bg-card-hover: #1c211a;
  --bg-input:      #1e2320;

  --text:          #e8ece5;
  --text-muted:    #8a9185;
  --text-dim:      #5c645a;

  --red:           #e85454;
  --blue:          #54a8e8;
  --yellow:        #e8c854;

  --radius:        12px;
  --radius-sm:     8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 860px;
  margin: 0 auto;
  padding: 24px 16px;
}

/* ── Header ── */
.header {
  text-align: center;
  padding: 32px 0 24px;
}

.header__brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.header__logo {
  font-size: 32px;
  filter: drop-shadow(0 0 12px rgba(122, 182, 72, 0.4));
}

.header__title {
  font-size: 28px;
  font-weight: 800;
  color: var(--wasabi);
  letter-spacing: -0.5px;
}

.header__badge {
  font-size: 10px;
  font-weight: 600;
  color: var(--wasabi);
  border: 1px solid var(--wasabi-dark);
  padding: 2px 6px;
  border-radius: 4px;
  vertical-align: super;
  letter-spacing: 1px;
}

.header__tagline {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 6px;
}

/* ── Add Form ── */
.add-section {
  margin-bottom: 28px;
}

.add-form__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.add-form__input {
  flex: 1;
  min-width: 200px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.add-form__input:focus {
  border-color: var(--wasabi-dark);
}

.add-form__input::placeholder {
  color: var(--text-dim);
}

.add-form__price {
  width: 140px;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 15px;
  font-family: 'JetBrains Mono', monospace;
  outline: none;
  transition: border-color 0.2s;
}

.add-form__price:focus {
  border-color: var(--wasabi-dark);
}

.add-form__price::placeholder {
  color: var(--text-dim);
  font-family: 'Noto Sans KR', sans-serif;
}

.add-form__btn {
  padding: 14px 24px;
  background: var(--wasabi);
  color: #0c0f0a;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  white-space: nowrap;
}

.add-form__btn:hover {
  background: var(--wasabi-dark);
}

.add-form__btn:active {
  transform: scale(0.97);
}

.add-form__btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Product Cards ── */
.products__loading,
.products__empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
}

.products__empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.products__empty-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

.products__grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card {
  background: var(--bg-card);
  border: 1px solid rgba(122, 182, 72, 0.08);
  border-radius: var(--radius);
  padding: 18px;
  transition: background 0.2s, border-color 0.2s;
  cursor: default;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(122, 182, 72, 0.2);
}

.card__top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.card__image {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-input);
  flex-shrink: 0;
}

.card__info {
  flex: 1;
  min-width: 0;
}

.card__name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__prices {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.card__current {
  font-family: 'JetBrains Mono', monospace;
  font-size: 20px;
  font-weight: 600;
  color: var(--wasabi);
}

.card__target {
  font-size: 12px;
  color: var(--text-dim);
}

.card__target--reached {
  color: var(--wasabi);
  font-weight: 600;
}

.card__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-dim);
}

.card__range {
  font-family: 'JetBrains Mono', monospace;
}

.card__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-icon:hover {
  background: rgba(122, 182, 72, 0.15);
  color: var(--wasabi);
}

.btn-icon--danger:hover {
  background: rgba(232, 84, 84, 0.15);
  color: var(--red);
}

.btn-coupang {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: var(--wasabi);
  color: #0c0f0a;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-coupang:hover {
  background: var(--wasabi-dark);
}

/* ── Modal ── */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(122, 182, 72, 0.15);
  border-radius: var(--radius);
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal__header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

.modal__body {
  padding: 20px;
}

.chart-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  flex: 1;
  min-width: 100px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  text-align: center;
}

.stat__label {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.stat__value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 16px;
  font-weight: 600;
}

.stat__value--low { color: var(--wasabi); }
.stat__value--high { color: var(--red); }
.stat__value--avg { color: var(--blue); }

/* ── Spinner ── */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--text-dim);
  border-top-color: var(--wasabi);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

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

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 40px 0 20px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .add-form__row {
    flex-direction: column;
  }

  .add-form__price {
    width: 100%;
  }

  .card__top {
    flex-wrap: wrap;
  }

  .card__actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
}
