/* ==========================================================================
   藍伯特的資料取件系統 (lambertweb) - 無印米白紙風樣式表
   風格核心：無印良品簡約風、暖調和紙質感、純粹克制、金色對稱點綴、手機優先
   ========================================================================== */

:root {
  /* 和紙與米白色彩基調 */
  --bg-paper: #FAF8F5;
  --bg-card: #FFFFFF;
  --bg-subtle: #F3EFEA;
  --bg-accent: #EFE9DF;

  /* 文字與墨韻 */
  --text-primary: #2C2723;
  --text-secondary: #6B635A;
  --text-muted: #9E9589;
  --text-light: #C2BAAF;

  /* 邊框與分割線 */
  --border-light: #EBE5DB;
  --border-medium: #DDD5C7;
  --border-dark: #C2B8A3;

  /* 金色系（對稱按鈕與高光裝飾） */
  --gold-primary: #B8860B;
  --gold-light: #E6CA85;
  --gold-pale: #F8F2E2;
  --gold-dark: #8F6908;
  --gold-gradient: linear-gradient(135deg, #E2C47E 0%, #B8860B 50%, #D4AF37 100%);
  --gold-btn-bg: linear-gradient(180deg, #FFFDF9 0%, #F8F1DE 50%, #EEDBB1 100%);

  /* 印章紅（無印雅致點綴） */
  --stamp-red: #A93226;
  --stamp-bg: rgba(169, 50, 38, 0.08);

  /* 陰影與圓角 */
  --shadow-sm: 0 2px 8px rgba(44, 39, 35, 0.04);
  --shadow-md: 0 4px 20px rgba(44, 39, 35, 0.07);
  --shadow-lg: 0 10px 35px rgba(44, 39, 35, 0.12);
  --shadow-gold: 0 6px 25px rgba(184, 134, 11, 0.28);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;

  /* 字體堆疊 */
  --font-serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Courier New", monospace;
}

/* 全域重設與紙質背景紋理 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 17px;
  scroll-behavior: smooth;
  background-color: var(--bg-paper);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-paper);
  color: var(--text-primary);
  line-height: 1.65;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  background-image: 
    radial-gradient(#E8E1D5 0.75px, transparent 0.75px),
    radial-gradient(#E8E1D5 0.75px, var(--bg-paper) 0.75px);
  background-size: 30px 30px;
  background-position: 0 0, 15px 15px;
}

/* 頂部和紙纖維裝飾條 */
.paper-strip {
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, #D4AF37 0%, #C2B8A3 50%, #B8860B 100%);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* 容器佈局 - 手機優先與大螢幕適配 */
.app-container {
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 80px 20px;
  flex: 1;
}

/* 導航頂欄 */
.nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 24px 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 28px;
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
}

.seal-stamp {
  width: 34px;
  height: 34px;
  border: 1.5px solid var(--gold-primary);
  color: #6B4B02;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  border-radius: 6px;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #FFFDF8 0%, #F7EBCB 50%, #EBD59E 100%);
  box-shadow: 0 2px 8px rgba(184, 134, 11, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.9);
  transform: rotate(-2deg);
}

.brand-title-group {
  display: flex;
  flex-direction: column;
}

.brand-main {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

/* 狀態徽章 */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: #F2F8F2;
  border: 1px solid #D1E7D1;
  color: #2E7D32;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #2E7D32;
  box-shadow: 0 0 0 rgba(46, 125, 50, 0.4);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(46, 125, 50, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 125, 50, 0); }
}

/* ==========================================================================
   第一頁：歡迎與驗證首頁 (Landing View)
   ========================================================================== */
.welcome-hero {
  text-align: center;
  padding: 30px 10px 40px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.welcome-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold-gradient);
}

.hero-course-tag {
  display: inline-block;
  font-size: 15px;
  letter-spacing: 2px;
  color: var(--gold-dark);
  background: var(--gold-pale);
  border: 1px solid var(--gold-light);
  padding: 5px 16px;
  border-radius: var(--radius-pill);
  margin-bottom: 22px;
  font-weight: 500;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 6.5vw, 42px);
  font-weight: 600;
  color: #1F1B18;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
  line-height: 1.35;
}

.hero-subtitle {
  font-size: clamp(17px, 4.2vw, 22px);
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 26px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.75;
}

.hero-meta-box {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-meta-divider {
  color: var(--border-medium);
}

/* 核心元素：金色的對稱風格按鈕 */
.golden-button-wrapper {
  margin: 32px 0 20px 0;
  display: flex;
  justify-content: center;
  padding: 0 10px;
}

.btn-golden-symmetric {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 58px;
  padding: 0 32px;
  max-width: 440px;
  width: 100%;
  background: var(--gold-btn-bg);
  border: 1.5px solid var(--gold-light);
  border-radius: var(--radius-pill);
  box-shadow: 0 4px 15px rgba(184, 134, 11, 0.2), inset 0 1px 2px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  text-decoration: none;
  outline: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

/* 對稱左邊裝飾線與菱形 */
.btn-golden-symmetric .sym-left,
.btn-golden-symmetric .sym-right {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold-primary);
  font-size: 13px;
  opacity: 0.85;
  transition: transform 0.25s ease;
}

.btn-golden-symmetric .sym-line {
  display: inline-block;
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-primary));
}

.btn-golden-symmetric .sym-right .sym-line {
  background: linear-gradient(90deg, var(--gold-primary), transparent);
}

.btn-golden-symmetric .btn-gold-text {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  color: #3D2D0F;
  letter-spacing: 2px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

/* 金色微光流動與互動 */
.btn-golden-symmetric::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 60%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.45),
    transparent
  );
  transform: rotate(30deg);
  transition: none;
  animation: goldShimmer 4s infinite ease-in-out;
}

@keyframes goldShimmer {
  0% { transform: translateX(0) rotate(30deg); }
  35%, 100% { transform: translateX(360%) rotate(30deg); }
}

.btn-golden-symmetric:hover {
  transform: translateY(-2px);
  border-color: #D4AF37;
  box-shadow: var(--shadow-gold), inset 0 1px 3px rgba(255, 255, 255, 1);
}

.btn-golden-symmetric:hover .sym-left {
  transform: translateX(-3px);
}

.btn-golden-symmetric:hover .sym-right {
  transform: translateX(3px);
}

.btn-golden-symmetric:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: 0 2px 10px rgba(184, 134, 11, 0.2);
}

.hero-hint {
  font-size: 14.5px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

/* 蘭伯特後台入口按鈕與樣式 */
.admin-portal-wrapper {
  margin-top: 24px;
  display: flex;
  justify-content: center;
}

.btn-admin-portal {
  background: transparent;
  border: 1px dashed var(--border-medium);
  color: var(--text-muted);
  font-size: 13.5px;
  padding: 6px 18px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-admin-portal:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--gold-primary);
}

.admin-text-link {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.admin-text-link:hover {
  color: var(--text-primary);
}

/* 後台管理面板樣式 */
.admin-dashboard-modal {
  background: var(--bg-card);
  width: 95%;
  max-width: 680px;
  max-height: 90vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.admin-section {
  background: var(--bg-paper);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 20px;
}

.admin-section-title {
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: #FFF;
  border: 1px solid var(--border-light);
  border-radius: 4px;
  margin-bottom: 8px;
  font-size: 14px;
  gap: 10px;
}

.btn-delete-file {
  color: var(--stamp-red);
  background: transparent;
  border: 1px solid rgba(169, 50, 38, 0.3);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-delete-file:hover {
  background: rgba(169, 50, 38, 0.08);
}

/* ==========================================================================
   驗證密碼彈窗 (Passcode Modal) - 支援數字鍵盤與手機單手輸入
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 39, 35, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.passcode-modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 420px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  padding: 28px 24px;
  text-align: center;
  position: relative;
  transform: translateY(20px) scale(0.96);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .passcode-modal {
  transform: translateY(0) scale(1);
}

.modal-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 20px;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-weight: 600;
}

.modal-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

/* 8 位取件碼方格顯示 */
.pin-slots-container {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.pin-slot {
  width: 38px;
  height: 48px;
  border: 1.5px solid var(--border-medium);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.18s ease;
}

.pin-slot.filled {
  border-color: var(--gold-primary);
  background: var(--bg-card);
  color: #8C6826;
  box-shadow: 0 0 0 2px rgba(184, 134, 11, 0.15);
}

.pin-slot.active {
  border-color: var(--gold-light);
  transform: scale(1.05);
}

/* 實體隱藏輸入框 (方便手機自動彈出原生鍵盤或電腦直接按鍵) */
.real-pin-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}

/* 錯誤提示與搖晃動畫 */
.pin-status-msg {
  min-height: 22px;
  font-size: 13px;
  color: var(--stamp-red);
  margin-bottom: 16px;
  transition: opacity 0.2s;
}

.shake-animation {
  animation: shake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(4px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
  40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* 手機觸控友善的極簡和紙數字鍵盤 (針對手機使用者單手輸入設計) */
.numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.num-key {
  height: 52px;
  border: 1px solid var(--border-light);
  background: var(--bg-paper);
  border-radius: var(--radius-md);
  font-size: 20px;
  font-weight: 500;
  font-family: var(--font-mono);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.num-key:active {
  background: var(--bg-accent);
  transform: scale(0.96);
}

.num-key.action-key {
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-secondary);
}

.num-key.action-key:hover {
  background: var(--bg-subtle);
}

/* ==========================================================================
   第二頁：資料下載與資料庫專區 (Pickup Hub View)
   ========================================================================== */
.pickup-view {
  display: none;
  animation: fadeIn 0.4s ease;
}

.pickup-view.active {
  display: block;
}

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

/* 課堂專屬頂部資訊卡 */
.course-info-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--gold-primary);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
}

.course-info-left {
  flex: 1;
  min-width: 260px;
}

.course-title-pickup {
  font-family: var(--font-serif);
  font-size: 22px;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-weight: 600;
}

.course-desc-pickup {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.course-info-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.lecturer-stamp {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* Google NotebookLM 推薦工具卡片 */
.notebooklm-card {
  background: var(--bg-card);
  border: 1.5px solid #E6CA85;
  border-radius: var(--radius-md);
  padding: 22px 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 18px rgba(184, 134, 11, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
  overflow: hidden;
}

.notebooklm-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold-gradient);
}

.notebooklm-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.notebooklm-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, #FFFDF8, #F7EBCB);
  border: 1px solid var(--gold-light);
  color: #8C6826;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.notebooklm-title-group {
  flex: 1;
  min-width: 0;
}

.notebooklm-title {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.notebooklm-desc {
  font-size: 14.5px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-top: 6px;
}

.notebooklm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--border-light);
  flex-wrap: wrap;
}

.btn-notebooklm-web {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(180deg, #3C3631, #25211D);
  color: #FAF7F2;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-notebooklm-web:hover {
  background: #151311;
  transform: translateY(-1px);
}

.notebooklm-app-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-group-label {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.app-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-app-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-app-download:hover {
  background: #FFF;
  border-color: var(--gold-primary);
  color: #8C6826;
}

/* 搜尋與篩選工具列 */
.toolbar-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.search-input-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.2s ease;
}

.search-field:focus {
  border-color: var(--gold-primary);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.12);
}

/* 分類標籤滑動條 (手機滑動優化) */
.category-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

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

.tab-btn {
  white-space: nowrap;
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.tab-btn.active {
  background: #3A342D;
  border-color: #3A342D;
  color: #FAF7F2;
  font-weight: 500;
}

/* 資料庫清單網格 */
.items-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.item-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.item-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.file-type-icon {
  width: 44px;
  height: 48px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.file-type-icon::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  border-width: 0 8px 8px 0;
  border-style: solid;
  border-color: var(--bg-paper) var(--bg-paper) var(--border-medium) var(--border-medium);
}

.file-type-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-top: 2px;
}

.item-details {
  flex: 1;
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.item-title {
  font-family: var(--font-serif);
  font-size: 19.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
  word-break: break-word;
}

.item-tag {
  font-size: 12.5px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  display: inline-block;
}

.item-tag.primary {
  background: rgba(184, 134, 11, 0.12);
  color: #8C6826;
  border: 1px solid rgba(184, 134, 11, 0.25);
}

.item-tag.accent {
  background: #EAE6DF;
  color: #4A443D;
  border: 1px solid #D6D0C5;
}

.item-tag.success {
  background: #EBF3EB;
  color: #2F6F33;
  border: 1px solid #C4DFC5;
}

.item-tag.neutral {
  background: #F4EFEA;
  color: #7A7268;
}

.item-desc {
  font-size: 15.5px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-top: 8px;
}

.item-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13.5px;
  color: var(--text-muted);
}

/* 卡片操作動作列 */
.item-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-light);
  flex-wrap: wrap;
}

.btn-download-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: #332E29;
  color: #FAF7F2;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-download-primary:hover {
  background: #1B1815;
  transform: translateY(-1px);
}

.btn-download-primary:active {
  transform: translateY(0);
}

.btn-preview-subtle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 11px 18px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-preview-subtle:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-dark);
}

/* ==========================================================================
   預覽彈窗 (Preview Modal)
   ========================================================================== */
.preview-modal-dialog {
  background: var(--bg-card);
  width: 95%;
  max-width: 820px;
  height: 85vh;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-paper);
}

.preview-modal-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.preview-modal-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  background: #FFFFFF;
}

.preview-text-content {
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  color: #2D2823;
  padding: 14px;
  background: #FAF8F5;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.preview-iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ==========================================================================
   講師管理面板與未來擴充 (Course Management Drawer)
   ========================================================================== */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(44, 39, 35, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
}

.drawer-overlay.active {
  opacity: 1;
  visibility: visible;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  box-shadow: -5px 0 30px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  z-index: 1001;
}

.drawer-overlay.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
}

.drawer-content {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-control {
  padding: 10px 14px;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  background: var(--bg-subtle);
}

.form-control:focus {
  background: #FFF;
  border-color: var(--gold-primary);
}

/* 二維碼彈窗 (QR Code Modal) */
.qrcode-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

#qrcodeContainer {
  padding: 12px;
  background: #FFF;
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}

/* 頁尾品牌與備註 */
.footer-note {
  text-align: center;
  padding: 30px 0 20px 0;
  color: var(--text-muted);
  font-size: 12.5px;
  border-top: 1px solid var(--border-light);
  margin-top: 40px;
}

.footer-brand {
  font-family: var(--font-serif);
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 4px;
}

/* ==========================================================================
   手機端極致微調 (Mobile Media Queries)
   ========================================================================== */
@media (max-width: 640px) {
  .app-container {
    padding: 16px 14px 60px 14px;
  }

  .nav-header {
    padding-bottom: 16px;
    margin-bottom: 20px;
  }

  .welcome-hero {
    padding: 24px 14px 32px 14px;
  }

  .btn-golden-symmetric {
    padding: 0 18px;
    gap: 10px;
    min-height: 52px;
  }

  .btn-golden-symmetric .btn-gold-text {
    font-size: 15px;
    letter-spacing: 1px;
  }

  .btn-golden-symmetric .sym-line {
    width: 14px;
  }

  .pin-slots-container {
    gap: 5px;
  }

  .pin-slot {
    width: 32px;
    height: 44px;
    font-size: 17px;
  }

  .num-key {
    height: 48px;
    font-size: 18px;
  }

  .course-info-banner {
    padding: 16px;
  }

  .item-card {
    padding: 16px 14px;
  }

  .item-actions-row {
    justify-content: stretch;
  }

  .btn-download-primary, .btn-preview-subtle {
    flex: 1;
    justify-content: center;
  }

  .notebooklm-card {
    padding: 16px 14px;
  }

  .notebooklm-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .btn-notebooklm-web {
    justify-content: center;
    width: 100%;
  }

  .notebooklm-app-group {
    flex-direction: column;
    align-items: stretch;
  }

  .app-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 8px;
  }

  .btn-app-download {
    justify-content: center;
    width: 100%;
  }
}
