/* ===== Core layout (giữ look cũ, tương thích class mới + cũ) ===== */
#scb-sticky-bar{
  position: fixed;
  z-index: 99999;
  left: 0;
  right: 0;

  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;

  /* Nền & màu chữ sẽ được set động qua inline style (PHP) */
  background-color: #111827;
  color: #fff;

  text-align: center;
  font: 600 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);

  /* Entry state (sẽ animate khi thêm .scb-enter) */
  transform: translateY(-100%);
  opacity: 0;

  /* chừa chỗ cho nút đóng ở bên phải */
  padding-right: 45px;
}

/* ===== Vị trí: hỗ trợ cả class MỚI và CŨ ===== */
/* TOP */
#scb-sticky-bar.scb-top,
#scb-sticky-bar.scb-position-top{
  top: 0;
}

/* BOTTOM */
#scb-sticky-bar.scb-bottom,
#scb-sticky-bar.scb-position-bottom{
  top: auto;
  bottom: 0;
}

/* Fixed important (cũ) & fixed (mới) */
#scb-sticky-bar.scb-fixed-important,
#scb-sticky-bar.scb-fixed{
  position: fixed !important;
  z-index: 99999 !important;
}

/* ===== Entry animation (thêm .scb-enter bằng JS) ===== */
#scb-sticky-bar.scb-enter.scb-top,
#scb-sticky-bar.scb-enter.scb-position-top{
  animation: scb-slide-in-top 0.4s ease-out forwards;
}

#scb-sticky-bar.scb-enter.scb-bottom,
#scb-sticky-bar.scb-enter.scb-position-bottom{
  animation: scb-slide-in-bottom 0.4s ease-out forwards;
}

@keyframes scb-slide-in-top {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

@keyframes scb-slide-in-bottom {
  from { transform: translateY(100%); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ===== Nội dung ===== */
#scb-sticky-bar .scb-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

#scb-sticky-bar a.scb-link,
#scb-sticky-bar .scb-text{
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}

#scb-sticky-bar a.scb-link:hover{
  text-decoration: underline;
}

#scb-sticky-bar .scb-countdown{
  font-weight: 700;
  white-space: nowrap;
  min-width: 70px;
  text-align: center;
}

/* ===== Flip mỗi lần đổi số (Nhóm 1) ===== */
#scb-sticky-bar .scb-countdown.scb-flip-tick{
  animation: scbFlip .6s ease;
}
@keyframes scbFlip {
  0%   { transform: rotateX(0)   scale(1);    text-shadow: none; }
  40%  { transform: rotateX(-45deg) scale(1.05); text-shadow: 0 6px 10px rgba(0,0,0,.25); }
  100% { transform: rotateX(0)   scale(1);    text-shadow: none; }
}

/* ===== Urgency bounce khi còn <60 phút (JS thêm .scb-urgency) ===== */
#scb-sticky-bar.scb-urgency{
  animation: scbBounce 1s infinite;
}
@keyframes scbBounce {
  0%,100% { transform: translateY(0); }
  50%     { transform: translateY(4px); }
}

/* ===== Nút đóng ===== */
#scb-sticky-bar .scb-close-btn{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  margin: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}
#scb-sticky-bar .scb-close-btn:hover{
  opacity: 1;
}

/* ===== Spacer (dùng khi TOP + fixed để đẩy nội dung xuống) ===== */
#scb-spacer{
  height: 44px;
  width: 100%;
}

/* Nếu đang ở bottom thì không cần spacer */
#scb-sticky-bar.scb-bottom ~ #scb-spacer,
#scb-sticky-bar.scb-position-bottom ~ #scb-spacer{
  display: none;
}

/* ===== Responsive ===== */
/* Tablet: 481px - 768px */
@media (max-width: 768px) {
  #scb-sticky-bar {
    font-size: 13px;
    gap: 0.5rem;
    padding-right: 40px;
  }
  #scb-sticky-bar .scb-content { gap: 0.5rem; }
  #scb-sticky-bar .scb-countdown { min-width: 65px; }
  #scb-sticky-bar .scb-close-btn {
    font-size: 20px; width: 28px; height: 28px; right: 6px;
  }
  #scb-spacer { height: 55px; }
}

/* Mobile: <= 480px */
@media (max-width: 480px) {
  #scb-sticky-bar {
    font-size: 12px;
    gap: 0.4rem;
    padding-right: 35px;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
  }
  #scb-sticky-bar .scb-content {
    gap: 0.4rem;
    justify-content: center;
    order: 1;
  }
  #scb-sticky-bar .scb-countdown {
    order: 2;
    min-width: auto;
  }
  #scb-sticky-bar .scb-close-btn {
    position: absolute;
    font-size: 18px;
    width: 24px;
    height: 24px;
    right: 5px;
    top: 5px;
    transform: none; /* để nút cố định góc trên phải trên mobile */
  }
  #scb-spacer { height: 70px; }
}
