/* ============================================
   JUPAS 排位頁面樣式
   ============================================ */

.page-jupas-ranking {
  background: var(--bg-light);
  padding-bottom: 90px; /* 留出底部導航欄空間 */
  --app-max-width: 660px;
}

.bands-container {
  padding: 0 10px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.band-section {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.band-header {
  padding: 12px 16px;
  background: var(--bg-tint);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.band-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.band-subtitle {
  font-size: 0.85rem;
  color: var(--text-mid);
  font-weight: 600;
}

/* ============================================
   Band 顏色區分
   ============================================ */
.band-section-a { border-color: var(--primary); }
.band-section-a .band-header { background: var(--primary); border-bottom-color: var(--primary-dark); }
.band-section-a .band-title { color: #ffffff; }
.band-section-a .band-subtitle { color: rgba(255, 255, 255, 0.85); }

.band-section-b { border-color: #10b981; }
.band-section-b .band-header { background: #10b981; border-bottom-color: #059669; }
.band-section-b .band-title { color: #ffffff; }
.band-section-b .band-subtitle { color: #d1fae5; }

.band-section-c { border-color: #f59e0b; }
.band-section-c .band-header { background: #f59e0b; border-bottom-color: #d97706; }
.band-section-c .band-title { color: #ffffff; }
.band-section-c .band-subtitle { color: #fef3c7; }

.band-section-d { border-color: #3b82f6; }
.band-section-d .band-header { background: #3b82f6; border-bottom-color: #2563eb; }
.band-section-d .band-title { color: #ffffff; }
.band-section-d .band-subtitle { color: #dbeafe; }

.band-section-e { border-color: #8b5cf6; }
.band-section-e .band-header { background: #8b5cf6; border-bottom-color: #7c3aed; }
.band-section-e .band-title { color: #ffffff; }
.band-section-e .band-subtitle { color: #ede9fe; }

.band-slots {
  display: flex;
  flex-direction: column;
  min-height: 50px;
}

.choice-slot {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border);
  background: #fff;
  transition: background 0.2s;
}

.choice-slot:last-child {
  border-bottom: none;
}

.choice-slot.sortable-ghost {
  opacity: 1 !important;
  background: var(--bg-tint) !important;
  border: 2px dashed var(--primary) !important;
  color: transparent !important;
}

.choice-slot.sortable-ghost * {
  visibility: hidden;
}

.choice-slot.sortable-chosen {
  background: #f8fafc;
}

.choice-slot.sortable-drag {
  background: #ffffff !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
  opacity: 1 !important;
  z-index: 9999 !important;
  cursor: grabbing !important;
}

.choice-number {
  width: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--text-light);
  background: var(--bg-light);
  border-right: 1px solid var(--border);
  font-size: 0.8rem;
  flex-shrink: 0;
}

.choice-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  min-height: 56px;
}

.choice-main-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  width: 100%;
}

.choice-expanded-info {
  display: none;
  flex-direction: column;
  padding: 0 16px 16px 16px;
  width: 100%;
  animation: fadeIn 0.2s ease-out;
  cursor: pointer;
}

.choice-expanded-info .prog-code-tag:nth-child(2) {
  display: none;
}

.choice-content.is-expanded .choice-expanded-info {
  display: flex;
}

.choice-content.empty {
  color: var(--text-light);
  align-items: center;
  justify-content: center;
  border: 1px dashed transparent;
  padding: 12px 16px;
}

.choice-content.empty .fa-plus {
  font-size: 1.25rem;
}

.choice-content.empty:hover {
  background: var(--bg-tint);
}

.choice-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.choice-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.expand-icon {
  font-size: 0.75rem;
  color: var(--text-light);
  transition: transform 0.2s ease;
  margin-left: 4px;
}

.choice-code {
  font-size: 0.75rem;
  font-weight: 800;
  background: var(--bg-tint);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-mid);
}

.choice-uni {
  font-size: 0.75rem;
  color: var(--text-light);
  display: flex;
  align-items: center;
  gap: 4px;
}

.choice-uni img {
  width: 14px;
  height: 14px;
}

.choice-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
}

.choice-mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.choice-mini-tag {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  line-height: 1.2;
}

.choice-mini-tag.score-tag {
  background: var(--bg-tint);
  color: var(--text-mid);
  border: 1px solid var(--border);
}

.choice-mini-tag.prob-tag {
  border: 1px solid;
}
.choice-mini-tag.prob-tag.pred-safe {
  color: #00b86a;
  background: #f2faf4;
  border-color: #d1e7d7;
}
.choice-mini-tag.prob-tag.pred-match {
  color: #cc8e07;
  background: #fffbeb;
  border-color: #fde68a;
}
.choice-mini-tag.prob-tag.pred-reach {
  color: #e03555;
  background: #fff1f2;
  border-color: #fecdd3;
}

.choice-mini-tag.quota-tag {
  background: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.choice-mini-tag.interview-tag {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.choice-mini-tag.highlight-tag {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.choice-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.drag-handle {
  color: var(--text-light);
  cursor: grab;
  padding: 8px;
  font-size: 1rem;
  min-width: 32px;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drag-handle:active {
  cursor: grabbing;
}

.remove-btn, .replace-btn {
  background: none;
  border: none;
  color: var(--text-light);
  padding: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: 50%;
  transition: all 0.2s;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  color: #ef4444;
  background: #fee2e2;
}

.replace-btn:hover {
  color: var(--primary);
  background: var(--primary-light-bg, #e0e7ff);
}

/* Ranking Score Container (Overrides for prog-corner) */
.ranking-score-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ranking-score-container .prog-corner {
  position: static;
  text-align: left;
  align-items: flex-start;
  background: var(--bg-light);
  padding: 12px;
  border-radius: 8px;
}

.ranking-score-container .prog-corner-placeholder-text {
  max-width: none;
  text-align: left;
}

.ranking-score-container .prog-corner-metrics {
  justify-content: flex-start;
}

.ranking-score-container .prog-scores-wrap {
  margin-top: 0;
}

.choice-expanded-info .prog-tag-row {
  margin-bottom: 12px;
}

.view-detail-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-tint);
  color: var(--primary);
  padding: 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.2s;
}

.view-detail-btn:hover {
  background: var(--primary);
  color: #fff;
}

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

/* 搜索 Modal */
.search-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  backdrop-filter: blur(4px);
}

.search-modal-overlay[hidden] {
  display: none !important;
}

.search-modal {
  background: #fff;
  width: 100%;
  max-width: var(--app-max-width);
  margin: 0 auto;
  height: 85vh;
  border-radius: 20px 20px 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.1);
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

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

.search-modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-dark);
}

.close-modal-btn {
  background: var(--bg-light);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  cursor: pointer;
}

.search-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-box {
  margin: 16px 20px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 16px;
  color: var(--text-light);
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-light);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s;
}

.search-box input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.search-tabs {
  display: flex;
  overflow-x: auto;
  gap: 8px;
  padding: 0 20px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none; /* Firefox */
}

.search-tabs::-webkit-scrollbar {
  display: none; /* Safari and Chrome */
}

.search-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-light);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.search-tab i {
  font-size: 0.75rem;
}

.search-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.search-results {
  flex: 1;
  overflow-y: auto;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.search-result-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-dark);
}

.search-result-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-light);
}

.search-result-meta .code {
  font-weight: 800;
  color: var(--primary);
}

.add-btn {
  background: var(--primary-light);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-light);
}

.no-results i {
  font-size: 2rem;
  margin-bottom: 12px;
  color: var(--border);
}

/* ============================================
   导出按钮（右上角）
   ============================================ */
.page-jupas-ranking .favorites-hero--with-export {
  padding-right: 16px;
}

.page-jupas-ranking .favorites-hero--with-export .favorites-hero-title,
.page-jupas-ranking .favorites-hero--with-export .favorites-hero-sub {
  padding-right: 48px; /* 减小右侧 padding，因为只有 icon */
}

.page-jupas-ranking .export-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 1;
  margin: 0;
  background: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: all 0.2s;
}

.page-jupas-ranking .export-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.page-jupas-ranking .export-btn:disabled {
  opacity: 0.85;
  cursor: wait;
  transform: none;
}

/* ============================================
   展開所有開關
   ============================================ */
.expand-all-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 16px 12px;
  gap: 8px;
}

.expand-all-label {
  font-size: 0.85rem;
  color: var(--text-mid);
  font-weight: 600;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 22px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(18px);
}

/* ============================================
   导出图片时的专属样式 (设计感美化)
   ============================================ */
.bands-container.exporting {
  position: relative;
  padding: 40px 15px;
  background: #eaf0f8;
  border-radius: 24px;
  margin: 0;
}

/* 导出时的专属标题 */
.export-header {
  text-align: center;
  margin-bottom: 12px;
}

.export-footer {
  text-align: center;
  margin-top: 30px;
  padding-top: 8px;
}

.export-footer .logo-text {
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
}

.export-footer .logo-jupas {
  color: #0f172a;
  font-weight: 900;
}

.export-footer .logo-u {
  color: var(--primary, #4f46e5);
}

.export-footer .logo-artifact {
  color: #0f172a;
  margin-left: 2px;
}

.export-header h2 {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--text-dark, #0f172a);
  margin: 0 0 8px 0;
}

.export-header p {
  font-size: 0.9rem;
  color: var(--text-mid, #64748b);
  margin: 0;
  font-weight: 600;
}

/* 隐藏不需要的 UI 元素（拖拽手柄、删除按钮） */
.bands-container.exporting .drag-handle,
.bands-container.exporting .remove-btn,
.bands-container.exporting .replace-btn,
.bands-container.exporting .expand-icon,
.bands-container.exporting .view-detail-btn {
  display: none !important;
}

/* 让卡片在导出时显得更干净、没有边框感 */
.bands-container.exporting .band-section {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.05);
  border: none;
}

/* 導出圖片 Modal */
.export-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(4px);
}

.export-modal-overlay[hidden] {
  display: none !important;
}

.export-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 3010;
  transition: background 0.2s;
}

.export-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.export-image-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 60px 20px 100px 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.export-image-scroll img {
  width: 100%;
  max-width: 600px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  display: block;
}

.export-bottom-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 30px 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8) 60%);
  display: flex;
  justify-content: center;
  z-index: 3010;
  pointer-events: none;
}

.download-img-btn {
  pointer-events: auto;
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 100px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  transition: all 0.2s;
}

.download-img-btn:hover {
  opacity: 0.9;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

