/* CSS Variables for Theme Switching */
:root {
  /* Dark Theme (Default) */
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-card: #161b22;
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent-primary: #58a6ff;
  --accent-secondary: #1f6feb;
  --border-color: #30363d;
  --shadow: 0 8px 24px rgba(1, 4, 9, 0.8);
  --gradient: linear-gradient(135deg, #58a6ff, #1f6feb);
  --success: #3fb950;
  --warning: #d29922;
  --error: #f85149;
}

.light-mode {
  /* Light Theme */
  --bg-primary: #ffffff;
  --bg-secondary: #f6f8fa;
  --bg-tertiary: #fafbfc;
  --bg-card: #ffffff;
  --text-primary: #24292f;
  --text-secondary: #57606a;
  --text-muted: #6e7781;
  --accent-primary: #0969da;
  --accent-secondary: #1f6feb;
  --border-color: #d0d7de;
  --shadow: 0 8px 24px rgba(140, 149, 159, 0.2);
  --gradient: linear-gradient(135deg, #0969da, #1f6feb);
  --success: #1a7f37;
  --warning: #9a6700;
  --error: #cf222e;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: all 0.3s ease;
}

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

/* Navigation */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(10px);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 70px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-logo i {
  color: var(--accent-primary);
  font-size: 1.8rem;
}

.theme-toggle {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.theme-toggle:hover {
  background: var(--accent-primary);
  color: white;
  transform: translateY(-2px);
}

/* Hero Section */
.hero {
  background: var(--bg-secondary);
  padding: 80px 0 60px;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--gradient);
}

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

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 60px;
}

.hero-title {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  line-height: 1.1;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.3rem;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

/* Search Container */
.search-container {
  max-width: 600px;
  margin: 0 auto;
}

.search-box {
  position: relative;
  display: flex;
  background: var(--bg-primary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  margin-bottom: 20px;
}

.search-box:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
  transform: translateY(-2px);
}

.search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-input {
  flex: 1;
  padding: 20px 60px 20px 50px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-btn {
  background: var(--accent-primary);
  border: none;
  padding: 0 25px;
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.search-btn:hover {
  background: var(--accent-secondary);
  transform: scale(1.05);
}

/* Search Type */
.search-type {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

.radio-label input {
  display: none;
}

.radio-custom {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-color);
  border-radius: 50%;
  position: relative;
  transition: all 0.3s ease;
}

.radio-label input:checked + .radio-custom {
  border-color: var(--accent-primary);
}

.radio-label input:checked + .radio-custom::after {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-primary);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.radio-label input:checked ~ span {
  color: var(--text-primary);
}

/* Hero Stats */
.hero-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.stat-card {
  background: var(--bg-card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.3s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.stat-icon {
  font-size: 2rem;
  color: var(--accent-primary);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Results Section */
.results-section {
  padding: 60px 0;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
}

.section-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
}

.results-info {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Results Grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}

/* Repository Card */
.repo-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

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

.repo-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

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

.repo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.repo-owner {
  display: flex;
  align-items: center;
  gap: 10px;
}

.owner-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--accent-primary);
}

.owner-name {
  font-weight: 600;
  color: var(--text-secondary);
}

.repo-stats {
  display: flex;
  gap: 12px;
}

.stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.repo-name {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--accent-primary);
}

.repo-name a {
  color: inherit;
  text-decoration: none;
}

.repo-name a:hover {
  text-decoration: underline;
}

.repo-description {
  color: var(--text-secondary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.repo-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.repo-language {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
}

.language-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.repo-updated {
  color: var(--text-muted);
}

.repo-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-tag {
  background: var(--bg-tertiary);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid var(--border-color);
}

/* User Card Styles */
.user-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 24px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.user-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.user-header {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.user-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--accent-primary);
}

.user-info {
  flex: 1;
}

.user-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.profile-link {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.profile-link:hover {
  text-decoration: underline;
}

.details-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  width: 100%;
  margin-top: 12px;
}

.details-btn:hover {
  background: var(--accent-primary);
  color: white;
}

/* User Detail Card */
.user-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 32px;
  max-width: 600px;
  margin: 0 auto;
}

.user-detail-header {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 32px;
}

.detail-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--accent-primary);
}

.user-detail-info h2 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.user-username {
  color: var(--accent-primary);
  font-size: 1.2rem;
  margin-bottom: 12px;
}

.user-bio {
  color: var(--text-secondary);
  line-height: 1.6;
  font-size: 1.1rem;
}

.user-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.stat-item i {
  color: var(--accent-primary);
  font-size: 1.5rem;
}

.stat-content {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.user-meta-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 24px 0;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-secondary);
}

.meta-item i {
  width: 20px;
  color: var(--accent-primary);
}

.meta-item a {
  color: var(--accent-primary);
  text-decoration: none;
}

.meta-item a:hover {
  text-decoration: underline;
}

.user-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.profile-btn {
  background: var(--accent-primary);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  flex: 1;
  justify-content: center;
}

.profile-btn:hover {
  background: var(--accent-secondary);
  transform: translateY(-2px);
}

.back-btn {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s ease;
  flex: 1;
  justify-content: center;
}

.back-btn:hover {
  background: var(--border-color);
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 80px 20px;
  display: none;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-state p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Empty State */
.empty-state, .error-state {
  text-align: center;
  padding: 80px 20px;
  display: none;
}

.empty-icon, .error-icon {
  font-size: 4rem;
  margin-bottom: 20px;
}

.empty-icon {
  color: var(--text-muted);
}

.error-icon {
  color: var(--error);
}

.empty-state h3, .error-state h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.empty-state p, .error-state p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 40px 0 20px;
  margin-top: 60px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  margin-bottom: 40px;
}

.footer-section h4 {
  color: var(--text-primary);
  margin-bottom: 16px;
  font-size: 1.1rem;
}

.footer-section p {
  color: var(--text-secondary);
  line-height: 1.6;
}

.social-links {
  display: flex;
  gap: 16px;
}

.social-links a {
  color: var(--text-secondary);
  font-size: 1.3rem;
  transition: color 0.3s ease;
}

.social-links a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
}

/* Responsive Design */
@media (max-width: 768px) {
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.1rem;
  }
  
  .search-box {
    flex-direction: column;
  }
  
  .search-input {
    padding: 16px 20px;
  }
  
  .search-btn {
    padding: 12px;
    border-radius: 0 0 8px 8px;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
  }
  
  .hero-stats {
    grid-template-columns: 1fr;
  }
  
  .user-detail-header {
    flex-direction: column;
    text-align: center;
  }
  
  .user-stats-grid {
    grid-template-columns: 1fr;
  }
  
  .user-actions {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .nav-container {
    padding: 0 16px;
  }
  
  .hero {
    padding: 60px 0 40px;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .search-type {
    flex-direction: column;
    gap: 12px;
  }
  
  .user-header {
    flex-direction: column;
    text-align: center;
  }
  
  .user-avatar {
    align-self: center;
  }
}