/* =========================================
   CSS Variables & Theme — Allstate Navy
   ========================================= */
:root {
  --bg: #f2f4f7;
  --card-bg: #ffffff;
  --text: #1b2a4a;
  --text-secondary: #6b7a94;
  --border: #e4e8ee;
  --accent: #003d6b;
  --btn-bg: #f5f7fa;
  --btn-hover: #e8ecf2;
  --shadow: 0 4px 24px rgba(0,0,0,0.06);
  --radius: 20px;
  --radius-sm: 14px;
  --toast-bg: #1b2a4a;
  --toast-text: #fff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1a;
    --card-bg: #141c2e;
    --text: #e4e8f0;
    --text-secondary: #8a96aa;
    --border: #1e2a40;
    --accent: #5ba3d9;
    --btn-bg: #1a2438;
    --btn-hover: #223050;
    --shadow: 0 4px 24px rgba(0,0,0,0.25);
    --toast-bg: #e4e8f0;
    --toast-text: #141c2e;
  }
}

/* =========================================
   Reset & Base
   ========================================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font: inherit;
  border: none;
  background: none;
  color: inherit;
}

/* =========================================
   Layout
   ========================================= */
.card-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px;
  padding-top: max(20px, env(safe-area-inset-top));
  padding-bottom: max(32px, env(safe-area-inset-bottom));
  min-height: 100vh;
  min-height: 100dvh;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  padding: 32px 24px;
}

/* =========================================
   Divider
   ========================================= */
.divider {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* =========================================
   Header
   ========================================= */
.card-header {
  text-align: center;
  margin-bottom: 24px;
}

.avatar-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--accent);
  background: var(--btn-bg);
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.subtitle {
  font-size: 0.88rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* =========================================
   Business Card
   ========================================= */
.biz-card-section {
  text-align: center;
  margin-bottom: 0;
}

.biz-card-wrap {
  margin: 0 auto 14px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.biz-card-img {
  width: 100%;
  height: auto;
}

/* =========================================
   Action Buttons
   ========================================= */
.actions {
  margin: 0;
}

.actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.action-btn {
  flex: 0 0 calc((100% - 20px) / 3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 16px 4px;
  min-height: 84px;
  background: var(--btn-bg);
  border-radius: var(--radius-sm);
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.action-btn:hover,
.action-btn:focus-visible {
  background: var(--btn-hover);
}

.action-btn:active {
  transform: scale(0.96);
}

.action-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.action-btn .icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn .icon svg {
  width: 26px;
  height: 26px;
}

.action-btn .label {
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.25;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* Icon Colors */
.action-btn.phone .icon   { color: #34c759; }
.action-btn.sms .icon     { color: #5ac8fa; }
.action-btn.email .icon   { color: #ff9500; }
.action-btn.whatsapp .icon { color: #25d366; }
.action-btn.vcard .icon   { color: var(--accent); }
.action-btn.share .icon   { color: #ff3b30; }
.action-btn.copy-link .icon { color: #ff3b30; }

/* =========================================
   QR Section
   ========================================= */
.qr-section {
  text-align: center;
}

.section-title {
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.qr-wrap {
  width: 172px;
  height: 148px;
  margin: 0 auto 10px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  padding: 6px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

.qr-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 60%;
}

.wechat-id {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 14px;
}

.qr-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* =========================================
   Buttons
   ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.97);
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.btn-outline:hover {
  background: var(--btn-bg);
  border-color: var(--accent);
}

/* =========================================
   Toast
   ========================================= */
.toast {
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--toast-bg);
  color: var(--toast-text);
  padding: 10px 24px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================
   Footer
   ========================================= */
.footer {
  margin-top: 16px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
}

/* =========================================
   WeChat Guide Overlay
   ========================================= */
.wechat-guide {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.75);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 16px 20px;
}

.wechat-guide-arrow {
  width: 40px;
  height: 40px;
  margin-right: 12px;
  margin-bottom: 12px;
  border-left: 4px solid #fff;
  border-top: 4px solid #fff;
  border-radius: 4px 0 0 0;
  transform: rotate(45deg);
  animation: wechat-bounce 1.2s ease infinite;
}

@keyframes wechat-bounce {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(-8px); }
}

.wechat-guide-content {
  background: #fff;
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  max-width: 320px;
  margin: 0 auto;
}

.wechat-guide-text {
  font-size: 1.05rem;
  color: #1a1a1a;
  line-height: 1.6;
  margin-bottom: 8px;
}

.wechat-guide-sub {
  font-size: 0.82rem;
  color: #888;
  margin-bottom: 20px;
}

.wechat-guide-btn {
  display: block;
  width: 100%;
  padding: 12px;
  background: var(--accent, #003d6b);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.wechat-guide-btn:active {
  opacity: 0.85;
}

/* =========================================
   Responsive
   ========================================= */
@media (min-width: 480px) {
  .card {
    padding: 36px 32px;
  }
}

@media (max-width: 340px) {
  .card {
    padding: 24px 16px;
  }
  .actions-grid {
    gap: 8px;
  }
}
