/* ═══════════════════════════════════════════════════════════
   SETTINGS · CONNECT TAB
   ───────────────────────────────────────────────────────────
   連接 tab 相關樣式：skills list（MCP / skill 列表）、外部連結
   (integration grid)、AI provider 金鑰 (provider card / tile /
   modal / brand-icon)、unified search bar。
   從 settings.css 拆出（v46，2026-05-13）— cascade order：在
   settings.css 之後載入，desktop / mobile 同特異度時後者贏。
   ═══════════════════════════════════════════════════════════ */

/* Skills list — default vertical; add .skills-list--grid for card grid */
.skills-list { display: flex; flex-direction: column; gap: 8px; }
.skills-list--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.skill-item {
  padding: 12px;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--trans-fast);
}
.skills-list--grid .skill-item {
  padding: 14px;
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
}
.skill-item:hover { border-color: var(--border-default); }
.skill-item.disabled { opacity: 0.5; }
.skill-item.disabled code { text-decoration: line-through; }
.skill-head { display: flex; align-items: center; gap: 10px; margin-bottom: 5px; }
.skill-head code { background: var(--bg-elevated); font-size: 12px; padding: 2px 8px; }
.skill-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.45; }
.skills-list--grid .skill-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Integration grid (list view for 外部連結) */
.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.integration-card {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all var(--trans-fast);
  width: 100%;
}
.integration-card:hover:not(.disabled) {
  border-color: var(--accent-ring);
  background: var(--accent-subtle);
  transform: translateY(-1px);
}
.integration-card.disabled {
  opacity: 0.55;
  cursor: default;
}
.integration-card .int-icon {
  font-size: 28px;
  width: 40px;
  flex-shrink: 0;
  text-align: center;
}
.integration-card .int-body { flex: 1; min-width: 0; }
.integration-card .int-title {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
  margin-bottom: 2px;
}
.integration-card .int-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Provider cards (AI → 金鑰 view · Cherry Studio style) */
.provider-list { display: flex; flex-direction: column; gap: 10px; }
.provider-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  transition: border-color var(--trans-fast);
}
.provider-card.active { border-color: var(--accent-ring); }
.provider-card.disabled { opacity: 0.55; }
.provider-head { display: flex; align-items: center; gap: 14px; }
.provider-icon { font-size: 24px; width: 36px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.provider-icon .ico { width: 24px; height: 24px; color: var(--text-muted); }
.provider-body { flex: 1; min-width: 0; }
.provider-name { font-size: 14px; color: var(--text-primary); font-weight: 500; margin-bottom: 2px; }
.provider-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.provider-settings { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }

/* ─── Key pool: search + tile grid + modal (AI → 金鑰) ─── */

/* Section group */
.kp-section { margin-bottom: 22px; }
.kp-section-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* Provider tile grid */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.provider-tile {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all var(--trans-fast);
  width: 100%;
}
.provider-tile:hover { border-color: var(--accent-ring); background: var(--accent-subtle); transform: translateY(-1px); }

/* (2026-05-12 dead-code 砍：.onboarding-card / .onboarding-backdrop — 兩模式
   onboarding UI 在 BLUEPRINT 2026-04-26 決策時整個刪掉，CSS 沒清。grep 確認
   無 HTML 引用。) */
.provider-tile.is-connected { border-color: rgba(74,222,128,0.25); }
.provider-tile-icon { font-size: 24px; width: 32px; text-align: center; flex-shrink: 0; line-height: 1.2; display: inline-flex; align-items: center; justify-content: center; }

/* Brand logos via CSS mask — works for both Lobehub (currentColor) and SimpleIcons.
   The SVG is loaded as a mask (alpha shape only); color comes from background-color.
   Provider sets --icon-url via inline style; theme controls the color here. */
.brand-icon {
  display: inline-block;
  width: 22px; height: 22px;
  background-color: var(--text-primary);
  -webkit-mask: var(--icon-url) center / contain no-repeat;
          mask: var(--icon-url) center / contain no-repeat;
  vertical-align: middle;
  flex-shrink: 0;
}
.brand-icon--lg { width: 28px; height: 28px; }
.provider-tile:hover .brand-icon { background-color: var(--accent); }
.provider-tile.is-connected .brand-icon { background-color: var(--success); }
.provider-tile-body { flex: 1; min-width: 0; }
.provider-tile-name { font-size: 13.5px; color: var(--text-primary); font-weight: 500; margin-bottom: 4px; }
.provider-tile-desc { font-size: 11.5px; color: var(--text-muted); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.provider-tile-tags { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; flex-shrink: 0; }

/* Modal */
.kp-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
  animation: kp-fade var(--trans-fast);
  padding: 20px;
}
@keyframes kp-fade { from { opacity: 0; } to { opacity: 1; } }
.kp-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 580px; max-height: 85vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: kp-pop var(--trans-med) cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes kp-pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } to { opacity: 1; transform: none; } }
.kp-modal-head {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px; border-bottom: 1px solid var(--border-subtle);
}
.kp-modal-head .provider-icon { font-size: 28px; width: 36px; text-align: center; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.kp-modal-head .provider-icon .ico { width: 28px; height: 28px; color: var(--text-muted); }
.kp-modal-head .provider-name { font-size: 15px; color: var(--text-primary); font-weight: 600; }
.kp-modal-head .provider-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kp-modal-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
/* Inner detail panels show their own sub-header pill — keep but slim */
.kp-modal-body .provider-head { padding: 0 0 4px; background: transparent; border: none; }
.kp-modal-body .provider-head .provider-icon,
.kp-modal-body .provider-head .provider-body { display: none; }  /* avoid double header (modal head shows it) */
.kp-modal-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--border-subtle);
}

/* 連接 tab — unified search bar + results (Spotlight style) */
.connect-search {
  position: relative;
  margin-bottom: 18px;
}
.connect-search-input {
  width: 100%;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 14px 40px 14px 44px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color var(--trans-fast), box-shadow var(--trans-fast);
}
.connect-search-input:focus {
  outline: none;
  border-color: var(--accent-ring);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
.connect-search-input::placeholder { color: var(--text-muted); }
.connect-search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 16px; opacity: 0.7; pointer-events: none;
  color: var(--text-muted);
  display: inline-flex; align-items: center; justify-content: center;
}
.connect-search-icon .ico { width: 16px; height: 16px; }
.connect-search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--bg-elevated); color: var(--text-muted);
  font-size: 16px; line-height: 1; cursor: pointer; border: 0;
  display: flex; align-items: center; justify-content: center;
}
.connect-search-clear:hover { background: var(--bg-overlay); color: var(--text-primary); }

.connect-search-results { margin-top: 6px; }
.connect-search-list { display: flex; flex-direction: column; gap: 4px; }
.connect-search-hit {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary); cursor: pointer;
  transition: all var(--trans-fast);
}
.connect-search-hit:hover {
  border-color: var(--accent-ring);
  background: var(--accent-subtle);
  transform: translateX(2px);
}
.connect-search-hit-icon {
  font-size: 20px; width: 28px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.connect-search-hit-body { flex: 1; min-width: 0; }
.connect-search-hit-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 500;
  margin-bottom: 2px;
}
.connect-search-hit-desc {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.connect-search-hit-arrow {
  color: var(--text-muted); opacity: 0.5;
  transition: all var(--trans-fast);
}
.connect-search-hit:hover .connect-search-hit-arrow {
  opacity: 1; color: var(--accent); transform: translateX(2px);
}

/* ═══════════════════════════════════════════════════════════
   📱 MOBILE — < 760px
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 760px) {
  /* Modal — 全寬不留空 */
  .kp-modal-body { padding: 14px 16px; }

  /* 連接頁搜尋 hit — 收緊 padding */
  .connect-search-hit { padding: 10px 12px; gap: 10px; }
}
