/* Brunch Vote - Front styles. Mobile-first, responsive */

.bv-container {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
  padding: 1rem;
  padding-bottom: max(1.95rem, calc(0.95rem + env(safe-area-inset-bottom, 0px)));
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
}

.bv-attribution-disney {
  position: absolute;
  bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  left: max(0.5rem, env(safe-area-inset-left, 0px));
  margin: 0;
  line-height: 0;
  z-index: 2;
  pointer-events: none;
}

.bv-attribution-disney img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(64px, 26vw);
  max-height: 0.9375rem;
  object-fit: contain;
  object-position: left bottom;
}

.bv-card {
  background: #fff;
  border-radius: 16px;
  padding: 1.5rem 1.25rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.bv-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.bv-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.25rem 0;
}

.bv-subtitle {
  font-size: 0.95rem;
  color: #666;
  margin: 0;
}

/* นับถอยหลัง */
.bv-countdown-intro {
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: #444;
  margin: 0.75rem 0 0.5rem;
  line-height: 1.35;
}

.bv-countdown {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.bv-countdown-item {
  background: #fff;
  border-radius: 12px;
  padding: 0.6rem 0.5rem;
  min-width: 4rem;
  text-align: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  flex: 1;
  max-width: 5rem;
}

.bv-countdown-number {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.bv-countdown-days .bv-countdown-number { color: #e85a71; }
.bv-countdown-hours .bv-countdown-number { color: #5a9fc9; }
.bv-countdown-minutes .bv-countdown-number { color: #e85a71; }
.bv-countdown-seconds .bv-countdown-number { color: #5a9fc9; }

.bv-countdown-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  background: linear-gradient(90deg, #e85a71 0%, #8b6b9e 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.bv-countdown-hours .bv-countdown-label,
.bv-countdown-seconds .bv-countdown-label {
  background: linear-gradient(90deg, #5a9fc9 0%, #8b6b9e 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

.bv-countdown-ended {
  width: 100%;
  text-align: center;
  font-weight: 600;
  color: #666;
  margin: 0.5rem 0 0 0;
}

.bv-countdown.bv-countdown-done .bv-countdown-item {
  display: none;
}

/* แชร์สตอรี่ หลังโหวต */
.bv-share-story-wrap {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid #eee;
}

.bv-share-story .bv-share-title {
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  text-align: center;
}

.bv-share-story .bv-share-image-wrap {
  text-align: center;
  margin-bottom: 0.75rem;
}

.bv-share-story .bv-share-image {
  max-width: 100%;
  width: 240px;
  height: auto;
  border-radius: 12px;
  display: block;
  margin: 0 auto;
}

.bv-share-story .bv-share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin: 0;
}

.bv-share-story .bv-share-buttons .bv-btn {
  width: auto;
  min-width: 140px;
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  text-decoration: none;
  text-align: center;
  box-sizing: border-box;
}

.bv-share-story .bv-share-fb {
  background: #1877f2;
  color: #fff;
}

.bv-share-story .bv-share-ig {
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888);
  color: #fff;
}

/* ผู้โชคดีที่ได้รางวัล (หน้าบ้าน) */
.bv-winner-display {
  margin-top: 1.5rem;
  padding: 1.25rem 1.25rem 1rem;
  background: linear-gradient(145deg, #fffbf0 0%, #fef5e7 50%, #fdebd0 100%);
  border-radius: 16px;
  border: 1px solid rgba(210, 165, 80, 0.35);
  box-shadow: 0 2px 12px rgba(139, 105, 20, 0.06);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.bv-winner-display::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #d4a84b, #e8c97a);
  border-radius: 16px 16px 0 0;
}

.bv-winner-display .bv-winner-title {
  font-weight: 700;
  color: #8b6914;
  margin: 0 0 0.75rem 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.95;
}

.bv-winner-display .bv-winner-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.35rem 0;
  line-height: 1.4;
  letter-spacing: 0.02em;
}

.bv-winner-display .bv-winner-value:last-of-type {
  margin-bottom: 0;
}

.bv-winner-display .bv-winner-contact {
  font-size: 0.85rem;
  color: #7d6b3d;
  margin: 0.85rem 0 0 0;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(139, 105, 20, 0.2);
  font-weight: 500;
}

.bv-winner-display .bv-winner-contact a {
  color: #06c755;
  font-weight: 600;
  text-decoration: none;
}

.bv-winner-display .bv-winner-contact a:hover {
  text-decoration: underline;
}

.bv-winner-display--in-results {
  margin-top: 0;
  margin-bottom: 1rem;
}

.bv-voting-closed-notice {
  margin: 0 0 1rem 0;
  padding: 0.75rem 1rem;
  text-align: center;
  font-weight: 600;
  font-size: clamp(0.82rem, 2.8vw, 0.95rem);
  color: #5a4a3a;
  background: rgba(255, 248, 240, 0.95);
  border-radius: 12px;
  border: 1px solid rgba(210, 165, 80, 0.25);
  line-height: 1.45;
}

/* Step: ยืนยันตัวตน */
.bv-step-identity {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  overflow: visible;
}

.bv-input.bv-phone {
  width: 100%;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 1px solid #ddd;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.2s;
}

.bv-input.bv-phone:focus {
  border-color: #333;
}

.bv-input.bv-phone::placeholder {
  color: #999;
}

.bv-btn {
  width: 100%;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
}

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

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

.bv-btn-confirm {
  background: #1a1a1a;
  color: #fff;
}

.bv-register-link {
  text-align: center;
  margin: 0;
  font-size: 0.9rem;
}

.bv-register-link a {
  color: #666;
  text-decoration: none;
}

.bv-register-link a:hover {
  text-decoration: underline;
}

/* ข้อความ error + ปุ่มสมัครสมาชิก (เบอร์ยังไม่ลงทะเบียน) */
.bv-identity-error,
.bv-vote-error {
  text-align: center;
}

.bv-message-error .bv-btn-register,
.bv-identity-error .bv-btn-register,
.bv-vote-error .bv-btn-register {
  display: inline-block;
  width: auto;
  padding: 0.5rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  border-radius: 8px;
  background: #a08078;
  color: #fff !important;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s, filter 0.2s;
}
.bv-message-error .bv-btn-register:hover,
.bv-identity-error .bv-btn-register:hover,
.bv-vote-error .bv-btn-register:hover {
  color: #fff !important;
  opacity: 0.94;
  filter: brightness(0.96);
  text-decoration: none !important;
}
.bv-message-error .bv-btn-register:active,
.bv-identity-error .bv-btn-register:active,
.bv-vote-error .bv-btn-register:active {
  transform: scale(0.98);
}

/* Step: โหวต */
.bv-step-vote {
  margin-bottom: 1.5rem;
}

.bv-vote-label {
  text-align: center;
  font-size: 0.95rem;
  color: #555;
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

.bv-vote-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.bv-vote-idle-countdown {
  text-align: center;
  font-size: clamp(0.8rem, 2.6vw, 0.9rem);
  color: #666;
  /* margin-top ไม่ใช้ — margin จะ collapse กับ margin-bottom ของ .bv-vote-buttons จนไม่เห็นระยะเพิ่ม */
  margin: 0 0 0.75rem;
  line-height: 1.45;
  padding: 0 0.5rem;
}

/* ระยะใต้ปุ่ม: รวม 80px เดิม + ~สองบรรทัด (margin ของ p ถัดไปไม่ซ้อนเพิ่มเพราะตั้ง margin-top: 0) */
#content .bv-container .bv-step-vote.bv-vote-idle-visible .bv-vote-buttons,
.bv-container .bv-step-vote.bv-vote-idle-visible .bv-vote-buttons {
  margin-bottom: calc(80px + 0.9rem) !important;
}

#content .bv-container .bv-step-vote p.bv-vote-idle-countdown,
.bv-container .bv-step-vote p.bv-vote-idle-countdown {
  margin: 0 0 0.75rem !important;
}

.bv-vote-idle-note {
  margin: 0.2rem auto 0.85rem;
  max-width: 34rem;
  text-align: left;
  font-size: clamp(0.8rem, 2.5vw, 0.92rem);
  line-height: 1.55;
  color: #5a5a5a;
  padding: 0 0.5rem;
}

.bv-vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  min-width: 120px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 0.95rem;
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}

.bv-vote-btn:active {
  transform: scale(0.98);
}

.bv-vote-btn:hover {
  background: #eee;
}

.bv-vote-male { border-color: #7eb8da; color: #2e7ab8; }
.bv-vote-male:hover { background: #e8f2f9; }

.bv-vote-female { border-color: #e8a4b8; color: #c75a7b; }
.bv-vote-female:hover { background: #fdf0f3; }

.bv-vote-btn-has-img {
  justify-content: center;
  min-width: 0 !important;
  max-width: none !important;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  border-radius: 0 !important;
}

.bv-vote-btn-has-img:focus,
.bv-vote-btn-has-img:focus-visible,
.bv-vote-btn-has-img:hover,
.bv-vote-btn-has-img:active {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.bv-vote-btn-has-img .bv-vote-btn-img {
  width: 56px;
  height: 56px;
  max-width: 180px;
  max-height: none;
  aspect-ratio: 3/4;
  height: auto;
  border-radius: 0;
  border: none !important;
  box-shadow: none !important;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  margin: 0 auto;
}

.bv-vote-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
}

.bv-vote-icon-male,
.bv-vote-icon-1 { background: linear-gradient(135deg, #7eb8da 0%, #5a9fc9 100%); }
.bv-vote-icon-female,
.bv-vote-icon-2 { background: linear-gradient(135deg, #e8a4b8 0%, #d97a95 100%); }
.bv-vote-icon-3 { background: linear-gradient(135deg, #a8d5a2 0%, #7bc96f 100%); }
.bv-vote-icon-4 { background: linear-gradient(135deg, #f7dc6f 0%, #e8b923 100%); }
.bv-vote-icon-5 { background: linear-gradient(135deg, #b8a9c9 0%, #9b8ab3 100%); }

.bv-vote-opt3 { border-color: #7bc96f; color: #4a7c47; }
.bv-vote-opt3:hover { background: #e8f5e9; }
.bv-vote-opt4 { border-color: #e8b923; color: #b8860b; }
.bv-vote-opt4:hover { background: #fffde7; }
.bv-vote-opt5 { border-color: #9b8ab3; color: #5e4d6b; }
.bv-vote-opt5:hover { background: #f3eff8; }

/* ผลโหวต - รองรับหลายตัวเลือก */
.bv-results {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid #eee;
}

.bv-results-visual {
  margin-bottom: 1rem;
}

.bv-selected-choice-image {
  text-align: center;
  margin-bottom: 0.75rem;
  width: 100%;
  height: 110px;
  overflow: hidden;
}

.bv-selected-choice-img {
  max-width: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}

/* กราฟิกแสดงผลโหวต (2 ตัวเลือก) - SVG/รูปที่อัปโหลดหรือรูป default */
.bv-tshirt-wrap {
  margin-bottom: 0.75rem;
  text-align: center;
}

.bv-tshirt-svg {
  width: 100%;
  max-width: 280px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.bv-tshirt-path {
  transition: none;
}

.bv-results-bar-fallback {
  display: none;
}

/* แถบแบ่งครึ่ง (เมื่อมากกว่า 2 ตัวเลือก) */
.bv-results-bar {
  display: flex;
  height: 80px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.bv-bar-male,
.bv-bar-segment.bv-bar-1 {
  background: linear-gradient(180deg, #7eb8da 0%, #5a9fc9 100%);
  min-width: 10px;
  transition: width 0.4s ease;
}

.bv-bar-female,
.bv-bar-segment.bv-bar-2 {
  background: linear-gradient(180deg, #e8a4b8 0%, #d97a95 100%);
  min-width: 10px;
  transition: width 0.4s ease;
}

.bv-bar-segment.bv-bar-3 {
  background: linear-gradient(180deg, #a8d5a2 0%, #7bc96f 100%);
  min-width: 10px;
  transition: width 0.4s ease;
}

.bv-bar-segment.bv-bar-4 {
  background: linear-gradient(180deg, #f7dc6f 0%, #e8b923 100%);
  min-width: 10px;
  transition: width 0.4s ease;
}

.bv-bar-segment.bv-bar-5 {
  background: linear-gradient(180deg, #b8a9c9 0%, #9b8ab3 100%);
  min-width: 10px;
  transition: width 0.4s ease;
}

.bv-results-labels {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  font-size: 1rem;
}

.bv-option-result {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.bv-label-male,
.bv-label-1 { color: #2e7ab8; }
.bv-label-female,
.bv-label-2 { color: #c75a7b; }
.bv-label-3 { color: #4a7c47; }
.bv-label-4 { color: #b8860b; }
.bv-label-5 { color: #5e4d6b; }

.bv-total {
  text-align: center;
  font-size: 0.9rem;
  color: #888;
  margin: 0;
}

.bv-message {
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
}

.bv-message-error {
  color: #c00;
}

.bv-already-voted {
  text-align: center;
  color: #666;
  font-size: 0.95rem;
  margin: 0.5rem 0 0 0;
  line-height: 1.45;
}

.bv-already-voted__thanks {
  margin: 0 0 0.35rem;
  font-weight: 600;
  color: #444;
}

.bv-already-voted__label {
  margin: 0 0 0.2rem;
  font-size: 0.92em;
}

.bv-already-voted__team {
  margin: 0;
  font-size: 1.05em;
}

.bv-already-voted__choice {
  font-weight: 700;
}

.bv-error {
  color: #c00;
  padding: 1rem;
}

.bv-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive */
@media (min-width: 480px) {
  .bv-container {
    padding: 1.5rem;
  }
  .bv-card {
    padding: 2rem 1.75rem;
  }
  .bv-title {
    font-size: 1.75rem;
  }
  .bv-countdown-item {
    min-width: 4.5rem;
    max-width: 5.5rem;
    padding: 0.75rem 0.5rem;
  }
  .bv-countdown-number {
    font-size: 1.75rem;
  }
  .bv-countdown-label {
    font-size: 0.75rem;
  }
  .bv-tshirt-svg {
    max-width: 320px;
  }
  .bv-results-bar {
    height: 96px;
  }
}
