/* static/css/a30.css  — revised (with lowered top offset) */

/* ======= 直接隱藏 分享券 Tab 與內容（避免影響右上角 X） ======= */
.a30-tab-btn[data-tab="coupon"] { display: none !important; }
#tab-coupon { display: none !important; }

/* ======= a30 背景遮罩 & 動畫 ======= */
.a30-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  /* 改為從上方開始排，並留出頂部空間避免覆蓋到其他文字 */
  align-items: flex-start;
  justify-content: center;
  /* 讓內容與左右邊緣保持距離（含 iOS 安全區域） */
  padding-left: calc(env(safe-area-inset-left) + 12px);
  padding-right: calc(env(safe-area-inset-right) + 12px);
  /* 整體下移距離（可調整，例如 64px/72px/88px） */
  padding-top: calc(env(safe-area-inset-top) + 120px);
  padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
  animation: a30-fadeIn 0.4s ease-out both;
}
.a30-modal.open {
  display: flex;
}
@keyframes a30-fadeIn {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.8); }
}

/* ======= a30 卡片內容 & 科幻裝飾 ======= */
.a30-modal .a30-modal-content {
  position: relative;
  box-sizing: border-box;
  /* 重要：改為響應式寬度並把 padding 算在寬度內，確保左右留白 */
  width: min(420px, calc(100vw - 24px));
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 24px) clamp(16px, 4vw, 32px);
  background: rgba(20, 20, 40, 0.95);
  border: 2px solid transparent;
  border-image: linear-gradient(135deg, #00ffff, #ff00ff, #00ffff) 1;
  border-radius: 12px;
  box-shadow:
    0 0 12px rgba(0,255,255,0.5),
    0 0 24px rgba(255,0,255,0.3),
    inset 0 0 8px rgba(0,255,255,0.2);
  overflow: hidden;
  font-family: 'Orbitron', sans-serif;
  animation: a30-pulse 3s ease-in-out infinite alternate;
}
@keyframes a30-pulse {
  from {
    box-shadow:
      0 0 12px rgba(0,255,255,0.4),
      0 0 24px rgba(255,0,255,0.2);
  }
  to {
    box-shadow:
      0 0 24px rgba(0,255,255,0.8),
      0 0 48px rgba(255,0,255,0.6),
      inset 0 0 12px rgba(0,255,255,0.3);
  }
}
/* 科幻網格疊層 */
.a30-modal .a30-modal-content::before {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px) 0 0,
    linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px) 0 0;
  background-size: 20px 20px;
  mix-blend-mode: overlay;
}

/* ======= 在窄螢幕再收一點 ======= */
@media (max-width: 360px) {
  .a30-modal .a30-modal-content {
    width: calc(100vw - 24px);
    padding: 16px;
  }
}

/* ======= a30 專屬標題 ======= */
.a30-modal-title {
  margin: 0 0 16px;
  font-size: 1.3rem;
  color: #0ff;
  text-shadow:
    0 0 8px  #0ff,
    0 0 16px #f0f,
    0 0 24px #0ff;
  letter-spacing: 0.5px;
  text-align: center;
  animation: a30-titleGlow 1.5s ease-in-out infinite alternate;
}
@keyframes a30-titleGlow {
  from {
    text-shadow:
      0 0 6px  #0ff,
      0 0 12px #f0f;
  }
  to {
    text-shadow:
      0 0 12px #0ff,
      0 0 24px #f0f;
  }
}

/* ======= a30 關閉按鈕 ======= */
.a30-close {
  position: absolute;
  top: 12px; right: 12px;
  font-size: 24px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
}
.a30-close:hover {
  color: #fff;
  transform: rotate(90deg);
}

/* ======= Tab 按鈕群 ======= */
.a30-tabs {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 16px;
}
.a30-tab-btn {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: none;
  font-family: 'Orbitron', sans-serif;
  color: #ccc;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
}
.a30-tab-btn:hover {
  color: #fff;
}
.a30-tab-btn.active {
  color: #0ff;
  font-weight: bold;
}
.a30-tab-btn.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 20%;
  width: 60%;
  height: 3px;
  background: linear-gradient(135deg, #00ffff, #ff00ff);
  border-radius: 2px;
}

/* ======= a30 券數字 ======= */
#a30-ticket-count,
#a30-coupon-count {
  color: #08f;
  font-weight: bold;
  text-shadow: 0 0 8px #08f;
}

/* ======= a30 列表 & 卡片（內獨立滾動） ======= */
#a30-ticket-list,
#a30-coupon-list {
  max-height: calc(80vh - 200px);
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* 列表項目：左右欄位排版（改用 gap + order 交換位置） */
#a30-ticket-list li,
#a30-coupon-list li {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;   /* 不再用 space-between */
  gap: 10px;                     /* 控制左中距離 */
  padding: 10px 14px;
  margin: 8px 0;
  background: rgba(20, 20, 50, 0.8);
  border-left: 4px solid #08f;
  border-radius: 6px;
  font-family: monospace;
  color: #ddd;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: background 0.2s;
  min-width: 0;                  /* 允許子項收縮 */
}

/* 左：日期/時間（固定兩行且不換行） */
#a30-ticket-list li .ticket-info,
#a30-coupon-list li .ticket-info {
  order: 0;                      /* 放到最左 */
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 0 0 auto;
  min-width: 10ch;               /* 夠放 2025-08-27 */
}
#a30-ticket-list li .ticket-date,
#a30-coupon-list li .ticket-date {
  font-weight: bold;
  font-size: 0.9em;
  color: #0ff;
  text-shadow: 0 0 4px rgba(0,255,255,0.6);
  margin-bottom: 2px;
  white-space: nowrap;           /* 不拆行 */
}
#a30-ticket-list li .ticket-time,
#a30-coupon-list li .ticket-time {
  font-size: 0.8em;
  color: #ffe;
  text-shadow:
    0 0 4px  rgba(255,255,255,0.8),
    0 0 8px  rgba(255,50,150,0.6),
    0 0 12px rgba(255,50,150,0.4),
    0 0 16px rgba(255,200,200,0.3);
  white-space: nowrap;           /* 不拆行 */
}

/* 中：系列/回合（可收縮，避免擠到右側號碼） */
#a30-ticket-list li .ticket-series,
#a30-coupon-list li .ticket-series {
  order: 1;                      /* 放中間 */
  flex: 1 1 0;
  min-width: 0;
  line-height: 1.25;
  overflow: hidden;
}

/* 右：獎券/分享券號碼（No. 與數字零間距，固定靠右） */
#a30-ticket-list li .ticket-code,
#a30-coupon-list li .ticket-code {
  order: 2;
  margin-left: auto !important;  /* 靠最右 */
  padding-left: 0 !important;    /* No. 與數字緊貼 */
  white-space: nowrap;
  /* 初始大小，會被下方 override */
  font-size: 1.1em;
  font-weight: bold;
  color: #f0f;
  text-shadow: 0 0 6px #f0f;
}

/* ======= 在獎券/分享券編號前顯示來自 data-label 的文字（支援多語） ======= */
#a30-ticket-list li .ticket-code::before,
#a30-coupon-list li .ticket-code::before {
  content: attr(data-label) !important;
  color: #0ff;
  text-shadow: 0 0 4px #0ff;
  font-size: 1em;
  margin-right: 0 !important;    /* No. 與數字零間距 */
  vertical-align: middle;
}

/* ======= 只放大「0003」不放大「號碼:」 ======= */
#a30-ticket-list li .ticket-code,
#a30-coupon-list li .ticket-code {
  font-size: 1.5em !important;
  font-weight: bold;
  color: #f0f !important;
  text-shadow: 0 0 8px #f0f !important;
  margin-left: auto !important;  /* 保持靠右 */
  padding-left: 0 !important;    /* 與上方一致 */
}

/* ======= 自訂滾動條 ======= */
#a30-ticket-list::-webkit-scrollbar,
#a30-coupon-list::-webkit-scrollbar {
  width: 6px;
}
#a30-ticket-list::-webkit-scrollbar-track,
#a30-coupon-list::-webkit-scrollbar-track {
  background: rgba(10,10,30,0.4);
  border-radius: 3px;
}
#a30-ticket-list::-webkit-scrollbar-thumb,
#a30-coupon-list::-webkit-scrollbar-thumb {
  background: rgba(0,255,255,0.5);
  border-radius: 3px;
  box-shadow: 0 0 4px #0ff;
}
#a30-ticket-list,
#a30-coupon-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(0,255,255,0.5) rgba(10,10,30,0.4);
}

/* ======= a30 錯誤訊息 ======= */
.a30-error-message {
  margin-top: 12px;
  font-size: 0.9rem;
  color: #f55;
  text-shadow: 0 0 4px rgba(255,0,0,0.6);
  text-align: center;
}

/* 小螢幕微調 */
@media (max-width: 420px){
  #a30-ticket-list li,
  #a30-coupon-list li{ gap: 8px; }
  #a30-ticket-list li .ticket-code,
  #a30-coupon-list li .ticket-code{ font-size: 1.35em !important; }
}
