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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #0d1117;
  min-height: 100vh;
}

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


.hero-section {
  position: relative;
  margin-bottom: 1rem;
  /* Show the hero section and center its contents */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 0;
}

.hero-image {
  width: 100%;
  /* allow the image to scale up to the container but not overflow */
  max-width: 1000px;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.hero-content {
  margin-top: 1.5rem;
}

/* Hero image entrance animation */
.hero-image {
  opacity: 0;
  transform: translateY(8px);
  animation: heroFadeIn 700ms ease forwards;
}

@keyframes heroFadeIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: #8b949e;
  max-width: 500px;
  margin: 0 auto;
}

/* Search Section */
.search-section {
  /* Position search as an overlay on the hero image */
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 24px;
  width: calc(100% - 40px);
  max-width: 720px;
  padding: 12px;
  background: rgba(13, 17, 23, 0.6);
  backdrop-filter: blur(8px);
  border-radius: 12px;
  border: 1px solid rgba(48, 54, 61, 0.6);
  box-shadow: 0 8px 30px rgba(0,0,0,0.45);
}

.search-form {
  max-width: 100%;
  margin: 0 auto;
  position: relative; /* make suggestions absolute-position relative to the form */
}

.search-input-container {
  position: relative;
  display: flex;
  align-items: center;
  /* make the inner container transparent so the overlay background shows through */
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  transition: all 0.3s ease;
  box-shadow: none;
}

.search-input-container:focus-within {
  /* highlight the transparent container on focus to keep a11y affordance */
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.08);
}

.search-icon {
  width: 20px;
  height: 20px;
  margin-right: 0.75rem;
  opacity: 0.7;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #f0f6fc;
  font-size: 1rem;
  padding: 0.25rem 0;
}

.search-input::placeholder {
  color: #8b949e;
}

.search-button {
  background: #238636;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 0.75rem;
  transition: all 0.18s ease;
}

.search-button:hover {
  background: #2ea043;
  transform: translateY(-1px);
}

.search-button:active {
  transform: translateY(0);
}

/* Suggestions dropdown */
.search-suggestions {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(100% + 8px); /* place below the form */
  width: calc(100% - 56px);
  max-width: 680px;
  padding: 8px;
  background: transparent; /* the overlay provides the main background; suggestions are cards */
  pointer-events: auto;
  z-index: 40;
}

.search-suggestions .suggestion-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.suggestion-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: rgba(13, 18, 26, 0.85);
  border: 1px solid rgba(48, 54, 61, 0.6);
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  color: #f0f6fc;
}

.suggestion-item:hover,
.suggestion-item[aria-selected="true"] {
  background: rgba(40, 50, 70, 0.95);
  transform: translateY(-2px);
}

.suggestion-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.04);
}

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

.suggestion-name {
  font-weight: 700;
  color: #f0f6fc;
}

.suggestion-username {
  font-size: 0.9rem;
  color: #8b949e;
}

/* Small screen adjustments */
@media (max-width: 480px) {
  .search-suggestions {
    width: calc(100% - 32px);
    left: 50%;
    transform: translateX(-50%);
    max-width: none;
  }
  .suggestion-avatar { width: 36px; height: 36px; }
}

/* Main Content */
.main-content {
  padding: 1rem 0;
  min-height: 60vh;
}

/* Loading State */
.loading {
  text-align: center;
  padding: 3rem 0;
  color: #8b949e;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #30363d;
  border-top: 3px solid #58a6ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

@keyframes fadeInUp {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 3rem 0;
  color: #f85149;
  font-size: 1.1rem;
}

/* Profile Section */
.profile-section {
  margin-bottom: 3rem;
  animation: fadeInUp 0.6s ease-out;
}

.profile-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.profile-header {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1.5rem;
}

.profile-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid #30363d;
  object-fit: cover;
}

.profile-info {
  flex: 1;
}

.profile-name {
  font-size: 2rem;
  font-weight: 700;
  color: #f0f6fc;
  margin-bottom: 0.25rem;
}

.profile-username {
  font-size: 1.1rem;
  color: #58a6ff;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  display: inline-block;
}

.profile-username:hover {
  background: rgba(88, 166, 255, 0.1);
  transform: scale(1.02);
}

.profile-bio {
  color: #8b949e;
  font-size: 1rem;
  line-height: 1.5;
  max-width: 600px;
}

.profile-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 8px;
  min-width: 140px;
}

.stat-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.stat-value {
  font-weight: 600;
  color: #f0f6fc;
  font-size: 1.1rem;
}

.stat-label {
  color: #8b949e;
  font-size: 0.9rem;
}

/* Repositories Section */
.repositories-section {
  margin-top: 3rem;
  animation: fadeInUp 0.8s ease-out;
}

.repositories-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.repositories-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #f0f6fc;
}

.view-all-link {
  color: #58a6ff;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.view-all-link:hover {
  color: #79c0ff;
  text-decoration: underline;
}

.repositories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.repository-card {
  background: linear-gradient(95deg, #111729 3%, #1d1b48 99.61%);
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.repository-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  border-color: #58a6ff;
}

.repo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.repo-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: #58a6ff;
  margin: 0;
}

.repo-stars {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  color: #8b949e;
  font-size: 0.9rem;
}

.star-icon {
  width: 16px;
  height: 16px;
}

.repo-description {
  color: #8b949e;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  /* Standard property for newer browsers */
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.repo-footer {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.8rem;
  color: #8b949e;
}

.repo-language {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.language-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #58a6ff;
}

/* Footer */
.footer {
  background: #0d1117;
  border-top: 1px solid #30363d;
  padding: 2rem 0;
  margin-top: 4rem;
}

.author-info {
  text-align: center;
  color: #8b949e;
  font-size: 0.9rem;
}

.author-info a {
  color: #58a6ff;
  text-decoration: none;
  transition: color 0.3s ease;
}

.author-info a:hover {
  color: #79c0ff;
  text-decoration: underline;
}

/* Responsive Design */

/* Tablet Styles (1024px and below) */
@media (max-width: 1024px) {
  .container {
    padding: 0 16px;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .profile-header {
    flex-direction: column;
    text-align: center;
    gap: 1rem;
  }

  .profile-avatar {
    width: 100px;
    height: 100px;
  }

  .profile-name {
    font-size: 1.75rem;
  }

  .profile-stats {
    justify-content: center;
    gap: 1rem;
  }

  .stat-item {
    min-width: 120px;
  }

  .repositories-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
  }

  .repositories-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
}

/* Mobile Styles (412px and below) */
@media (max-width: 412px) {
  .container {
    padding: 0 12px;
  }

  .header {
    padding: 1.5rem 0;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 0.9rem;
  }

  .search-input-container {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
  }

  .search-button {
    width: 100%;
    margin-left: 0;
  }

  .profile-card {
    padding: 1.5rem;
  }

  .profile-avatar {
    width: 80px;
    height: 80px;
  }

  .profile-name {
    font-size: 1.5rem;
  }

  .profile-username {
    font-size: 1rem;
  }

  .profile-stats {
    flex-direction: column;
    gap: 0.75rem;
  }

  .stat-item {
    min-width: auto;
    width: 100%;
    justify-content: center;
  }

  .repositories-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .repository-card {
    padding: 1.25rem;
  }

  .repo-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .repo-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .main-content {
    padding: 1.5rem 0;
  }
}

/* Extra small screens */
@media (max-width: 320px) {
  .container {
    padding: 0 8px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .profile-card {
    padding: 1rem;
  }

  .repository-card {
    padding: 1rem;
  }
}
