/* ==========================================
   구다 주역 — 앱 디자인 시스템 기반
   Color: Deep Indigo + Gold + Warm Ivory
   Font: Inter
   ========================================== */

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

:root {
  /* Primary */
  --primary: #141033;
  --primary-light: #26204A;
  --accent: #A37521;
  --accent-light: #C4953B;

  /* Dark Mode (기본) */
  --bg: #0D0B1A;
  --surface: #18152B;
  --surface-variant: #211D3D;
  --text: #F2F0F7;
  --text-secondary: #A19ABF;
  --divider: #2A2645;

  /* Status */
  --success: #388E3C;
  --error: #D32F2F;

  /* Special */
  --iching: #28627E;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ==========================================
   히어로
   ========================================== */
.hero {
  text-align: center;
  padding: 80px 0 32px;
}

.logo-text {
  font-size: 35px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--accent);
}

.tagline {
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  margin-top: 8px;
  letter-spacing: 0.2px;
}

.description {
  margin-top: 24px;
  font-size: 17px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.75;
}

/* ==========================================
   특징 카드
   ========================================== */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 32px 0;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 24px 16px;
  text-align: center;
  transition: transform 0.3s, border-color 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.feature-card p {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ==========================================
   요금 섹션
   ========================================== */
.pricing {
  padding: 48px 0 32px;
  text-align: center;
}

.pricing h2 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.pricing-subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

.pricing-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.price-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 32px 16px;
  text-align: center;
  transition: transform 0.3s, border-color 0.3s;
}

.price-card:hover {
  transform: translateY(-4px);
}

.price-card.popular {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(163, 117, 33, 0.08), var(--surface));
}

.badge {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 16px;
  border-radius: 999px;
  letter-spacing: 0.1px;
}

.badge.best {
  background: var(--accent-light);
  color: var(--primary);
}

.price-card h3 {
  font-size: 21px;
  font-weight: 600;
  margin-bottom: 12px;
}

.price {
  font-size: 25px;
  font-weight: 800;
  color: var(--text);
}

.per-chat {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 8px 0 20px;
}

/* ==========================================
   버튼
   ========================================== */
.btn {
  display: inline-block;
  padding: 12px 32px;
  border-radius: 16px;
  font-family: 'Inter', sans-serif;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  text-decoration: none;
  width: 100%;
}

.btn-primary {
  background: var(--accent);
  color: #FFFFFF;
}

.btn-primary:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-outline:hover {
  background: rgba(163, 117, 33, 0.1);
}

.btn-google {
  background: #F2F2F2;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  padding: 14px 32px;
}

.btn-google:hover {
  background: #E8E8E8;
}

.btn-apple {
  background: #000000;
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 600;
  padding: 14px 32px;
}

.btn-apple:hover {
  background: #1a1a1a;
}

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

/* ==========================================
   앱 다운로드
   ========================================== */
.download {
  text-align: center;
  padding: 32px 0;
}

.download h2 {
  font-size: 21px;
  font-weight: 600;
  margin-bottom: 8px;
}

.download p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 20px;
}

.store-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.store-btn {
  padding: 12px 24px;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  transition: border-color 0.3s;
}

.store-btn:hover {
  border-color: var(--accent);
}

/* ==========================================
   푸터
   ========================================== */
footer {
  text-align: center;
  padding: 32px 0;
  border-top: 1px solid var(--divider);
  margin-top: 32px;
}

footer p {
  color: var(--text-secondary);
  font-size: 12px;
}

.footer-links {
  margin-top: 12px;
  display: flex;
  gap: 20px;
  justify-content: center;
}

.footer-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ==========================================
   로그인 페이지
   ========================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 24px;
  padding: 48px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.auth-card h1 {
  font-size: 35px;
  font-weight: 700;
  letter-spacing: 6px;
  color: var(--accent);
}

.auth-card .subtitle {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 32px;
}

.divider {
  display: flex;
  align-items: center;
  margin: 24px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--divider);
}

.divider span {
  padding: 0 16px;
}

/* ==========================================
   결제 페이지
   ========================================== */
.payment-page {
  padding: 32px 0;
}

.payment-header {
  text-align: center;
  margin-bottom: 24px;
}

.payment-header h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.payment-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

.user-info {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info .email {
  font-size: 15px;
  color: var(--text-secondary);
}

.user-info .credits {
  font-weight: 700;
  color: var(--accent);
}

.plan-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.plan-option {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--divider);
  border-radius: 16px;
  padding: 24px 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.plan-option:hover {
  border-color: rgba(163, 117, 33, 0.5);
}

.plan-option.selected {
  border-color: var(--accent);
  background: rgba(163, 117, 33, 0.06);
}

.plan-option h3 {
  font-size: 19px;
  font-weight: 700;
  margin-bottom: 8px;
}

.plan-option .plan-price {
  font-size: 21px;
  font-weight: 800;
}

.plan-option .plan-per {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.pay-btn-area {
  text-align: center;
}

/* ==========================================
   결제 완료 페이지
   ========================================== */
.result-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 24px;
  padding: 48px 36px;
  max-width: 420px;
  width: 100%;
  text-align: center;
}

.result-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.result-card h1 {
  font-size: 25px;
  font-weight: 600;
  margin-bottom: 12px;
}

.result-card p {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 8px;
}

.result-details {
  background: var(--surface-variant);
  border-radius: 16px;
  padding: 20px;
  margin: 24px 0;
  text-align: left;
}

.result-details .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
}

.result-details .row .label {
  color: var(--text-secondary);
  font-size: 15px;
}

.result-details .row .value {
  font-weight: 600;
  font-size: 15px;
}

/* ==========================================
   구매 내역 페이지
   ========================================== */
.history-page {
  padding: 32px 0;
}

.history-header {
  text-align: center;
  margin-bottom: 24px;
}

.history-header h1 {
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 8px;
}

.history-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

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

.history-item {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.history-item .info h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}

.history-item .info p {
  font-size: 12px;
  color: var(--text-secondary);
}

.history-item .amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.history-item .status {
  font-size: 12px;
  margin-top: 4px;
  text-align: right;
}

.history-item .status.success {
  color: var(--success);
}

.history-item .status.pending {
  color: var(--text-secondary);
}

.history-item .status.failed {
  color: var(--error);
}

.history-empty {
  text-align: center;
  padding: 48px 0;
  color: var(--text-secondary);
  font-size: 15px;
}

/* ==========================================
   유틸리티
   ========================================== */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

.hidden { display: none !important; }

.error-msg {
  color: var(--error);
  font-size: 15px;
  margin-top: 12px;
}

/* ==========================================
   반응형
   ========================================== */
@media (max-width: 600px) {
  .features {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .pricing-cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .plan-selector {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 48px 0 16px;
  }

  .logo-text {
    font-size: 28px;
  }

  .auth-card, .result-card {
    padding: 32px 24px;
  }

  .store-buttons {
    flex-direction: column;
    align-items: center;
  }
}
