/* ===== Auth Dialog (shared — 2026-04-21) =====
   Reuse class name `.redeem-dialog*` để đồng nhất với module.css.
   File này standalone — include được từ profile.html (không phụ thuộc module.css).
*/

.redeem-dialog {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 2026-05-07: outer container handle TOÀN BỘ safe-area + padding. Panel chỉ
     fill 100% available area → không bao giờ tràn ra mép device (bug "che kín
     mép trên/dưới iPhone"). */
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  font-family: 'Nunito', 'Noto Sans Myanmar', system-ui, -apple-system, sans-serif;
}
.redeem-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  backdrop-filter: blur(4px);
}
.redeem-dialog-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  /* Panel = 100% available trong outer (đã trừ safe-area). Nội dung dài → scroll
     bên trong panel, không scroll body. */
  max-height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}
/* Native (iOS/Android Capacitor): scroll-padding-bottom để focus input khi
   keyboard hiện. KHÔNG cần padding-bottom cố định 30vh nữa vì
   align-items: center + max-height: 100% đã handle đúng layout. */
html.is-native .redeem-dialog-panel {
  scroll-padding-bottom: 30vh;
}
.redeem-dialog-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  color: #6b7280;
}
.redeem-dialog-close:hover { color: #111827; }
.redeem-dialog-title {
  margin: 0 0 8px;
  font-size: 18px;
  color: #111827;
}
.redeem-dialog-sub {
  margin: 0 0 14px;
  font-size: 14px;
  color: #374151;
}

.redeem-google-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.redeem-google-btn:hover { border-color: #4f6ef7; background: #f9fafb; }
.redeem-google-btn:disabled { opacity: 0.6; cursor: wait; }

/* 2026-05-04: Apple Sign-In button — đúng Apple Human Interface Guidelines.
   Style: nền đen #000, text trắng. Đặt ngay dưới Google button.
   Apple Guideline 4.8 yêu cầu Apple button ngang hàng + size tương đương Google. */
.redeem-apple-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 14px;
  margin-top: 8px;
  border: 0;
  border-radius: 12px;
  background: #000;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  font-family: inherit;
}
.redeem-apple-btn:hover { background: #1c1c1e; }
.redeem-apple-btn:active { transform: scale(0.99); }
.redeem-apple-btn:disabled { opacity: 0.6; cursor: wait; }
.redeem-apple-icon {
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
  /* Apple logo  (U+F8FF) — Apple Symbols font.
     Fallback: nếu font không có, hiện ô vuông; vẫn label rõ ràng "Sign in with Apple". */
}
.redeem-google-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #ea4335, #fbbc05, #34a853, #4285f4);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
}

.redeem-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: #9ca3af;
  font-size: 12px;
}
.redeem-divider::before,
.redeem-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.redeem-email-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.redeem-email-form input {
  padding: 11px 14px;
  font-size: 15px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}
.redeem-email-form input:focus { border-color: #4f6ef7; }

.redeem-email-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}
.redeem-email-actions button {
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 700;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #111827;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.redeem-email-actions button:hover { border-color: #4f6ef7; }
.redeem-email-actions button.is-primary {
  background: #4f6ef7;
  color: #fff;
  border-color: #4f6ef7;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.25);
}
.redeem-email-actions button.is-primary:hover { transform: translateY(-1px); }
.redeem-email-actions button:disabled { opacity: 0.6; cursor: wait; }

.redeem-forgot-row {
  margin: 10px 0 0;
  text-align: center;
}
.redeem-forgot-link {
  color: #4f6ef7;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
.redeem-forgot-link:hover { text-decoration: underline; }

.redeem-error {
  margin: 10px 0 0;
  padding: 6px 10px;
  background: #fef2f2;
  color: #b91c1c;
  border-radius: 6px;
  font-size: 13px;
}
.redeem-success {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: #ecfdf5;
  color: #065f46;
  border-left: 3px solid #10b981;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.redeem-consent {
  margin: 14px 0 0;
  font-size: 11.5px;
  color: #6b7280;
  text-align: center;
  line-height: 1.5;
}
.redeem-consent a {
  color: #4f6ef7;
  text-decoration: none;
  font-weight: 600;
}
.redeem-consent a:hover { text-decoration: underline; }


/* === Synced from module.css 2026-04-29: full redeem-* coverage cho hoithoai === */

.redeem-plans-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 10px;
  font-size: 13px;
}

.redeem-plan-item b { color: var(--primary); }

.redeem-plan-item {
  width: 100%;
  display: block;
  text-align: left;
  font: inherit;
  cursor: pointer;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #e7ebf6;
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.redeem-plan-item:hover {
  border-color: #c4cce0;
  background: #fafbff;
}

.redeem-plan-item.is-highlight {
  border-color: var(--primary);
  border-width: 2px;
  box-shadow: 0 2px 8px rgba(78, 121, 248, 0.18);
  background: #f5f8ff;
}

.redeem-plan-item .rp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  /* 2026-05-06: cho phép price wrap xuống dòng khi không fit width (iPhone <430px) */
  flex-wrap: wrap;
}

.redeem-plan-item .rp-price {
  font-weight: 700;
  color: #ef4444;
  font-size: 15px;
  /* 2026-05-06: bỏ nowrap — cho phép wrap khi cần (jpy block dài có thể overflow) */
  white-space: normal;
  text-align: right;
  /* Đảm bảo price chiếm tối đa nửa width, không lấn name */
  max-width: 60%;
  word-break: keep-all;
}

.redeem-plan-item .rp-desc {
  font-size: 12px;
  color: #6b7280;
  margin-top: 2px;
  line-height: 1.4;
}

.redeem-bonus-note {
  margin: 12px 0;
  padding: 10px 12px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px dashed #f59e0b;
  border-radius: 10px;
  font-size: 13px;
  color: #78350f;
  line-height: 1.45;
}

.redeem-bonus-note .rbn-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.redeem-bonus-note .rbn-title {
  font-weight: 700;
  color: #92400e;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
}

.redeem-bonus-note .rbn-list {
  margin: 0;
  padding-left: 18px;
}

.redeem-bonus-note .rbn-list li { margin: 2px 0; }

.redeem-bonus-note b { color: #b45309; }

.redeem-bonus-note .rbn-view-link {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  color: #b45309;
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.redeem-bonus-note .rbn-view-link:hover {
  background: #ffffff;
  color: #92400e;
  text-decoration: underline;
}

.redeem-contact-row {
  margin: 12px 0;
}

.redeem-contact-label {
  font-size: 13px;
  color: #4b5563;
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}

.redeem-contact-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.redeem-contact-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  color: #ffffff;
  transition: filter 0.15s, transform 0.1s;
}

.redeem-contact-btn .cb-icon {
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.redeem-contact-btn .cb-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.redeem-contact-btn.is-fb {
  background: #1877f2;
}

.redeem-contact-btn.is-zalo {
  background: #0099ff;
}

.redeem-contact-btn:hover { filter: brightness(1.08); }

.redeem-contact-btn:active { transform: scale(0.98); }

.redeem-auth-hint {
  margin: 10px 0;
  padding: 8px 10px;
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
  font-size: 13px;
  color: #78350f;
  border-radius: 6px;
}

.redeem-account-chip {
  margin: 4px 0 10px;
  padding: 0;
  background: transparent;
  border: 0;
  font-size: 13px;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.redeem-auth-link {
  color: var(--primary);
  text-decoration: underline;
  font-weight: 600;
}

.redeem-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.redeem-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.redeem-input {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.15s;
}

.redeem-input:focus { border-color: var(--primary); }

.redeem-submit {
  margin-top: 4px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.28);
}

.redeem-submit:hover { transform: translateY(-1px); }

.redeem-submit:active { transform: translateY(0); }

.redeem-auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 12px;
}

.redeem-auth-tab {
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.redeem-auth-tab:hover { color: #111827; }

.redeem-auth-tab.is-active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 110, 247, 0.28);
}

.redeem-email-form input[data-confirm-pass] { display: none; }

.redeem-email-form.is-mode-register input[data-confirm-pass] { display: block; }

.redeem-email-form.is-mode-register input[name='passwordConfirm'] { display: block; }

.redeem-auth-submit {
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
  margin-top: 4px;
  box-shadow: 0 4px 14px rgba(79, 110, 247, 0.25);
  transition: transform 0.1s, filter 0.15s;
}

.redeem-auth-submit:hover { filter: brightness(1.06); }

.redeem-auth-submit:active { transform: scale(0.99); }

/* ============================================================
 * 2026-05-02 — Stripe Checkout primary CTA, code input compact,
 * "or" divider, contact fallback discreet
 * ============================================================ */
.redeem-stripe-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  margin-top: 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #6f79f6 0%, #8b6df3 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(111, 121, 246, 0.32);
  transition: transform 0.1s, filter 0.15s, box-shadow 0.15s;
}

.redeem-stripe-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 6px 22px rgba(111, 121, 246, 0.42);
}

.redeem-stripe-btn:active { transform: scale(0.99); }

.redeem-stripe-btn:disabled { opacity: 0.6; cursor: wait; filter: none; }

.redeem-stripe-btn .rsb-icon {
  font-size: 18px;
  line-height: 1;
}

.redeem-stripe-btn .rsb-label {
  white-space: pre-line;
  text-align: center;
  line-height: 1.3;
}

.redeem-stripe-note {
  text-align: center;
  margin: 8px 0 0 0;
  color: #6b7280;
  font-size: 12.5px;
}

.redeem-pricing-note {
  margin: 8px 4px 0 4px;
  padding: 8px 10px;
  background: #fef3c7;
  border-radius: 6px;
  color: #78350f;
  font-size: 11.5px;
  line-height: 1.4;
  text-align: center;
}

/* Full-screen loader khi đang tạo Stripe Checkout session.
   Tránh user tưởng app treo trong 2-5s chờ Cloud Function + Stripe API + redirect. */
.redeem-stripe-loading {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: rsl-fadeIn 0.18s ease-out;
}
.redeem-stripe-loading .rsl-box {
  background: #ffffff;
  border-radius: 16px;
  padding: 28px 24px 24px 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}
.redeem-stripe-loading .rsl-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e5e7eb;
  border-top-color: #635bff;
  border-radius: 50%;
  margin: 0 auto 16px auto;
  animation: rsl-spin 0.8s linear infinite;
}
.redeem-stripe-loading .rsl-text {
  margin: 0 0 6px 0;
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  line-height: 1.4;
}
.redeem-stripe-loading .rsl-subtext {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}
@keyframes rsl-spin { to { transform: rotate(360deg); } }
@keyframes rsl-fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 2026-05-03: Native IAP section — chỉ hiện trên iOS/Android app (data-hide-web).
   Style giống Stripe button cho consistent UX, nhưng disabled cho đến khi
   Capacitor IAP plugin wired (Phase 4 launch runbook §4). */
.redeem-iap-section { margin-top: 14px; }

.redeem-iap-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #6f79f6 0%, #8b6df3 100%);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(111, 121, 246, 0.32);
  transition: transform 0.1s, filter 0.15s, box-shadow 0.15s;
}
.redeem-iap-btn:hover { filter: brightness(1.06); box-shadow: 0 6px 22px rgba(111, 121, 246, 0.42); }
.redeem-iap-btn:active { transform: scale(0.99); }
.redeem-iap-btn:disabled { opacity: 0.6; cursor: not-allowed; filter: none; }
.redeem-iap-btn .riap-icon { font-size: 18px; line-height: 1; }

.redeem-iap-note {
  text-align: center;
  margin: 8px 0 0 0;
  color: #6b7280;
  font-size: 12.5px;
}

/* Restore Purchases button — secondary action, smaller. Apple yêu cầu cho mọi app có IAP. */
.redeem-restore-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px;
  margin-top: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #4b5563;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.redeem-restore-btn:hover { background: #f9fafb; border-color: #6f79f6; color: #6f79f6; }
.redeem-restore-btn:active { transform: scale(0.99); }

.rp-price-jpy {
  display: block;
  margin-top: 2px;
  color: #6b7280;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.redeem-or-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 12px 0;
  color: #9ca3af;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.redeem-or-divider::before,
.redeem-or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e5e7eb;
}

.redeem-form.is-compact {
  margin: 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
}

.redeem-form-label {
  display: block;
  margin-bottom: 8px;
  color: #4b5563;
  font-size: 13px;
  font-weight: 600;
}

.redeem-form-row {
  display: flex;
  gap: 8px;
}

.redeem-form-row .redeem-input {
  flex: 1;
  /* 2026-05-06: min-width:0 + min-w-zero để input có thể co lại khi viewport hẹp,
     không ép button "Kích hoạt" ra ngoài viewport. Placeholder dài "NHẬP MÃ KÍCH HOẠT"
     trước đây làm input min-width = auto = content width → ép button overflow. */
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.redeem-form-row .redeem-input:focus {
  outline: none;
  border-color: #6f79f6;
  box-shadow: 0 0 0 3px rgba(111, 121, 246, 0.15);
}

.redeem-form-row .redeem-submit {
  padding: 10px 16px;
  border: 0;
  border-radius: 8px;
  background: #ffffff;
  color: #4f6ef7;
  border: 1px solid #c7d0fb;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.redeem-form-row .redeem-submit:hover {
  background: #4f6ef7;
  color: #ffffff;
}

.redeem-form-row .redeem-submit:disabled { opacity: 0.5; cursor: wait; }

.redeem-contact-fallback {
  margin: 14px 0 0 0;
  text-align: center;
  color: #6b7280;
  font-size: 12.5px;
}

.redeem-contact-fallback .rcf-link {
  margin-left: 8px;
  color: #4f6ef7;
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
}

.redeem-contact-fallback .rcf-link:hover { text-decoration: underline; }

.redeem-auth-submit:disabled { opacity: 0.6; cursor: wait; }

/* ============================================================
   2026-05-03: MOBILE RESPONSIVE — auth-dialog (trước có 0 media query)
   - iOS auto-zoom prevention (input font 16px+)
   - Tap targets ≥ 44px (Apple HIG)
   - Safe-area: notch top + home indicator bottom
   - Compact padding cho viewport ≤ 480px
   ============================================================ */
@media (max-width: 720px) {
  /* 2026-05-07: outer container đã handle safe-area. Panel chỉ cần padding
     nội dung + max-height 100% — không override safe-area lần 2 nữa (gây
     bug "tràn mép" trên iPhone). */
  .redeem-dialog-panel {
    padding: 16px;
    border-radius: 14px;
    width: min(100%, 460px);
  }

  /* Close button — tap 44×44 (Apple HIG) */
  .redeem-dialog-close {
    width: 44px;
    height: 44px;
    font-size: 22px;
    top: 6px;
    right: 6px;
  }

  /* Tất cả input/select — font 16px chống iOS auto-zoom khi focus */
  .redeem-dialog input,
  .redeem-dialog select,
  .redeem-dialog textarea,
  .redeem-input,
  .redeem-auth-input {
    font-size: 16px !important;
    min-height: 44px;
    padding: 12px 14px;
  }

  /* Buttons primary — tap 44px+ */
  .redeem-google-btn,
  .redeem-auth-submit,
  .redeem-stripe-btn,
  .redeem-iap-btn,
  .redeem-submit {
    min-height: 48px;
    font-size: 15px;
    padding: 12px 16px;
  }

  /* Restore button — secondary, 44 OK */
  .redeem-restore-btn { min-height: 44px; padding: 11px 12px; }

  /* Plan items — ≥ 56px để dễ tap chọn plan */
  .redeem-plan-item { min-height: 56px; padding: 12px 14px; }
}

@media (max-width: 380px) {
  /* iPhone SE 1st gen + rất hẹp */
  .redeem-dialog-panel { padding: 12px; border-radius: 12px; }
  .redeem-dialog-title { font-size: 17px; }
  .redeem-dialog-sub { font-size: 13px; }
  .rp-head b { font-size: 14px; }
  .rp-price { font-size: 12.5px; }
  .rp-desc { font-size: 12px; }
}

/* ===== PWA Install PILL (2026-05-30 redesign) =====
   Hộp nhỏ (hình chữ nhật bo góc) góc trên PHẢI, dưới nút ngôn ngữ.
   Mở/đóng TRƯỢT TỪ MÉP PHẢI, hiện ~10s rồi tự ẩn. KHÔNG còn modal. */
.pwa-install-pill {
  position: fixed;
  /* dưới .top-bar (top:4px + nút ngôn ngữ cao ~28px) */
  top: calc(38px + env(safe-area-inset-top, 0px));
  right: 12px;
  z-index: 60; /* trên nội dung, dưới modal (100+) */
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 4px 5px 4px 6px;
  background: #ffffff;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px; /* hình chữ nhật bo góc (không phải viên thuốc) */
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.18);
  font-family: 'Nunito', 'Noto Sans Myanmar', system-ui, sans-serif;
  /* trạng thái ẩn ban đầu — tuck off mép phải, trượt vào từ bên phải */
  transform: translateX(calc(100% + 16px));
  opacity: 0;
  pointer-events: none;
  transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
}

.pwa-install-pill.is-visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-pill-main {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(79, 110, 247, 0.10); /* nền tím nhạt CỐ ĐỊNH (như bản trước) */
  border: 0;
  cursor: pointer;
  padding: 4px 8px 4px 5px;
  border-radius: 9px;
  color: #1f2940;
  font-size: 13px;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 0.2px;
  transition: background 0.15s;
}

.pwa-pill-main:hover { background: rgba(79, 110, 247, 0.18); }
.pwa-pill-main:active { transform: scale(0.97); }

.pwa-pill-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: block;
  box-shadow: 0 2px 6px rgba(79, 110, 247, 0.25);
}

.pwa-pill-label { white-space: nowrap; }

.pwa-pill-close {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: #9ca3af;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pwa-pill-close:hover { background: #f1f3f5; color: #4b5563; }

@media (prefers-reduced-motion: reduce) {
  .pwa-install-pill {
    transform: none;
    transition: opacity 0.25s ease;
  }
}
/* ===== Country Picker Dialog (2026-05-21, P1.2.2) ===== */
.country-pick-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 8px 0 14px;
}
.country-pick-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  color: #111827;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: inherit;
  text-align: left;
}
.country-pick-btn:hover {
  border-color: #4f6ef7;
  background: #f9fafb;
}
.country-pick-btn:active {
  transform: scale(0.98);
}
.country-pick-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.country-pick-btn .country-flag {
  font-size: 22px;
  line-height: 1;
}
.country-pick-btn .country-label {
  flex: 1;
}
.country-pick-skip-row {
  text-align: center;
  margin: 6px 0 0;
}
.country-pick-skip {
  background: transparent;
  border: 0;
  color: #6b7280;
  font-size: 13px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: inherit;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.country-pick-skip:hover {
  background: #f3f4f6;
  color: #374151;
}
.country-pick-status {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: #4f6ef7;
}

/* ===== Sprint B (2026-05-21): Push permission dialog ===== */
.push-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 4px;
}
.push-dialog-allow {
  background: linear-gradient(135deg, #4f6ef7, #6f79f6);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.25);
}
.push-dialog-allow:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 110, 247, 0.32);
}
.push-dialog-allow:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.push-dialog-later {
  background: transparent;
  color: #6b7280;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.push-dialog-later:hover {
  background: #f3f4f6;
  color: #374151;
}
.push-dialog-later:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.push-dialog-status {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.4;
}

/* ===== Sprint Av (2026-05-21): Avatar dialog — 2 tab Upload + Preset ===== */
.avatar-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 12px 0 16px;
  padding: 4px;
  background: #f3f4f6;
  border-radius: 10px;
}
.avatar-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  font-size: 13.5px;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  color: #6b7280;
  transition: background 0.15s, color 0.15s;
}
.avatar-tab.is-active {
  background: #fff;
  color: var(--p-primary, #4f6ef7);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08);
}
.avatar-tab-content { margin-top: 4px; }
.avatar-tab-hint {
  margin: 0 0 12px;
  font-size: 13px;
  color: #6b7280;
  line-height: 1.5;
}
.avatar-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 200px;
  padding: 20px;
  background: #f8faff;
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.avatar-upload-zone:hover {
  background: #eef3ff;
  border-color: #4f6ef7;
}
.avatar-upload-placeholder {
  font-size: 14px;
  font-weight: 600;
  color: #6b7280;
}
.avatar-upload-preview {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}
.avatar-action-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #4f6ef7, #6f79f6);
  color: #fff;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.25);
}
.avatar-action-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 110, 247, 0.35);
}
.avatar-action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.avatar-preset-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.avatar-preset-btn:hover {
  transform: translateY(-2px);
  border-color: #4f6ef7;
  background: #f8faff;
}
.avatar-preset-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.avatar-preset-emoji {
  font-size: 32px;
  line-height: 1;
}
.avatar-preset-label {
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-align: center;
}
.avatar-status {
  margin: 12px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

/* Sprint A.6 (2026-05-21): Share dialog preview box + action buttons */
.share-preview-box {
  margin: 16px 0 12px;
  width: 100%;
  aspect-ratio: 1200/630;
  background: linear-gradient(135deg, #4f6ef7, #6f79f6, #8b5cf6);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 110, 247, 0.2);
}
.share-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.share-preview-loading {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
}
.share-preview-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: shareSpin 0.8s linear infinite;
}
@keyframes shareSpin { to { transform: rotate(360deg); } }
.share-preview-error {
  margin: 0;
  padding: 14px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
}
.share-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 4px;
}
.share-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 700;
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  color: #1f2937;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.share-action-btn:hover {
  background: #f9fafb;
  border-color: #4f6ef7;
  transform: translateY(-1px);
}
.share-action-primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #4f6ef7, #6f79f6);
  color: #fff;
  border-color: transparent;
}
.share-action-primary:hover {
  background: linear-gradient(135deg, #4f6ef7, #6f79f6);
  border-color: transparent;
  box-shadow: 0 6px 14px rgba(79, 110, 247, 0.3);
}
.share-action-fb { border-color: rgba(24, 119, 242, 0.35); }
.share-action-fb:hover { background: rgba(24, 119, 242, 0.05); border-color: #1877f2; }
.share-action-tw { border-color: rgba(15, 20, 25, 0.35); }
.share-action-tw:hover { background: rgba(15, 20, 25, 0.05); border-color: #0f1419; }
.share-status {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

/* Profile page — push reminder setting row */
.profile-push-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-push-time-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.profile-push-time-row select {
  flex: 1;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-family: inherit;
}
.profile-push-time-row[hidden] {
  display: none;
}

/* ===========================================================
   P3.0 (2026-05-24): iOS Premium Upsell Modal
   Hiển thị thay redeem dialog trên iOS (Apple Guideline 3.1.1)
   2 card options + 2 button hành động (Sign In / IAP)
   =========================================================== */
.ios-upsell-panel {
  max-width: 360px;
  padding: 24px 20px 22px;
  border-radius: 18px;
}
.ios-upsell-hero {
  text-align: center;
  margin-bottom: 18px;
}
.ios-upsell-hero-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 8px;
}
.ios-upsell-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
  margin: 0;
  letter-spacing: -0.2px;
}
.ios-upsell-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ios-upsell-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px 14px 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  text-align: center;
}
.ios-upsell-card-icon {
  font-size: 26px;
  line-height: 1;
}
.ios-upsell-card-text {
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  line-height: 1.35;
  margin: -2px 0 4px;
}
.ios-upsell-btn {
  appearance: none;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease, opacity 0.12s ease;
}
.ios-upsell-btn:not(:disabled):active {
  transform: scale(0.97);
}
.ios-upsell-btn-primary {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.28);
}
.ios-upsell-btn-primary:hover:not(:disabled) {
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.36);
}
.ios-upsell-btn-secondary {
  background: #fff;
  color: #4f46e5;
  border: 1px solid #c7d2fe;
}
.ios-upsell-btn-secondary:hover:not(:disabled) {
  background: #f5f3ff;
}
.ios-upsell-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.ios-upsell-btn-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  letter-spacing: 0.2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
}
.ios-upsell-btn-secondary .ios-upsell-btn-badge {
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
}

/* 2026-05-24: 3-plan pricing layout (Apple Review screenshot) */
.ios-upsell-panel {
  max-width: 380px;
}
.ios-upsell-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 6px 0 0;
  font-weight: 500;
}
.ios-plan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.ios-plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 6px 10px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ios-plan-card.is-featured {
  border-color: #6366f1;
  background: linear-gradient(180deg, #eef2ff 0%, #e0e7ff 100%);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.18);
  transform: translateY(-2px);
}
.ios-plan-badge {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.3px;
  padding: 3px 7px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #fff;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(239, 68, 68, 0.32);
}
.ios-plan-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
}
.ios-plan-label {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  letter-spacing: -0.1px;
}
.ios-plan-price {
  font-size: 16px;
  font-weight: 800;
  color: #111827;
  letter-spacing: -0.3px;
  line-height: 1.1;
}
.ios-plan-card.is-featured .ios-plan-price {
  color: #4f46e5;
}
.ios-plan-sub {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 6px;
}
.ios-plan-btn {
  font-size: 12px;
  padding: 7px 6px;
  flex-direction: column;
  gap: 2px;
  width: 100%;
}
.ios-plan-btn .ios-upsell-btn-badge {
  font-size: 8px;
  padding: 1px 4px;
}
.ios-upsell-signin {
  border-top: 1px solid #e2e8f0;
  padding-top: 14px;
  text-align: center;
}
.ios-upsell-signin-label {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 8px;
}
.ios-upsell-signin .ios-upsell-btn {
  width: auto;
  display: inline-flex;
  padding: 8px 24px;
}
