/* ── GitHub Widget — intégration portfolio ── */

.gh-widget-section {
  margin-top: var(--spacing-2xl, 2rem);
}

.gh-widget-wrapper {
  width: 100%;
  max-width: 560px;
}

/* Conteneur principal */
.gh-widget {
  position: relative;
  width: 100%;
  border: 1px solid #30363d;
  border-radius: 10px;
  background: #0d1117;
  display: flex;
  flex-direction: column;
  color: #c9d1d9;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 360px;
}

/* Header */
.ghw-header {
  background: #161b22;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid #21262d;
  flex-shrink: 0;
}

.ghw-top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
}

.ghw-gh-icon {
  display: flex;
  height: 1.4em;
  fill: #8b949e;
  flex-shrink: 0;
  text-decoration: none;
  transition: fill 0.2s;
}
.ghw-gh-icon:hover { fill: #c9d1d9; }
.ghw-gh-icon svg { height: 100%; width: auto; }

.ghw-repo {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.ghw-repo a {
  text-decoration: none;
  color: #8b949e;
  font-size: 13px;
  transition: color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ghw-repo a:hover { color: #58a6ff; }
.ghw-repo-slash { color: #484f58; font-size: 11px; pointer-events: none; }
.ghw-repo-name { color: #e6edf3 !important; font-weight: 600 !important; }

.ghw-pfp {
  width: 1.4em;
  height: 1.4em;
  border-radius: 50%;
  background-color: #21262d;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.ghw-space { flex-grow: 1; }

.ghw-loading {
  display: none;
  width: 1.2em;
  height: 1.2em;
  fill: #8b949e;
  flex-shrink: 0;
}
.ghw-loading.active { display: flex; }
@keyframes ghw-spin { to { transform: rotate(360deg); } }
.ghw-spin-svg { animation: ghw-spin 0.7s linear infinite; width: 100%; height: 100%; }

/* Tabs */
.ghw-tabs {
  display: flex;
  padding: 0 8px;
  gap: 2px;
  overflow-x: auto;
}
.ghw-tabs::-webkit-scrollbar { height: 0; }

.ghw-tab {
  position: relative;
  padding: 6px 8px 9px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  cursor: pointer;
  isolation: isolate;
  color: #8b949e;
  fill: #8b949e;
  white-space: nowrap;
  transition: color 0.2s;
}
.ghw-tab.active { color: #e6edf3; fill: #e6edf3; border-bottom: 2px solid #f78166; }
.ghw-tab-icon { width: 1em; height: 1em; }
.ghw-tab::before {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 6px;
  opacity: 0;
  inset: 2px 0 5px;
  z-index: -1;
  transition: opacity 0.2s;
}
.ghw-tab:hover::before { opacity: 0.05; }

/* Content */
.ghw-content { flex: 1; overflow: hidden; position: relative; min-height: 260px; }

/* Les panels sont cachés/montrés uniquement via JS (style.display) */
.ghw-panel { height: 100%; flex-direction: column; overflow: hidden; min-height: 260px; }

/* Error / loading state */
.ghw-state {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 260px;
  color: #484f58;
  font-size: 13px;
}
.ghw-state.error { color: #f85149; }

/* Tree */
.ghw-tree {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ghw-tree::-webkit-scrollbar { width: 4px; }
.ghw-tree::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.ghw-tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 12px;
  color: #c9d1d9;
  transition: background 0.15s;
  user-select: none;
}
.ghw-tree-row:hover { background: #161b22; }
.ghw-tree-icon { width: 14px; height: 14px; display: flex; align-items: center; flex-shrink: 0; }
.ghw-tree-icon svg { width: 14px; height: 14px; }
.ghw-tree-icon.dir  svg { fill: #e3b341; }
.ghw-tree-icon.file svg { fill: #8b949e; }
.ghw-tree-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ghw-tree-loader { padding: 2px 8px 2px 24px; font-size: 11px; color: #484f58; }

/* List (commits / releases) */
.ghw-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}
.ghw-list::-webkit-scrollbar { width: 4px; }
.ghw-list::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.ghw-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-bottom: 1px solid #21262d;
  transition: background 0.15s;
}
.ghw-list-item:last-child { border-bottom: none; }
.ghw-list-item:hover { background: #161b22; }

.ghw-commit-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #21262d;
  flex-shrink: 0;
  object-fit: cover;
}
.ghw-release-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  fill: #3fb950; flex-shrink: 0;
}
.ghw-release-icon svg { width: 16px; height: 16px; }

.ghw-list-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ghw-list-title {
  font-size: 12px; font-weight: 500; color: #c9d1d9;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ghw-list-meta { font-size: 11px; color: #484f58; }

/* PRs */
.ghw-prs {
  margin: 10px;
  height: calc(100% - 20px);
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid #30363d; border-radius: 6px;
  overflow: auto;
}
.ghw-prs::-webkit-scrollbar { width: 4px; }
.ghw-prs::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.ghw-pr {
  display: flex; gap: 8px; width: 100%;
  border-bottom: 1px solid #21262d;
  padding: 8px 10px;
  transition: background 0.15s;
}
.ghw-pr:last-child { border-bottom: none; }
.ghw-pr:hover { background: #161b22; }

.ghw-pr-icon { display: flex; width: 1em; height: 1em; fill: #3fb950; flex-shrink: 0; margin-top: 2px; }
.ghw-pr-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ghw-pr-title {
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: #c9d1d9; transition: color 0.2s;
}
.ghw-pr-title:hover { color: #58a6ff; }
.ghw-pr-desc { font-size: 11px; color: #484f58; }

/* README */
.ghw-readme {
  flex: 1; overflow-y: auto; padding: 16px;
  font-size: 12px; line-height: 1.6; color: #c9d1d9;
}
.ghw-readme::-webkit-scrollbar { width: 4px; }
.ghw-readme::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

.ghw-readme h1, .ghw-readme h2, .ghw-readme h3, .ghw-readme h4 {
  color: #e6edf3; margin: 14px 0 6px; line-height: 1.3;
}
.ghw-readme h1 { font-size: 18px; border-bottom: 1px solid #21262d; padding-bottom: 6px; }
.ghw-readme h2 { font-size: 15px; border-bottom: 1px solid #21262d; padding-bottom: 4px; }
.ghw-readme h3 { font-size: 13px; }
.ghw-readme h4 { font-size: 12px; }
.ghw-readme p { margin: 6px 0; }
.ghw-readme a { color: #58a6ff; text-decoration: none; }
.ghw-readme a:hover { text-decoration: underline; }
.ghw-readme code {
  background: #161b22; border: 1px solid #30363d; border-radius: 4px;
  padding: 1px 5px; font-family: 'Consolas','Monaco',monospace;
  font-size: 11px; color: #e6edf3;
}
.ghw-readme pre {
  background: #161b22; border: 1px solid #30363d; border-radius: 6px;
  padding: 12px; overflow-x: auto; margin: 8px 0;
}
.ghw-readme pre::-webkit-scrollbar { height: 4px; }
.ghw-readme pre::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
.ghw-readme pre code { background: none; border: none; padding: 0; font-size: 11px; color: #c9d1d9; }
.ghw-readme ul, .ghw-readme ol { padding-left: 20px; margin: 6px 0; }
.ghw-readme li { margin: 2px 0; }
.ghw-readme blockquote { border-left: 3px solid #30363d; padding-left: 10px; margin: 6px 0; color: #8b949e; }
.ghw-readme img { max-width: 100%; border-radius: 4px; margin: 4px 0; }
.ghw-readme table { width: 100%; border-collapse: collapse; font-size: 11px; margin: 8px 0; }
.ghw-readme th, .ghw-readme td { border: 1px solid #30363d; padding: 5px 8px; text-align: left; }
.ghw-readme th { background: #161b22; color: #e6edf3; }
.ghw-readme hr { border: none; border-top: 1px solid #21262d; margin: 12px 0; }

/* Empty */
.ghw-empty { padding: 24px; text-align: center; color: #484f58; font-size: 13px; }
