/* Upbase Ecard — form + single card styles. Reuses tokens from upbase-landing.css. */

.form-banner {
  padding: 16px 22px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 26px;
}
.form-banner--success { background: rgba(24, 160, 88, .12); color: #157a42; border: 1px solid rgba(24, 160, 88, .3); }
.form-banner--error { background: rgba(220, 60, 60, .1); color: #b02a2a; border: 1px solid rgba(220, 60, 60, .28); }

.ecard-owner-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px;
  margin: 0 0 20px; padding: 14px 18px; border-radius: 16px; background: rgba(248, 153, 28, .1);
  border: 1px solid rgba(248, 153, 28, .3);
}
.ecard-owner-bar p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--ink); flex: 1 1 260px; }
.ecard-owner-bar .button { flex: 0 0 auto; }

/* ---- Ecard form page ---- */
.ecard-hero { padding-top: 150px; padding-bottom: 40px; max-width: 900px; }
.ecard-hero__title { margin: 0; font-size: clamp(40px, 6vw, 74px); line-height: 1; letter-spacing: -.05em; font-weight: 800; }
.ecard-hero__title span { color: var(--orange); font-style: italic; font-weight: 400; }
.ecard-hero__lead { max-width: 620px; margin: 26px 0 0; font-size: 17px; line-height: 1.6; color: rgba(17, 16, 14, .68); }

.ecard-lookup-section { padding-bottom: 50px; }
.ecard-lookup {
  max-width: 900px; padding: 26px clamp(20px, 4vw, 34px); border-radius: 24px;
  background: var(--white); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(17, 16, 14, .06);
}
.ecard-lookup h2 { margin: 0 0 6px; font-size: 18px; letter-spacing: -.02em; }
.ecard-lookup > p { margin: 0 0 18px; font-size: 13px; color: rgba(17, 16, 14, .6); }
.ecard-lookup__form { display: flex; gap: 12px; flex-wrap: wrap; min-width: 0; }
.ecard-lookup__form input {
  flex: 1 1 260px; min-width: 0; font: inherit; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-weight: 500;
}
.ecard-lookup__form input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.ecard-lookup__message { margin: 16px 0 0; font-size: 13px; font-weight: 700; }
.ecard-lookup__message--error { color: #b02a2a; }
.ecard-lookup__results { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.ecard-lookup__results li { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.ecard-lookup__results a {
  display: inline-block; padding: 10px 16px; border-radius: 999px; background: var(--paper);
  border: 1px solid var(--line); font-size: 13px; font-weight: 700;
}
.ecard-lookup__resend { margin: 0; }
.upbase-site button.ecard-lookup__resend-btn {
  background: none !important; border: none !important; border-bottom: 1px solid var(--ink) !important;
  padding: 0 0 5px !important; color: var(--ink) !important; font: inherit !important; font-weight: 700 !important;
  cursor: pointer;
}

.ecard-form-section { padding-bottom: 140px; }
.ecard-form-section__grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 30px; align-items: start; min-width: 0; }
.ecard-form {
  padding: 40px clamp(20px, 4vw, 44px); border-radius: 30px; background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 30px 90px rgba(17, 16, 14, .08); min-width: 0;
}
.ecard-form__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; min-width: 0; }
.ecard-field { display: grid; gap: 8px; font-size: 13px; font-weight: 700; min-width: 0; }
.ecard-field--wide { grid-column: 1 / -1; }
.ecard-field input, .ecard-field textarea {
  width: 100%; font: inherit; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-weight: 500; resize: vertical;
}
.ecard-field input:focus, .ecard-field textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.ecard-field input[type="file"] { height: 48px; padding: 10px 12px; background: transparent; display: flex; align-items: center; }
.ecard-color-picker { display: flex; gap: 10px; }
.ecard-color-picker__swatch { flex: 0 0 56px; padding: 4px; height: 48px; width: 56px; cursor: pointer; border-radius: 14px; border: 1px solid var(--line); }
.ecard-color-picker__menh {
  flex: 1 1 auto; min-width: 0; font: inherit; font-weight: 500; padding: 0 14px; height: 48px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer;
}
.ecard-color-picker__swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.ecard-menh-swatch {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--white); box-shadow: 0 0 0 1px var(--line);
  cursor: pointer; padding: 0; transition: transform .2s var(--ease), box-shadow .2s;
}
.ecard-menh-swatch:hover { transform: translateY(-2px); }
.ecard-menh-swatch.is-active { box-shadow: 0 0 0 2px var(--white), 0 0 0 4px var(--orange); }
/* Each swatch's real color comes from a CSS var set inline by JS, then read
   here with !important — a theme's global `button {...}` rule (with its own
   !important) would otherwise repaint every swatch the same flat color,
   which is exactly the bug this guards against. */
.upbase-site button.ecard-menh-swatch { background: var(--menh-color) !important; }

/* Progressive "add social network" fields — only the ones the user actually
   picks show an input, instead of 8 empty fields up front. */
.ecard-social-fields { display: grid; gap: 8px; }
.ecard-social-fields__label { margin: 0; font-size: 13px; font-weight: 700; color: var(--ink); }
.ecard-social-fields__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ecard-social-fields__grid:not(:empty) { margin-bottom: 4px; }
.ecard-social-field span { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ecard-social-remove {
  border: none; background: none; padding: 0; width: 20px; height: 20px; border-radius: 50%;
  color: rgba(17, 16, 14, .5); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.ecard-social-remove:hover { background: rgba(17, 16, 14, .08); color: var(--ink); }
.ecard-social-adder { grid-column: 1 / -1; }
.ecard-social-adder select {
  width: 100%; font: inherit; font-weight: 500; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer;
}

.ecard-form__honeypot { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }
.ecard-form__submit { margin-top: 28px; }
.ecard-form__note { margin: 16px 0 0; font-size: 12px; color: rgba(17, 16, 14, .5); }
.ecard-form__current-avatar {
  display: flex; align-items: center; gap: 12px; margin: 0 0 24px; padding: 10px 14px 10px 10px;
  border-radius: 999px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; color: rgba(17, 16, 14, .6);
}
.ecard-form__current-avatar img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }

/* ---- Live preview panel (Ecard form page) ---- */
.ecard-preview { position: sticky; top: 110px; min-width: 0; }
.ecard-preview__label { margin: 0 0 14px; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: rgba(17, 16, 14, .5); text-align: center; }
.ecard-preview__hint { margin: 16px 0 0; font-size: 12px; color: rgba(17, 16, 14, .45); text-align: center; }
.ecard-card--preview { pointer-events: none; }

/* ==== Modern digital business card (Ecard single page + live preview) ==== */
.ecard-card-wrap { display: grid; gap: 26px; }
.ecard-card {
  border-radius: 32px; background: var(--white); border: 1px solid var(--line);
  box-shadow: 0 34px 100px rgba(17, 16, 14, .1); overflow: hidden;
}
.ecard-card--modern { display: flex; flex-direction: column; text-align: center; min-width: 0; }

.ecard-identity {
  background: var(--ecard-accent, var(--ink)); color: var(--ecard-accent-text, var(--white));
  padding: 44px 24px 34px; min-width: 0;
}
.ecard-identity__avatar {
  width: 112px; height: 112px; margin: 0 auto 18px; border-radius: 50%; overflow: hidden;
  border: 4px solid rgba(255, 255, 255, .3); box-shadow: 0 16px 34px rgba(0, 0, 0, .25);
}
.ecard-identity__avatar img { width: 100%; height: 100%; object-fit: cover; }
.ecard-identity__role { margin: 8px 0 0; font-size: 13px; opacity: .88; }
.ecard-identity__role strong { font-weight: 800; }
.ecard-role-line { display: block; }
.ecard-role-line + .ecard-role-line { margin-top: 4px; }
.ecard-identity__quote {
  margin: 16px auto 0; max-width: 280px; font-size: 13px; font-style: italic; line-height: 1.6;
  color: rgba(255, 255, 255, .78);
}

.ecard-identity__divider { border: none; border-top: 1px solid rgba(255, 255, 255, .22); margin: 26px 0 22px; }
.ecard-identity__divider--desktop-only { display: none; }
.ecard-identity__qr { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.ecard-identity__qr--desktop-only { display: none; }
.ecard-identity__qr-box { background: #fff; padding: 8px; border-radius: 14px; line-height: 0; }
.ecard-identity__qr-box img,
.ecard-identity__qr-box svg,
.ecard-identity__qr-box table { display: block; max-width: 150px; height: auto; border-radius: 4px; }
.ecard-identity__qr-download {
  background: none; border: none; padding: 0; cursor: pointer; font-family: inherit; font-size: 12px; font-weight: 700;
  color: inherit; opacity: .85; display: inline-flex; align-items: center; gap: 6px;
}
.ecard-identity__qr-download:hover { opacity: 1; }
.ecard-identity__qr-download--dark { color: var(--ink); opacity: .7; }
.ecard-identity__qr-download--dark:hover { opacity: 1; }

/* Mobile-only QR block, shown at the very bottom of the white body (after
   contact info) since the curved navy header has no room for it there. */
.ecard-mobile-qr { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 30px; }
.ecard-mobile-qr__divider { width: 100%; border: none; border-top: 1px solid var(--line); margin: 0 0 26px; }
.ecard-mobile-qr .ecard-identity__qr-box { border: 1px solid var(--line); }

.ecard-body { padding: 30px clamp(20px, 4vw, 32px) 36px; min-width: 0; }
.ecard-body__identity { display: none; }
.ecard-body__name { font-size: clamp(26px, 3vw, 36px) !important; font-weight: 800 !important; letter-spacing: -.02em !important; }
.ecard-body__role { margin: 10px 0 20px; font-size: 15px; color: rgba(17, 16, 14, .6); }
.ecard-body__role strong { color: var(--orange); font-weight: 800; }

/* Some WordPress themes ship global h1-h6 rules (large font-size, a fixed
   heading color) that beat these plain <h1>/<h2>/<h3> tags. Re-assert the
   card's own type system with higher specificity + !important, the same
   guard already used for buttons — otherwise headings inherit the theme's
   size/color instead of ours (huge text, low-contrast dark-on-dark). */
.upbase-site .ecard-card h1,
.upbase-site .ecard-card h2,
.upbase-site .ecard-card h3 {
  font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  margin: 0 !important;
  color: inherit !important;
}
.upbase-site .ecard-identity__name {
  font-size: clamp(22px, 3vw, 28px) !important; font-weight: 800 !important;
  letter-spacing: -.02em !important; line-height: 1.15 !important; word-break: break-word;
}
.upbase-site .ecard-body__heading {
  font-size: 15px !important; font-weight: 800 !important; letter-spacing: -.01em !important;
  text-transform: none !important; text-align: center !important; color: var(--ink) !important; margin: 0 0 16px !important;
}
.upbase-site .ecard-body__heading:not(:first-of-type) { margin-top: 28px !important; }
.upbase-site .ecard-identity__role,
.upbase-site .ecard-identity__role strong {
  color: inherit !important; font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}
.ecard-body__quote { margin: 0 0 14px; font-size: 14px; font-style: italic; line-height: 1.6; color: rgba(17, 16, 14, .66); }
/* On the real ecard page, the quote lives in the navy panel on mobile
   (.ecard-identity__quote) and moves to the white panel on desktop. */
.ecard-single .ecard-body__quote { display: none; }
.ecard-single .ecard-body__quote { max-width: 560px; margin-left: auto; margin-right: auto; }
.ecard-body__website { display: inline-block; margin: -4px 0 20px; font-size: 13px; font-weight: 700; color: var(--ink); border-bottom: 1px solid var(--line); }

.ecard-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 30px; }
.ecard-action {
  display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 18px; border-radius: 14px;
  font-size: 13px; font-weight: 800; color: #fff; border: none; cursor: pointer; font-family: inherit;
  transition: transform .25s var(--ease), box-shadow .25s; flex: 0 1 auto;
}
.ecard-action i {
  width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, .25); font-style: normal; font-size: 11px;
}
a.ecard-action:hover, button.ecard-action:hover { transform: translateY(-2px); box-shadow: 0 12px 24px rgba(17, 16, 14, .16); }
.ecard-action--call { background: #16a34a; }
.ecard-action--email { background: var(--orange); }
.ecard-action--save { background: #eab308; }

/* "Lưu danh bạ" is a real <button>; guard it the same way as other plugin
   buttons so a theme's global `button {...}` rule can never repaint it. */
.upbase-site button.ecard-action--save {
  background: #eab308 !important; color: #fff !important; border: none !important;
  font-family: "Plus Jakarta Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
}

.ecard-social-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ecard-social-badge {
  width: 48px; height: 48px; flex: 0 0 auto; border-radius: 14px; display: grid; place-items: center;
  transition: transform .25s var(--ease);
}
.ecard-social-badge svg { width: 22px; height: 22px; }
a.ecard-social-badge:hover { transform: translateY(-3px); }
.ecard-social-badge--zalo { background: #0068ff; }
.ecard-social-badge--facebook { background: #1877f2; }
.ecard-social-badge--instagram { background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4); }
.ecard-social-badge--youtube { background: #ff0000; }
.ecard-social-badge--tiktok { background: #010101; }
.ecard-social-badge--twitter { background: #000000; }
.ecard-social-badge--pinterest { background: #e60023; }
.ecard-social-badge--linkedin { background: #0a66c2; }

.ecard-contact-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; text-align: left; }
.ecard-contact-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 16px 9px 9px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--line); font-size: 13px; font-weight: 700;
  color: var(--ink); word-break: break-word; flex: 0 1 auto;
}
a.ecard-contact-row:hover { background: #fff; box-shadow: 0 12px 26px rgba(17, 16, 14, .08); }
/* Guard against a theme's global `a { color: ... }` rule washing this text
   out (the same class of bug already fixed for buttons/headings). */
.upbase-site a.ecard-contact-row,
.upbase-site a.ecard-contact-row span {
  color: var(--ink) !important;
}
.ecard-contact-row__icon {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-style: normal; font-size: 13px;
}
.ecard-contact-row__icon--phone { background: #16a34a; }
.ecard-contact-row__icon--email { background: var(--orange); }
.ecard-contact-row__icon--address { background: #ef4444; }

.ecard-single { padding-bottom: 120px; max-width: 560px; }
.ecard-single--no-header { padding-top: 28px; }
.ecard-single .ecard-card-wrap { gap: 30px; }
.ecard-single__cta { text-align: center; margin: 30px 0 0; padding-left: 20px; padding-right: 20px; }
.upbase-site .ecard-single__cta .text-link {
  color: rgba(17, 16, 14, .45) !important; border-bottom-color: rgba(17, 16, 14, .25) !important;
}
.upbase-site .ecard-single__cta .text-link:hover { color: rgba(17, 16, 14, .75) !important; }

/* Desktop: identity panel becomes a fixed-width sidebar beside the white
   body, matching the two-tone "digital card" layout. Scoped to the real
   ecard page only — the live-preview card in the split form layout stays
   single-column since its own box is always narrow regardless of viewport. */
@media (min-width: 760px) {
  .ecard-single { max-width: 1200px; }
  .ecard-single .ecard-card--modern { flex-direction: row; text-align: left; align-items: stretch; }
  .ecard-single .ecard-identity {
    flex: 0 0 340px; display: flex; flex-direction: column; justify-content: center;
    align-items: center; text-align: center; padding: 48px 36px;
  }
  .ecard-single .ecard-identity__name { font-size: 24px !important; }
  .ecard-single .ecard-identity__quote { display: none; }
  .ecard-single .ecard-identity__divider--desktop-only { display: block; width: 100%; }
  .ecard-single .ecard-identity__qr--desktop-only { display: flex; }
  .ecard-single .ecard-body { flex: 1 1 auto; text-align: center; padding: 40px 56px 48px; }
  .ecard-single .ecard-body__identity { display: block; }
  .ecard-single .ecard-body__quote { display: block; }
  .ecard-single .ecard-mobile-qr { display: none; }
}

@media (max-width: 1000px) {
  .ecard-form-section__grid { grid-template-columns: 1fr; }
  .ecard-preview { position: static; max-width: 420px; margin: 0 auto; }
}

@media (max-width: 640px) {
  .ecard-form { padding: 28px 20px; }
  .ecard-form__grid { grid-template-columns: 1fr; }
  .ecard-social-fields__grid { grid-template-columns: 1fr; }

  /* Full-bleed card on phones — no side gutter, no floating-card look.
     The card itself goes edge-to-edge, but banners/owner-bar above it keep
     a small side margin so their rounded boxes don't look clipped. */
  .ecard-single { padding-left: 0; padding-right: 0; }
  .ecard-single .ecard-card { border-radius: 0; box-shadow: none; border: none; border-bottom: 1px solid var(--line); }
  .ecard-single .form-banner,
  .ecard-single .ecard-owner-bar { margin-left: 20px; margin-right: 20px; }
}

@media (max-width: 759px) {
  /* "Mạng xã hội" / "Thông tin liên hệ" and their rows read left-aligned on
     phones — only the avatar/name/quote/action-buttons above stay centered. */
  .upbase-site .ecard-body__heading { text-align: left !important; }
  .ecard-social-grid { justify-content: flex-start; }
  .ecard-contact-list { align-items: stretch; }
  .ecard-contact-row { width: 100%; }

  /* Action buttons as a 2-column grid: when there's an odd one out (e.g. 3
     buttons), it spans the full row instead of floating narrow and off-center. */
  .ecard-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
  .ecard-action:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

/* Small floating "share" button, corner-anchored (mirrors .back-to-top's
   position pattern but on the opposite side so the two never collide). */
.ecard-share-fab {
  position: fixed;
  z-index: 120;
  left: max(16px, env(safe-area-inset-left));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px 10px 10px;
  border: 1px solid rgba(248, 153, 28, .4);
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(11, 31, 77, .28);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.ecard-share-fab i {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--orange);
  color: var(--ink);
  font-style: normal;
  font-size: 12px;
}
.ecard-share-fab:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(11, 31, 77, .34); }
