/* ===================================================
   GitPulse — GitHub Intelligence Premium Theme
   =================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Core Palette */
  --bg-deep: #f8fafc;
  --bg-surface: #f1f5f9;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-elevated: #e2e8f0;
  --border: rgba(0, 0, 0, 0.08);
  --border-hover: rgba(0, 0, 0, 0.15);

  /* Orange Accent System */
  --orange: #ea580c;
  --orange-dim: rgba(234, 88, 12, 0.15);
  --orange-glow: rgba(234, 88, 12, 0.3);

  /* Text */
  --text-bright: #0f172a;
  --text-primary: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  /* Semantic */
  --star-gold: #d97706;
  --fork-blue: #2563eb;
  --green: #16a34a;
  --red: #dc2626;

  /* Spacing */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 100px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ======== Dimension Bar ======== */
.dimension-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 42px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0;
  z-index: 1000;
}

.dim-link {
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all 0.25s ease;
}

.dim-link:hover { color: var(--text-bright); }
.dim-link.active { color: var(--orange); border-bottom-color: var(--orange); }
.dim-divider { width: 1px; height: 20px; background: var(--border); }

/* ======== Main App ======== */
.gh-app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 62px 24px 40px;
}

/* ======== Hero Header ======== */
.gh-header {
  margin-bottom: 32px;
  padding: 28px 32px;
  background: linear-gradient(135deg, rgba(234, 88, 12, 0.08) 0%, rgba(255, 255, 255, 0.9) 60%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

.gh-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, var(--orange-dim) 0%, transparent 70%);
  pointer-events: none;
}

.gh-header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  z-index: 1;
}

.gh-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.gh-logo {
  width: 50px;
  height: 50px;
  background: var(--orange-dim);
  border: 1px solid var(--orange-glow);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--orange);
}

.gh-brand h1 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-bright);
  letter-spacing: -0.5px;
}

.gh-brand .accent { color: var(--orange); }

.gh-tagline {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.gh-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gh-stat-pill {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.gh-sync-btn {
  padding: 10px 20px;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.gh-sync-btn:hover {
  background: #ff9147;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--orange-glow);
}

.gh-sync-btn.spinning i {
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ======== Tab Navigation ======== */
.gh-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 4px;
}

.gh-tab {
  flex: 1;
  padding: 12px 20px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.gh-tab:hover { color: var(--text-primary); background: var(--bg-card); }
.gh-tab.active {
  color: var(--orange);
  background: var(--bg-card);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* ======== Sections ======== */
.gh-section { display: none; }
.gh-section.active { display: block; animation: fadeUp 0.3s ease; }

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

.gh-section-header {
  margin-bottom: 24px;
}

.gh-section-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gh-section-header p {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ======== Titan Badges ======== */
.gh-titan-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.titan-badge {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.titan-badge:hover {
  border-color: var(--orange-glow);
  color: var(--orange);
}

/* ======== Card Grid ======== */
.gh-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ======== Repo Card ======== */
.repo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.repo-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.repo-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--orange);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.repo-card:hover::before { opacity: 1; }

.repo-card-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.repo-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.repo-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-bright);
  line-height: 1.3;
  word-break: break-word;
}

.repo-name a { transition: color 0.2s; }
.repo-name a:hover { color: var(--orange); }

.repo-owner {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.repo-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-grow: 1;
}

.repo-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.repo-tag {
  padding: 3px 8px;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.repo-tag.lang-tag {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Language colors */
.lang-python { background: #3572A5; }
.lang-javascript { background: #f1e05a; }
.lang-typescript { background: #3178c6; }
.lang-cpp { background: #f34b7d; }
.lang-rust { background: #dea584; }
.lang-jupyter { background: #DA5B0B; }
.lang-go { background: #00ADD8; }
.lang-java { background: #b07219; }
.lang-default { background: var(--text-muted); }

.repo-stats {
  display: flex;
  gap: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.repo-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  font-weight: 600;
}

.repo-stat.stars { color: var(--star-gold); }
.repo-stat.forks { color: var(--fork-blue); }
.repo-stat.issues { color: var(--green); }
.repo-stat.updated { color: var(--text-muted); font-weight: 400; margin-left: auto; font-size: 0.72rem; }

.hot-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 3px 8px;
  background: var(--orange-dim);
  border: 1px solid var(--orange-glow);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ======== Filter Bar ======== */
.gh-filter-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.gh-search-box {
  flex: 1;
  min-width: 250px;
  position: relative;
  display: flex;
  align-items: center;
}

.gh-search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
}

.gh-search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.gh-search-box input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 2px var(--orange-dim);
}

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

.gh-filter-group label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.gh-select {
  padding: 10px 32px 10px 12px;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23475569'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s ease;
}

.gh-select:focus {
  outline: none;
  border-color: var(--orange);
}

/* ======== Load More ======== */
.gh-load-more-container {
  display: flex;
  justify-content: center;
  margin-top: 32px;
}

.gh-load-more-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-full);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.gh-load-more-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--orange-glow);
  color: var(--orange);
}

.gh-load-more-btn.loading {
  cursor: wait;
  opacity: 0.7;
}

.gh-load-more-btn.loading i {
  animation: spin 1s linear infinite;
}

/* ======== Skeleton Loading ======== */
.gh-skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  height: 180px;
  position: relative;
  overflow: hidden;
}

.gh-skeleton-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(0,0,0,0.05), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer { to { left: 100%; } }

/* ======== Toast ======== */
.toast-container {
  position: fixed;
  top: 52px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  animation: slideIn 0.3s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

.toast-success { border-left: 3px solid var(--green); }
.toast-error { border-left: 3px solid var(--red); }
.toast-info { border-left: 3px solid var(--fork-blue); }

.toast.leaving { opacity: 0; transform: translateX(20px); transition: all 0.3s ease; }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ======== Empty State ======== */
.gh-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.gh-empty i {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: block;
  color: var(--border);
}

.gh-empty p { font-size: 0.9rem; }

/* ======== Responsive ======== */
@media (max-width: 768px) {
  .gh-app { padding: 52px 12px 24px; }
  .gh-header { padding: 20px; }
  .gh-header-content { flex-direction: column; gap: 16px; align-items: flex-start; }
  .gh-grid { grid-template-columns: 1fr; }
  .gh-stat-pill { display: none; }
  .gh-titan-badges { overflow-x: auto; flex-wrap: nowrap; }
}

@media (max-width: 480px) {
  .dim-link { padding: 0 14px; font-size: 0.7rem; letter-spacing: 0.8px; }
}
