/* ============================================================
   拾序 SortStep · 統一模塊 Header 元件
   用法：
   <header class="ss-header">
     <div class="ss-logo" aria-hidden="true">拾</div>
     <div class="ss-titles">
       <h1>模塊名稱</h1>
       <p class="ss-sub">一句描述</p>
     </div>
     <div class="ss-actions">…模塊自有按鈕…（語言切換器自動注入）</div>
   </header>
   ============================================================ */

.ss-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 12px;
  margin: 0 auto;
  max-width: 660px;                 /* 與表單型內容容器一致，各模塊可覆蓋 */
  position: relative;
  z-index: 2;
}

.ss-logo {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 13px;
  background: linear-gradient(135deg, #FF7A45, #FFA26B);
  color: #fff;
  font-size: 21px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(240, 100, 42, .35);
  text-shadow: 0 1px 2px rgba(190, 70, 10, .35);
  user-select: none;
}

.ss-titles { flex: 1; min-width: 0; }

.ss-titles h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 800;
  letter-spacing: .5px;
  color: var(--ink);            /* 跟皮膚主文字色：深色皮膚自動變淺色，保證顯眼 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ss-titles .ss-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--sub);            /* 跟皮膚次要文字色 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 細版 logo（緊湊型 topbar 用，如 focus 模塊） */
.ss-logo-sm {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  font-size: 16px;
  margin-right: 2px;
}

.ss-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* 手機：標題收窄、副標可截斷 */
@media (max-width: 480px) {
  .ss-header { padding: 14px 14px 10px; gap: 10px; }
  .ss-logo { width: 38px; height: 38px; font-size: 19px; }
  .ss-titles h1 { font-size: 17px; }
  .ss-titles .ss-sub { font-size: 11.5px; max-width: 46vw; }
  /* 動作按鈕多咗可以換行，唔會橫向擠爆標題 */
  .ss-actions { flex-wrap: wrap; justify-content: flex-end; row-gap: 6px; }
}

/* ============================================================
   語言切換器（shared/i18n.js 注入）
   ============================================================ */
.ss-lang {
  position: relative;
  flex: none;
}

.ss-lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--sub);
  font-size: 12.5px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all .18s cubic-bezier(.22, .8, .32, 1);
  -webkit-tap-highlight-color: transparent;
}
.ss-lang-btn:hover { border-color: var(--brand-2); color: var(--brand-deep); background: var(--brand-soft); }
.ss-lang-btn svg { width: 15px; height: 15px; display: block; }
.ss-lang-btn .ss-lang-cur { letter-spacing: .3px; }

.ss-lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 148px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(62, 39, 35, .14);
  border: 1.5px solid var(--line);
  padding: 6px;
  display: none;
  z-index: 1200;
  animation: ss-lang-in .18s cubic-bezier(.22, .8, .32, 1);
}
.ss-lang-menu.open { display: block; }
@keyframes ss-lang-in {
  from { opacity: 0; transform: translateY(-5px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.ss-lang-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 11px;
  border: none;
  border-radius: 9px;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  text-align: left;
  transition: background .15s;
}
.ss-lang-opt:hover { background: var(--brand-soft); }
.ss-lang-opt .ss-lang-check {
  margin-left: auto;
  color: var(--brand-deep);
  font-weight: 800;
  visibility: hidden;
}
.ss-lang-opt.on { color: var(--brand-deep); }
.ss-lang-opt.on .ss-lang-check { visibility: visible; }

/* 無 .ss-header 嘅頁面：浮動切換器（右上角，避開內容） */
.ss-lang-fab {
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  right: 12px;
  z-index: 1190;
}
