:root {
  --blue: #002874;       
  --blue-dark: #001f5c;  
  --red: #ed1c24;        
  --line-green: #06c755; 
  --text-main: #081640;
  --text-muted: #5b6478;
  --bg-card: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Google Sans", "Product Sans", "Plus Jakarta Sans", "IBM Plex Sans Thai", system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  background: #eaf0ff;
}

.page-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px 12px; /* เพิ่ม Padding บนล่างนิดหน่อยให้การ์ดไม่ติดขอบจอเกินไป */
}

.business-card {
  width: min(100%, 450px);
  /* เอา min-height ออก เพื่อให้การ์ดหดตัวพอดีกับเนื้อหา แก้ปัญหาพื้นที่สีขาวว่างๆ */
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  background-color: #fcfdfe;
  box-shadow: 0 25px 65px rgba(0, 25, 85, 0.12); /* ปรับเงาให้ซอฟต์และดูแพงขึ้น */
  padding: 40px 0 0 0;
  display: flex;
  flex-direction: column;
}

/* Header ใหม่แบบ Premium Minimalist
  ใช้เส้น Accent แดง-น้ำเงิน ที่ขอบบนสุดของการ์ด 
*/
.business-card::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, var(--red) 0%, var(--red) 35%, var(--blue) 35%, var(--blue) 100%);
  z-index: 10;
}

/* ลายจุด Dot Matrix ตกแต่งพื้นหลังให้ดูมีมิติเบาๆ */
.business-card::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 55%;
  height: 45%;
  background: radial-gradient(rgba(6, 43, 143, 0.06) 0 1.5px, transparent 2px);
  background-size: 12px 12px;
  opacity: 0.8;
  pointer-events: none;
  z-index: 1;
}

.business-card > * {
  position: relative;
  z-index: 2;
}

.brand-area {
  text-align: center;
  padding: 0 20px 10px;
}

.brand-logo {
  width: 140px;
  max-height: 80px;
  object-fit: contain;
}

.brand-fallback {
  font-size: 26px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 1px;
}

.identity-area {
  text-align: center;
  padding: 0 20px;
  margin-bottom: 5px;
}

.user-name {
  margin: 5px 0 12px;
  font-size: 28px;
  font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
}

.position-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 7px 24px;
  border-radius: 99px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 6px 16px rgba(0, 40, 116, 0.2);
}

.position-sub {
  margin: 8px 0 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.company-divider {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.company-divider::before,
.company-divider::after {
  content: "";
  position: absolute;
  top: 12px;
  width: 55px;
  height: 2px;
  background: var(--red);
}

.company-divider::before { left: 35px; }
.company-divider::after { right: 35px; }

.comp-th {
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
}

.comp-en {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.contact-grid {
  margin: 18px 20px 10px;
  padding: 12px 18px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 12px 35px rgba(0, 30, 90, 0.06);
  border: 1px solid rgba(6, 43, 143, 0.08);
  background-image: url('/assets/img/logo-ecopaint.png');
  background-repeat: no-repeat;
  background-position: calc(100% + 35px) center;
  background-size: 180px;
  background-blend-mode: overlay;
}

.contact-tile {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid rgba(6, 43, 143, 0.06);
}

.contact-tile.no-border {
  border-bottom: 0;
}

.contact-icon {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 99px;
  background: var(--blue);
  color: #fff;
  font-size: 16px;
}

.contact-icon.line-color {
  background: var(--line-green);
}

.contact-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contact-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.contact-value {
  font-size: 17px;
  font-weight: 600;
  color: #111827;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.contact-value.address-text {
  white-space: normal;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: #222;
}

/* กล่อง Action Buttons 3 คอลัมน์ */
.action-container {
  padding: 10px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 25px; /* เพิ่มระยะห่างก่อนถึง Footer ให้นิดนึงกำลังสวย */
}

.action-btn {
  min-height: 75px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 12px 4px;
  text-decoration: none;
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 30, 90, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.action-btn:active {
  transform: scale(0.96);
  box-shadow: 0 4px 8px rgba(0, 30, 90, 0.1);
}

.btn-save {
  background: linear-gradient(135deg, #00369e, var(--blue-dark));
}

.btn-line {
  background: linear-gradient(135deg, #0edb64, var(--line-green));
}

.btn-facebook {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.btn-icon {
  font-size: 22px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

.btn-labels {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.label-th {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}

.label-en {
  font-size: 8px;
  font-weight: 500;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

/* Footer ตัดเรียบ เน้นความเป็นองค์กร */
.card-footer {
  margin-top: auto;
  background: var(--blue-dark);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 3px solid var(--red);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.footer-brand-title {
  display: flex;
  flex-direction: column;
}

.f-th {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
}

.f-en {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.8;
}

.footer-divider-v {
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.25);
}

.footer-slogan {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slogan-icon {
  font-size: 14px;
  color: #16a34a;
}

.slogan-text {
  display: flex;
  flex-direction: column;
  font-size: 10px;
  line-height: 1.1;
}

.slogan-text strong {
  font-weight: 600;
}

.slogan-text span {
  opacity: 0.8;
}

.bsi-logo {
  max-width: 75px;
  max-height: 36px;
  object-fit: contain;
  background: #fff;
  border-radius: 4px;
  padding: 2px;
}

.error-card {
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}

/* Media Query สำหรับจอมือถือเล็กพิเศษ */
@media (max-width: 380px) {
  .business-card {
    padding-top: 25px;
  }
  .user-name {
    font-size: 24px;
  }
  .contact-grid {
    margin: 10px 14px;
    padding: 8px 14px;
  }
  .contact-value {
    font-size: 15px;
  }
  .action-container {
    padding: 5px 14px 15px;
    gap: 8px;
  }
  .action-btn {
    min-height: 70px;
  }
  .label-th {
    font-size: 10px;
  }
}