/* =========================================================
   工程繁忙提示
   - 桌機 (≥901px)：頂部 sticky 橫條，push nav 與 body 下移
   - 手機 (≤900px)：右下浮卡（避開既有 .float-btns 直行區）
   - localStorage：關閉後 7 天內不重複出現
   - 尊重 prefers-reduced-motion
   ========================================================= */

/* 預設藏起 — JS 確認 localStorage 後才打開 */
.notice-bar, .notice-float { display: none; }

/* ===== 桌機橫條（≥901px） ===== */
/* --notice-h 由 JS 在橫條渲染後動態量測寫入（中/英文長度差異會影響高度） */
@media (min-width: 901px) {
  html[data-notice-show="on"] .notice-bar { display: flex; }
  html[data-notice-show="on"] body       { padding-top: var(--notice-h, 44px); }
  html[data-notice-show="on"] #nav       { top: var(--notice-h, 44px); transition: top .35s; }
  html[data-notice-show="on"] .nav-drawer{ top: 0; }    /* drawer 仍從畫面頂端起 */
}

.notice-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  min-height: 44px;
  z-index: 101;                /* 比 #nav 的 100 高 */
  background: linear-gradient(90deg, #d84315 0%, #ff7a18 100%);
  color: #fff;
  padding: 8px 56px 8px 24px;
  font-size: 13.5px;
  font-weight: 600;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;             /* 英文較長時自動換行 */
  gap: 10px 14px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(216, 67, 21, .35);
  animation: noticeBarSlide .5s cubic-bezier(.2,.7,.2,1);
}
@keyframes noticeBarSlide {
  from { transform: translateY(-100%); }
  to   { transform: translateY(0); }
}
.notice-bar .pulse {
  width: 9px; height: 9px;
  background: #fff;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.notice-bar .pulse::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: noticePulse 1.5s ease-out infinite;
}
@keyframes noticePulse {
  0%   { transform: scale(.5); opacity: 1; }
  100% { transform: scale(2.4); opacity: 0; }
}
.notice-bar .text { line-height: 1.4; }
.notice-bar .text strong { font-weight: 800; }
.notice-bar .line-btn {
  background: #06c755;
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .25s;
  white-space: nowrap;
}
.notice-bar .line-btn:hover {
  background: #04a043;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(6,199,85,.4);
}
.notice-bar .close {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,.2);
  border: 0;
  color: #fff;
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  padding: 0;
  line-height: 1;
  transition: background .2s;
  font-family: inherit;
}
.notice-bar .close:hover { background: rgba(255,255,255,.35); }

/* ===== 手機浮卡（≤900px） ===== */
@media (max-width: 900px) {
  html[data-notice-show="on"] .notice-float { display: block; }
}

.notice-float {
  position: fixed;
  bottom: 14px;
  left: 14px;
  right: 70px;                  /* 留 56px + 14px buffer 給既有 .float-btns 直行區 */
  max-width: 360px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0,0,0,.3);
  overflow: hidden;
  z-index: 98;                  /* 比 .float-btns 的 99 低一點，避免覆蓋它 */
  opacity: 0;
  transform: translateY(20px);
  animation: noticeFloatIn .6s cubic-bezier(.2,1.4,.4,1) .8s forwards;
}
@keyframes noticeFloatIn {
  to { opacity: 1; transform: translateY(0); }
}
.notice-float-header {
  background: linear-gradient(135deg, #d84315, #ff7a18);
  color: #fff;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 13.5px;
}
.notice-float-header .pulse-dot {
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.notice-float-header .pulse-dot::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #fff;
  animation: noticePulse 1.5s ease-out infinite;
}
.notice-float-header .close-x {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
  opacity: .85;
  padding: 0;
  width: 24px;
  height: 24px;
  font-weight: 700;
  line-height: 1;
  font-family: inherit;
}
.notice-float-body {
  padding: 14px 16px 4px;
  color: #1a1a1a;
  font-size: 13px;
  line-height: 1.65;
}
.notice-float-body strong { color: #d84315; }
.notice-float-cta {
  padding: 4px 14px 14px;
}
.notice-float-cta a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: #06c755;
  color: #fff;
  padding: 11px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 13.5px;
  text-decoration: none;
  transition: all .25s;
}
.notice-float-cta a:active {
  background: #04a043;
  transform: scale(.98);
}
.notice-float-cta .icon-line {
  width: 18px; height: 18px;
  background: #fff;
  color: #06c755;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 10px;
}

/* 極窄手機 (≤520) — 為較小螢幕保留可讀性 */
@media (max-width: 520px) {
  .notice-float {
    bottom: 12px;
    left: 12px;
    right: 64px;
  }
  .notice-float-header { font-size: 13px; padding: 10px 12px; }
  .notice-float-body   { font-size: 12.5px; padding: 12px 14px 4px; }
  .notice-float-cta    { padding: 4px 12px 12px; }
  .notice-float-cta a  { padding: 10px; font-size: 13px; }
}

/* 尊重 reduced-motion */
@media (prefers-reduced-motion: reduce) {
  .notice-bar,
  .notice-float,
  .notice-bar .pulse::before,
  .notice-float-header .pulse-dot::before {
    animation: none !important;
  }
  .notice-float {
    opacity: 1;
    transform: none;
  }
}
