/* ====== 這是 style.css 檔案 ====== */

:root {
  /* 核心顏色 */
  --color-bg: #f5f5f7;
  --color-card: #ffffff;
  --color-text-main: #1d1d1f;
  --color-text-muted: #86868b;
  --color-accent: #ff6b00;
  --color-trust-blue: #0066cc;
  --color-trust-blue-bg: #f0f4f8;

  /* 文字大小 */
  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-h1: 24px;

  /* 邊距與圓角 */
  --radius-lg: 24px;
  --radius-btn: 20px;
  --motion-fast: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* 基礎重設 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  min-height: 100vh;
  width: 100vw;
  font-family: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
  background: linear-gradient(135deg, var(--color-bg) 0%, #eef1f5 100%);
  color: var(--color-text-main);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: auto;
}

/* 儀表板佈局 */
.dashboard {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px 32px 16px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: opacity var(--motion-fast);
}

.brand-group:hover {
  opacity: 0.8;
}

header h1 {
  font-size: var(--text-h1);
  font-weight: 900;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--color-text-main) 0%, #4a4a4c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.3); }
  70% { box-shadow: 0 0 0 6px rgba(0, 102, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 102, 204, 0); }
}

.status-badge {
  font-size: 13px;
  color: var(--color-trust-blue);
  background-color: var(--color-trust-blue-bg);
  padding: 6px 14px;
  border-radius: 100px;
  font-weight: 700;
  letter-spacing: 0.05em;
  animation: pulse-blue 2s infinite; 
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.widget {
  background-color: var(--color-card);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  transition: transform var(--motion-fast), box-shadow var(--motion-fast);
}

.widget:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
}

.widget-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.widget-title {
  font-size: var(--text-lg);
  font-weight: 800;
}

.widget-icon {
  width: 22px;
  height: 22px;
  color: var(--color-trust-blue);
}

.widget-details {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke-width='3' stroke='%230066cc' class='w-6 h-6'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9'/%3E%3C/svg%3E");
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

select {
  width: 100%;
  appearance: none;
  background-color: var(--color-trust-blue-bg);
  border: none;
  color: var(--color-trust-blue);
  padding: 18px 24px;
  border-radius: 16px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background-color var(--motion-fast);
}

select:focus, select:hover {
  background-color: #e2ebf5;
}

.img-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-btn);
  text-decoration: none;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  min-height: 140px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  transition: var(--motion-fast);
  transform: translateZ(0);
}

.img-card:active {
  transform: scale(0.96);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.img-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-size: cover;
  background-position: center;
  z-index: 1;
  transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.img-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.3) 60%, rgba(0, 0, 0, 0.05) 100%);
  z-index: 2;
}

.img-card:hover::before {
  transform: scale(1.08);
}

.img-card-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.img-card-title {
  font-size: var(--text-base);
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.6);
}

.img-card-subtitle {
  font-size: 13px;
  font-weight: 600;
  color: #ffeb3b;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

.bg-quiz::before { background-image: url('quiz.jpg'); background-color:#8e8e93; }
.bg-timeline::before { background-image: url('timeline.jpg'); background-color:#8e8e93; }
.bg-youtube::before { background-image: url('youtube.jpg'); background-color:#8e8e93; }
.bg-strategy::before { background-image: url('strategy.jpg'); background-color:#8e8e93; }
.bg-10s::before { background-image: url('survival.jpg'); background-color:#8e8e93; }

.bento-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  flex: 1;
}

.bento-item {
  min-height: 120px;
  border-radius: var(--radius-btn);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  color: white;
  transition: var(--motion-fast);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
}

.bento-item:active {
  transform: scale(0.95);
}

.bento-icon {
  font-size: 28px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  margin-bottom: 8px;
}

.bento-full {
  grid-column: span 2;
  min-height: 160px;
  justify-content: flex-end;
}

.bento-full .bento-icon {
  position: absolute;
  top: 16px;
  left: 16px;
}

/* ===== 全新頁籤與短影音區塊樣式 ===== */
.shorts-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 12px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}

.shorts-tabs::-webkit-scrollbar {
  display: none; 
}

.tab-btn {
  flex: 0 0 auto;
  padding: 10px 18px;
  border-radius: 24px;
  background-color: var(--color-trust-blue-bg);
  color: var(--color-text-muted);
  border: 2px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--motion-fast);
  scroll-snap-align: start;
}

.tab-btn.active {
  background-color: var(--color-trust-blue);
  color: white;
  box-shadow: 0 4px 10px rgba(0, 102, 204, 0.3);
}

.shorts-tab-content {
  display: none;
}

.shorts-tab-content.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.shorts-row {
  display: flex;
  overflow-x: auto;
  gap: 12px;
  padding-bottom: 12px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.shorts-row::-webkit-scrollbar {
  height: 4px;
}
.shorts-row::-webkit-scrollbar-track {
  background: transparent;
}
.shorts-row::-webkit-scrollbar-thumb {
  background: #e5e5ea;
  border-radius: 4px;
}

.short-card {
  flex: 0 0 120px; 
  height: 190px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 12px;
  text-decoration: none;
  color: white;
  scroll-snap-align: start;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  transition: transform var(--motion-fast);
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-color: #333; 
}

.short-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.2) 50%, rgba(0,0,0,0.4) 100%);
  z-index: 1;
}

.short-card:hover, .short-card:active {
  transform: translateY(-4px) scale(0.98);
}

.short-card > * {
  z-index: 2;
}

.short-play-icon {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 24px;
  height: 24px;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

.short-title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

footer {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-nav {
  display: flex;
  gap: 20px;
}

.footer-nav button {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  padding: 6px;
  transition: color var(--motion-fast);
}

.footer-nav button:hover {
  color: var(--color-trust-blue);
}

.footer-copyright {
  font-size: var(--text-xs);
  color: #a1a1a6;
  text-align: center;
}

.footer-copyright a {
  color: #a1a1a6;
  text-decoration: none;
  font-weight: 600;
  transition: color var(--motion-fast);
}

.footer-copyright a:hover {
  color: var(--color-text-muted);
}

.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
  z-index: 1000;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-content {
  background: var(--color-card); width: 100%; max-width: 600px; max-height: 80vh;
  border-radius: 32px 32px 0 0; padding: 24px 24px 40px 24px;
  transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
}
.modal-overlay.active .modal-content { transform: translateY(0); }
.modal-drag-handle { width: 40px; height: 5px; background: #e5e5ea; border-radius: 10px; margin: 0 auto 20px auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-title { font-size: 20px; font-weight: 800; color: var(--color-text-main); }
.modal-close {
  background: var(--color-bg); border: none; width: 32px; height: 32px;
  border-radius: 16px; font-size: 16px; font-weight: bold; color: var(--color-text-muted); cursor: pointer; transition: var(--motion-fast);
}
.modal-close:hover { background: #e2ebf5; color: var(--color-trust-blue); }
.modal-body { overflow-y: auto; font-size: var(--text-base); color: var(--color-text-muted); line-height: 1.7; }
.modal-body p { margin-bottom: 16px; }

.news-ticker {
  background-color: var(--color-card);
  border-radius: 16px;
  padding: 12px 16px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.news-ticker-badge {
  background-color: var(--color-accent);
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.news-ticker-content {
  flex: 1;
  overflow: hidden; 
}

#news-link {
  display: block;
  color: var(--color-text-main);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis; 
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#news-link.fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* 支援動態注入外部背景圖，並保留原本的放大特效 */
.dynamic-bg::before { 
  background-image: var(--dynamic-bg); 
  background-color: #8e8e93; 
}

/* 卡片切換時的淡出動畫 */
.bento-fade-out {
  opacity: 0;
  transform: scale(0.98);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
