/* ============================================
   components.css
   - 재사용 가능한 UI 부품들
   - 버튼, 카드, 모달, 토스트, 폼 입력
   - 업로드 영역, 지도 마커/팝업, 로딩 스피너
   - 회원탈퇴 버튼, 카톡 알림 토글, 유료 플랜 카드
   ============================================ */

/* ---- Icon Button ---- */
.icon-btn {
  background: none;
  border: 1px solid var(--line);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  touch-action: manipulation;
  padding: 0;
  flex-shrink: 0;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
  pointer-events: none;
  display: block;
}
.icon-btn:hover {
  background: var(--card);
  color: var(--terra);
  border-color: var(--terra-soft);
}
.icon-btn:active {
  transform: scale(0.94);
  background: var(--terra-soft);
}

/* ---- Generic Button (btn-*) ---- */
.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--terra); color: white; }
.btn-primary:hover { background: #A8431F; }
.btn-success { background: var(--sage); color: white; }
.btn-success:hover { background: #45623F; }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--line); color: var(--ink); }
.btn-danger {
  background: transparent;
  color: var(--rose);
  border: 1px solid transparent;
  margin-left: auto;
}
.btn-danger:hover { background: rgba(216, 123, 123, 0.1); }

/* ---- Delete Account Button (회원탈퇴) ---- */
.btn-delete-account {
  padding: 10px 16px;
  background: rgba(216, 123, 123, 0.1);
  color: var(--rose);
  border: 1px solid rgba(216, 123, 123, 0.35);
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn-delete-account:hover {
  background: var(--rose);
  color: white;
  border-color: var(--rose);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(216, 123, 123, 0.25);
}
.btn-delete-account:active {
  transform: translateY(0);
}
.btn-delete-account:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---- Notify Settings (카톡 알림) ---- */
.notify-status-card {
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.notify-status-card.enabled {
  background: rgba(254, 229, 0, 0.08);
  border-color: rgba(254, 229, 0, 0.4);
}
.notify-status-text {
  font-size: 14px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.notify-status-text .badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.notify-status-text .badge.on {
  background: rgba(90, 124, 92, 0.15);
  color: var(--sage);
}
.notify-status-text .badge.off {
  background: var(--line);
  color: var(--ink-soft);
}
.btn-notify-toggle {
  padding: 8px 14px;
  background: #FEE500;
  color: #181600;
  border: 1px solid #FEE500;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-notify-toggle:hover {
  background: #F6DC00;
  transform: translateY(-1px);
}
.btn-notify-toggle.off-mode {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line);
}
.btn-notify-toggle.off-mode:hover {
  background: var(--line);
  color: var(--ink);
}
.btn-notify-toggle:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}

/* ---- Premium Plan (유료 플랜) ---- */
.plan-card {
  padding: 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}
.plan-card.premium {
  border-color: var(--mustard);
  background: linear-gradient(135deg, rgba(194, 157, 44, 0.08), rgba(194, 157, 44, 0.02));
}
.plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.plan-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.plan-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}
.plan-badge.free {
  background: var(--line);
  color: var(--ink-soft);
}
.plan-badge.premium {
  background: var(--mustard);
  color: white;
}
.plan-benefits {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-benefits li {
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.5;
}
.plan-benefits li .check {
  color: var(--sage);
  flex-shrink: 0;
  font-weight: 700;
}
.plan-benefits li .lock {
  flex-shrink: 0;
  opacity: 0.5;
}
.btn-upgrade {
  width: 100%;
  padding: 13px 16px;
  background: var(--mustard);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-upgrade:hover {
  background: #A8841F;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(194, 157, 44, 0.3);
}
.btn-upgrade:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
  box-shadow: none;
}
.beta-notice {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(90, 124, 92, 0.1);
  border: 1px dashed var(--sage);
  border-radius: 8px;
  font-size: 12px;
  color: var(--sage);
  line-height: 1.6;
  text-align: center;
}
.beta-notice strong {
  font-weight: 700;
}
.plan-active-info {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  line-height: 1.6;
}
.plan-active-info .expire-date {
  color: var(--mustard);
  font-weight: 600;
}
.btn-downgrade {
  display: block;
  margin: 14px auto 0;
  padding: 6px 12px;
  background: transparent;
  color: var(--ink-faint);
  border: none;
  font-family: var(--font-body);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--ink-faint);
  text-underline-offset: 3px;
  transition: color 0.15s;
}
.btn-downgrade:hover {
  color: var(--ink-soft);
  text-decoration-color: var(--ink-soft);
}
.btn-downgrade:disabled {
  opacity: 0.5;
  cursor: wait;
}

/* ---- Upload Zone ---- */
.upload {
  display: block;
  width: 100%;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--paper);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 24px;
  position: relative;
  box-sizing: border-box;
}
.upload:hover {
  border-color: var(--terra-soft);
  background: rgba(232, 153, 119, 0.05);
}
.upload.drag {
  border-color: var(--terra);
  background: rgba(194, 84, 43, 0.08);
  transform: scale(1.01);
}
.upload-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}
.upload-title {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--ink);
  margin-bottom: 4px;
}
.upload-hint {
  font-size: 12px;
  color: var(--ink-soft);
}
.upload-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 1px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  line-height: 1.3;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--ink);
}
#fileInput { display: none; }

@keyframes pasteFlash {
  0% { background-color: var(--paper); border-color: var(--line); }
  20% { background-color: rgba(90, 124, 92, 0.18); border-color: var(--sage); }
  100% { background-color: var(--paper); border-color: var(--line); }
}
.upload.paste-flash {
  animation: pasteFlash 0.6s ease;
}

@media (max-width: 600px) {
  .pc-only { display: none; }
  .upload { padding: 24px 16px; }
}

/* ---- AI Usage Display ---- */
.ai-usage-display {
  font-size: 15px;
  color: var(--ink);
}
.ai-usage-display strong {
  color: var(--terra);
  font-weight: 700;
}
.ai-usage-display.exhausted strong {
  color: var(--rose);
}
.ai-usage-mini {
  text-align: center;
  margin: -8px auto 16px;
  font-size: 11px;
  color: var(--ink-faint);
}
.ai-usage-mini strong { color: var(--terra); font-weight: 600; }
.ai-usage-mini.exhausted strong { color: var(--rose); }
.ai-usage-display.admin strong {
  color: #d4af37;
  font-weight: 700;
}
.ai-usage-mini.admin strong {
  color: #d4af37;
  font-weight: 600;
}

/* ---- Card (체험단 카드) ---- */
.card {
  background: var(--card);
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: var(--terra-soft);
}
.card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--terra);
  opacity: 0.7;
}
.card.urgent::before { background: var(--rose); }
.card.completed::before { background: var(--sage); }
.card.completed { opacity: 0.7; }

.card-store {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.3;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 12px;
}
.meta-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.meta-ico {
  color: var(--ink-faint);
  font-size: 13px;
  flex-shrink: 0;
  width: 14px;
  text-align: center;
}
.meta-text { flex: 1; word-break: keep-all; }
.deadline-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  background: var(--line);
  color: var(--ink-soft);
}
.deadline-tag.warn { background: rgba(194, 157, 44, 0.15); color: #8B6F00; }
.deadline-tag.urgent { background: rgba(216, 123, 123, 0.15); color: #B54E4E; }
.deadline-tag.past { background: rgba(168, 155, 143, 0.2); color: var(--ink-soft); text-decoration: line-through; }

.memo-preview {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.memo-preview.empty { color: var(--ink-faint); }

/* ---- Map ---- */
#mapView {
  height: 70vh;
  min-height: 440px;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  background: var(--paper);
  overflow: hidden;
  position: relative;
}
#mapView .kakao-map-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-faint);
  font-size: 13px;
  text-align: center;
  padding: 30px;
  z-index: 1;
}
#mapView .kakao-map-empty .icon {
  font-size: 40px;
  opacity: 0.4;
}
.info-window {
  background: var(--card);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 4px 16px rgba(42, 37, 34, 0.15);
  min-width: 180px;
  max-width: 240px;
  border: 1px solid var(--line);
  position: relative;
}
.info-window::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  border-style: solid;
  border-width: 8px 7px 0 7px;
  border-color: var(--card) transparent transparent transparent;
}
.info-window .close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 14px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.info-window .close:hover { color: var(--ink); }
.popup-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 6px;
  color: var(--ink);
  padding-right: 18px;
}
.popup-meta {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.popup-btn {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 10px;
  background: var(--terra);
  color: white;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: var(--font-body);
}

/* ---- Custom Map Marker ---- */
.pin-wrap {
  position: relative;
  width: 0;
  height: 0;
  cursor: pointer;
}
.pin {
  position: absolute;
  left: -15px;
  top: -30px;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  background: var(--terra);
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  transition: transform 0.15s, box-shadow 0.15s;
}
.pin-wrap:hover .pin {
  transform: rotate(-45deg) scale(1.15);
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
  z-index: 10;
}
.pin.urgent { background: var(--rose); }
.pin-num {
  transform: rotate(45deg);
  color: white;
  font-weight: 700;
  font-size: 13px;
}
.pin-icon {
  transform: rotate(45deg);
  font-size: 15px;
  line-height: 1;
  display: block;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.2));
}

/* ---- Loading Spinner / Toast ---- */
.loading {
  position: fixed; inset: 0;
  background: rgba(245, 239, 230, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  flex-direction: column;
  gap: 16px;
}
.loading.active { display: flex; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--line);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: 15px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--paper);
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-lift);
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 3000;
  max-width: 90%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error { background: var(--rose); }
.toast.success { background: var(--sage); }

/* ---- Form Fields (모달 안 입력 필드) ---- */
.field {
  margin-bottom: 16px;
}
.field-label {
  display: block;
  font-size: 12px;
  color: var(--ink-soft);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.field-input,
.field-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.2s;
}
.field-input:focus,
.field-textarea:focus {
  outline: none;
  border-color: var(--terra);
}
.field-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.6;
}
.field-value {
  padding: 10px 12px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 14px;
}
.field-value.empty { color: var(--ink-faint); font-style: italic; }
.field-hint {
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(90, 124, 92, 0.08);
  border-left: 3px solid var(--sage);
  border-radius: 4px 8px 8px 4px;
  font-size: 12px;
  color: var(--sage);
  font-weight: 500;
  line-height: 1.5;
  word-break: keep-all;
}
.field-hint-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin-right: 4px;
}
/* ---- Guest Map Notice (게스트 모드 지도 안내바) ---- */
.guest-map-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, rgba(194, 157, 44, 0.12), rgba(194, 157, 44, 0.05));
  border: 1px solid rgba(194, 157, 44, 0.35);
  border-radius: 10px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}
.guest-map-notice .notice-icon {
  font-size: 18px;
  flex-shrink: 0;
}
.guest-map-notice .notice-text strong {
  color: var(--mustard);
  font-weight: 700;
}
@media (max-width: 600px) {
  .guest-map-notice {
    font-size: 12px;
    padding: 10px 12px;
  }
}
/* ---- Guest Banner (상단 안내 배너) ---- */
.guest-banner {
  background: linear-gradient(135deg, #FEE500 0%, #FDD835 100%);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding: 10px 20px;
}
.guest-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.guest-banner-text {
  font-size: 13px;
  color: #181600;
  line-height: 1.5;
}
.guest-banner-text strong {
  font-weight: 700;
}
.guest-banner-btn {
  padding: 7px 14px;
  background: rgba(0, 0, 0, 0.85);
  color: #FEE500;
  border: none;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.guest-banner-btn:hover {
  background: #181600;
  transform: translateY(-1px);
}
@media (max-width: 600px) {
  .guest-banner { padding: 8px 14px; }
  .guest-banner-text { font-size: 12px; }
  .guest-banner-btn { font-size: 11px; padding: 6px 12px; }
}

/* ---- Header Login Button (게스트 헤더용) ---- */
.btn-login-header {
  padding: 6px 14px;
  background: #FEE500;
  color: #181600;
  border: 1px solid #FEE500;
  border-radius: 18px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.btn-login-header:hover {
  background: #F6DC00;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(254, 229, 0, 0.4);
}
.btn-login-header:disabled {
  opacity: 0.5;
  cursor: wait;
  transform: none;
}
/* ---- Address Read/Edit Row ---- */
.address-read-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.address-edit-btn {
  flex-shrink: 0;
  width: 36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--ink-soft);
  transition: all 0.15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.address-edit-btn:hover {
  border-color: var(--terra);
  color: var(--terra);
  background: rgba(194, 84, 43, 0.05);
}
.address-edit-btn:active {
  transform: scale(0.94);
}

.address-edit-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}
.address-action-btn {
  flex-shrink: 0;
  width: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.address-action-btn.confirm {
  background: var(--sage);
  color: white;
  border-color: var(--sage);
}
.address-action-btn.confirm:hover {
  background: #45623F;
}
.address-action-btn.cancel {
  background: var(--card);
  color: var(--ink-soft);
}
.address-action-btn.cancel:hover {
  background: var(--line);
  color: var(--ink);
}
.address-action-btn:active {
  transform: scale(0.94);
}

.field-hint-info {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(194, 157, 44, 0.08);
  border-left: 3px solid var(--mustard);
  border-radius: 4px 8px 8px 4px;
  font-size: 12px;
  color: #8B6F00;
  line-height: 1.5;
}
