/* NZ Wine Helper — 커스텀 스타일 */
/* 테마 컬러: #2d6a4f (메인), #52b788 (보조) */

/* 기본 폰트 */
body {
  font-size: 16px;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Noto Sans KR', sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ─── 카드 컴포넌트 ────────────────────────────────── */
.card {
  background: white;
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

/* ─── 섹션 타이틀 ──────────────────────────────────── */
.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.75rem;
}

/* ─── 언어 탭 버튼 ─────────────────────────────────── */
.lang-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  padding: 0.625rem 0.75rem;
  border: 2px solid #d1fae5;
  border-radius: 0.625rem;
  background: white;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  min-height: 44px;
  flex: 1;
}

.lang-tab:hover:not(.active) {
  border-color: #52b788;
  background: #f0fdf4;
  color: #2d6a4f;
}

.lang-tab.active {
  border-color: #2d6a4f;
  background: #2d6a4f;
  color: white;
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.3);
}

.lang-tab .flag {
  font-size: 1.125rem;
  line-height: 1;
}

/* ─── 카메라 버튼 (대형, 모바일 우선) ──────────────── */
.camera-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 1.5rem 1rem;
  border: 2px solid #2d6a4f;
  border-radius: 1rem;
  background: linear-gradient(135deg, #2d6a4f 0%, #40916c 100%);
  color: white;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 100px;
  font-size: 1rem;
  font-weight: 700;
}

.camera-btn:hover {
  background: linear-gradient(135deg, #245a43 0%, #356256 100%);
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.35);
  transform: translateY(-1px);
}

.camera-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

.camera-btn .camera-icon {
  font-size: 2.5rem;
  line-height: 1;
}

/* ─── 업로드 버튼 (보조) ───────────────────────────── */
.upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem 1rem;
  border: 2px dashed #52b788;
  border-radius: 0.75rem;
  background: #f0fdf4;
  color: #2d6a4f;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 56px;
  font-size: 0.9375rem;
  font-weight: 600;
}

.upload-btn:hover {
  border-color: #2d6a4f;
  background: #d8f3dc;
}

.upload-btn:active {
  background: #b7e4c7;
  transform: scale(0.99);
}

/* ─── 분석 시작 버튼 ───────────────────────────────── */
.analyze-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  width: 100%;
  padding: 1rem;
  border: none;
  border-radius: 0.875rem;
  background: linear-gradient(135deg, #2d6a4f 0%, #52b788 100%);
  color: white;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 56px;
  font-size: 1.125rem;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(45, 106, 79, 0.3);
}

.analyze-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #245a43 0%, #40916c 100%);
  box-shadow: 0 6px 16px rgba(45, 106, 79, 0.4);
  transform: translateY(-1px);
}

.analyze-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(45, 106, 79, 0.2);
}

.analyze-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* ─── 보조 버튼 ────────────────────────────────────── */
.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 48px;
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-secondary:active {
  background: #d1d5db;
  transform: scale(0.98);
}

/* ─── 아이콘 버튼 ──────────────────────────────────── */
.btn-icon {
  background: #f0fdf4;
  border: 1px solid #d1fae5;
  border-radius: 0.625rem;
  padding: 0.5rem 0.625rem;
  font-size: 1.125rem;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2d6a4f;
  font-weight: 600;
}

.btn-icon:hover {
  background: #d8f3dc;
  border-color: #52b788;
}

/* ─── 로딩 스피너 ──────────────────────────────────── */
.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid #d8f3dc;
  border-top-color: #2d6a4f;
  border-radius: 9999px;
  animation: spin 0.8s linear infinite;
}

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

/* ─── 결과 섹션 카드 ───────────────────────────────── */
.result-section-card {
  border: 1px solid #d8f3dc;
  border-radius: 0.875rem;
  padding: 1rem 1.125rem;
  margin-bottom: 0.875rem;
  background: white;
  transition: box-shadow 0.15s;
}

.result-section-card:hover {
  box-shadow: 0 2px 8px rgba(45, 106, 79, 0.1);
}

.result-section-card:last-child {
  margin-bottom: 0;
}

/* ─── Markdown 프로즈 스타일 ───────────────────────── */
.prose-wine {
  color: #374151;
  font-size: 1rem;
  line-height: 1.75;
}

.prose-wine h1,
.prose-wine h2,
.prose-wine h3 {
  font-weight: 700;
  color: #2d6a4f;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

.prose-wine h1 { font-size: 1.25rem; }
.prose-wine h2 { font-size: 1.125rem; }
.prose-wine h3 { font-size: 1rem; color: #40916c; }

.prose-wine p {
  margin-bottom: 0.75rem;
}

.prose-wine ul,
.prose-wine ol {
  padding-left: 1.5rem;
  margin-bottom: 0.75rem;
}

.prose-wine li {
  margin-bottom: 0.375rem;
}

.prose-wine strong {
  font-weight: 700;
  color: #1b4332;
}

.prose-wine em {
  color: #52b788;
}

/* 구분선 */
.prose-wine hr {
  border: none;
  border-top: 1px solid #d8f3dc;
  margin: 1rem 0;
}

/* 코드 */
.prose-wine code {
  background: #f0fdf4;
  border-radius: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: 0.875em;
  color: #2d6a4f;
}

/* ─── 이미지 미리보기 ──────────────────────────────── */
#preview-img {
  border-radius: 0.75rem;
  border: 2px solid #d8f3dc;
}

/* ─── 행사 배너 ────────────────────────────────────── */
.event-banner {
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #40916c 100%);
  color: white;
  text-align: center;
  padding: 1rem 1.25rem;
  border-radius: 1rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.event-banner .event-highlight {
  color: #95d5b2;
  font-weight: 600;
  opacity: 0.9;
}

/* ─── 모바일 safe-area ─────────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  main {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }
}

/* ─── 애니메이션 ───────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ─── 스트리밍 커서 깜빡임 ─────────────────────────── */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

.streaming-cursor::after {
  content: '▌';
  color: #2d6a4f;
  animation: blink 0.8s infinite;
  margin-left: 1px;
}

/* ─── 에러 메시지 ──────────────────────────────────── */
.error-msg {
  color: #dc2626;
  font-size: 0.875rem;
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ─── 성공 뱃지 ────────────────────────────────────── */
.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: #d8f3dc;
  color: #2d6a4f;
  border-radius: 9999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
}

/* ─── 드래그 오버 효과 ─────────────────────────────── */
.drag-over {
  border-color: #2d6a4f !important;
  background: #f0fdf4 !important;
}

/* ─── 반응형 (375px 기준) ──────────────────────────── */
@media (max-width: 400px) {
  .lang-tab {
    padding: 0.5rem 0.375rem;
    font-size: 0.8125rem;
  }

  .lang-tab .flag {
    font-size: 1rem;
  }

  .camera-btn {
    min-height: 88px;
  }

  .camera-btn .camera-icon {
    font-size: 2rem;
  }
}

/* ─── 결과 액션 버튼 그룹 ──────────────────────────── */
.result-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.result-actions .btn-action {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 1rem;
  border-radius: 0.625rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
  border: none;
}

.btn-action-primary {
  background: #2d6a4f;
  color: white;
  flex: 1;
}

.btn-action-primary:hover {
  background: #245a43;
}

.btn-action-secondary {
  background: #f0fdf4;
  color: #2d6a4f;
  border: 1px solid #95d5b2 !important;
  flex: 1;
}

.btn-action-secondary:hover {
  background: #d8f3dc;
}

.btn-action-tertiary {
  background: #f3f4f6;
  color: #374151;
  border: 1px solid #e5e7eb !important;
  flex: 1;
}

.btn-action-tertiary:hover {
  background: #e5e7eb;
}
