:root {
  --bg-body: #0d1117;
  --bg-card: #161b22;
  --text-main: #f0f6fc;
  --text-muted: #8b949e;
  --border: #30363d;
  --accent: #58a6ff;
  --btn-bg: #238636;
  --shadow: 0 4px 12px rgba(0,0,0,0.5);
}

[data-theme="light"] {
  --bg-body: #f6f8fa;
  --bg-card: #ffffff;
  --text-main: #24292f;
  --text-muted: #57606a;
  --border: #d0d7de;
  --accent: #0969da;
  --btn-bg: #1f883d;
  --shadow: 0 4px 12px rgba(27, 31, 35, 0.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', sans-serif; }
h1, h2, h3, .logo { font-family: 'Space Grotesk', sans-serif; }

body {
  background: var(--bg-body);
  color: var(--text-main);
  transition: background 0.3s, color 0.3s;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-shape {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.2;
    z-index: -1;
}
.shape-1 { top: -50px; left: -50px; background: var(--accent); }
.shape-2 { bottom: 10%; right: -50px; background: var(--btn-bg); }

.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 40px;
  max-width: 1200px;
  margin: 0 auto;
}
.logo { font-size: 1.5rem; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.theme-btn {
  background: none; border: 1px solid var(--border);
  color: var(--text-main); padding: 10px; border-radius: 50%;
  cursor: pointer; transition: 0.2s;
}
.theme-btn:hover { background: var(--bg-card); border-color: var(--accent); }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }

.hero {
  text-align: center;
  margin: 40px 0 30px 0;
  animation: fadeIn 0.8s ease;
}
.hero h1 { font-size: 3rem; margin-bottom: 15px; line-height: 1.2; }
.hero .highlight { color: var(--accent); position: relative; }
.hero p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.search-section { display: flex; justify-content: center; margin-bottom: 50px; }
.search-bar {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50px; padding: 8px 15px; display: flex;
  align-items: center; width: 100%; max-width: 600px;
  box-shadow: var(--shadow); transition: 0.3s;
}
.search-bar:focus-within { border-color: var(--accent); transform: scale(1.02); }
.search-bar input {
  flex: 1; background: transparent; border: none; color: var(--text-main);
  padding: 10px; outline: none; font-size: 1rem;
}
.search-bar button {
  background: var(--btn-bg); color: white; border: none;
  padding: 10px 25px; border-radius: 30px; font-weight: 600; cursor: pointer;
}

main {
  display: grid;
  grid-template-columns: 350px 1fr; 
  gap: 30px;
  animation: slideUp 0.5s ease;
}

.profile-sidebar { display: flex; flex-direction: column; gap: 20px; }

.profile-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 25px; border-radius: 16px; text-align: center;
  box-shadow: var(--shadow);
}
.profile-img {
  width: 150px; height: 150px; border-radius: 50%;
  border: 4px solid var(--bg-body); margin-bottom: 15px;
}
.profile-name { font-size: 1.5rem; margin-bottom: 5px; }
.profile-login { color: var(--accent); font-size: 1.1rem; }
.profile-bio { color: var(--text-muted); font-size: 0.9rem; margin: 15px 0; line-height: 1.5; }
.social-links { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 15px; font-size: 0.9rem; }
.social-links span { display: flex; gap: 10px; align-items: center; color: var(--text-muted); }

.chart-container {
  background: var(--bg-card); 
  border: 1px solid var(--border);
  padding: 20px; 
  border-radius: 16px;
  height: 400px; 
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.repo-filter-bar {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px;
  flex-wrap: wrap; gap: 10px;
}
.repo-filter-bar input {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 10px; border-radius: 8px; color: var(--text-main); outline: none;
}

.repos-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px;
}

.repo-card {
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 20px; border-radius: 12px; transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  cursor: pointer; display: flex; flex-direction: column; height: 100%;
}
.repo-card:hover { 
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent); 
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
}
.repo-title { color: var(--accent); font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.repo-desc { color: var(--text-muted); font-size: 0.9rem; flex: 1; margin-bottom: 15px; }
.repo-stats { display: flex; gap: 15px; font-size: 0.8rem; color: var(--text-muted); margin-top: auto; }

.show-more-btn {
  grid-column: 1 / -1; width: fit-content; margin: 20px auto 0 auto;
  padding: 12px 35px; background: var(--bg-card); color: var(--accent);
  border: 1px solid var(--accent); border-radius: 50px;
  font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 10px;
}
.show-more-btn:hover {
  background: var(--accent); color: white;
  transform: translateY(-3px); box-shadow: 0 8px 25px rgba(88, 166, 255, 0.4);
}
.show-more-btn:hover i { transform: translateY(3px); }

.hidden { display: none !important; }
.badge { background: var(--border); padding: 2px 8px; border-radius: 12px; font-size: 0.8rem; }
.error-msg {
  text-align: center; background: rgba(255, 100, 100, 0.1); border: 1px solid red;
  padding: 15px; border-radius: 8px; color: #ff6b6b; max-width: 600px; margin: 0 auto;
}

.loader { display: flex; justify-content: center; margin-top: 50px; }
.spinner {
  width: 40px; height: 40px; border: 4px solid var(--border);
  border-top: 4px solid var(--accent); border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  .profile-sidebar { flex-direction: row; flex-wrap: wrap; }
  .profile-card, .chart-container { flex: 1; min-width: 300px; }
  .hero h1 { font-size: 2rem; }
}
@media (max-width: 600px) {
  .profile-sidebar { flex-direction: column; }
  .navbar { padding: 20px; }
}