/* General reset */
* {
  box-sizing: border-box;
}

/* Page body */
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.6;
  background: #f3f4f6;
  color: #1f2937;
  transition: background 0.3s ease, color 0.3s ease;
}

/* Page container */
#container {
  width: 92%;
  max-width: 1000px;
  margin: 35px auto;
  padding-bottom: 30px;
}

/* Top hero section */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.hero-text h1 {
  margin: 0 0 6px;
  font-size: 2.2rem;
}

.subtitle {
  margin: 0;
  color: #6b7280;
  font-size: 1rem;
}

/* Section boxes */
section {
  background-color: #ffffff;
  border: 1px solid #d9dde3;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  animation: fadeIn 0.5s ease;
}

/* Headings */
h2 {
  margin-top: 0;
  margin-bottom: 10px;
  font-size: 1.8rem;
}

h3 {
  margin-top: 0;
  margin-bottom: 8px;
}

.section-note {
  margin-top: 0;
  margin-bottom: 18px;
  color: #6b7280;
}

/* Buttons, inputs, select, and textarea use same font */
button,
input,
select,
textarea {
  font: inherit;
}

/* Buttons */
button {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background-color: #1f2937;
  color: white;
  transition: transform 0.15s ease, opacity 0.2s ease, background-color 0.2s ease;
}

button:hover {
  opacity: 0.95;
  transform: translateY(-1px);
}

/* Top theme button */
#themeToggle {
  white-space: nowrap;
  min-width: 120px;
}

/* Labels */
label {
  display: block;
  font-weight: bold;
  margin-bottom: 8px;
}

/* Inputs and textareas */
input,
select,
textarea {
  width: 100%;
  max-width: 100%;
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px solid #c9ced6;
  border-radius: 10px;
  background: #fff;
  color: #1f2937;
}

/* Make dropdown arrow spacing cleaner */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position:
    calc(100% - 20px) calc(50% - 3px),
    calc(100% - 14px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

/* Welcome section */
.welcome-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.welcome-row input {
  margin-bottom: 0;
}

#saveNameBtn {
  padding: 10px 14px;
  min-width: 90px;
  white-space: nowrap;
  flex-shrink: 0;
}

#welcomeMessage,
#repoStatus,
#formMessage,
#emptyMessage {
  margin-top: 10px;
  font-weight: bold;
}

/* Section top row */
.section-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

#loadReposBtn {
  white-space: nowrap;
}

/* Project controls */
.project-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

/* Project grid */
.project-grid {
  display: grid;
  gap: 18px;
}

/* Project cards */
.project-card {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
  border: 1px solid #dde2e8;
  border-radius: 12px;
  padding: 16px;
  background: #fafafa;
  min-height: 280px;
}

.project-content p {
  margin-bottom: 0;
}

.project-tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e5e7eb;
  color: #374151;
  font-size: 0.9rem;
  font-weight: bold;
}

.project-card img {
  width: 100%;
  height: 230px;
  object-fit: cover;
  object-position: top center;
  border-radius: 10px;
  border: 1px solid #d9dde3;
  background: #ffffff;
}

/* Repository grid */
.repo-grid {
  display: grid;
  gap: 16px;
}

.repo-card {
  border: 1px solid #dde2e8;
  border-radius: 12px;
  padding: 16px 18px;
  background: #fafafa;
  transition: transform 0.15s ease, border-color 0.2s ease;
}

.repo-card:hover {
  transform: translateY(-2px);
  border-color: #c7d0db;
}

.repo-card h3 {
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.repo-card a {
  color: #1d4ed8;
  text-decoration: none;
}

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

.repo-description {
  margin-bottom: 12px;
}

.repo-meta {
  color: #6b7280;
  font-size: 0.95rem;
}

/* Contact form */
#contact form {
  max-width: 650px;
}

/* Empty search message */
#emptyMessage {
  color: #6b7280;
  font-style: italic;
}

/* Dark mode */
.dark {
  background: #111827;
  color: #f3f4f6;
}

.dark .subtitle,
.dark .section-note,
.dark .repo-meta,
.dark #emptyMessage {
  color: #c0c7d2;
}

.dark section {
  background-color: #1f2937;
  border-color: #374151;
  box-shadow: none;
}

.dark input,
.dark select,
.dark textarea {
  background-color: #111827;
  color: #f3f4f6;
  border-color: #4b5563;
}

.dark input::placeholder,
.dark textarea::placeholder {
  color: #9ca3af;
}

.dark select {
  background-image:
    linear-gradient(45deg, transparent 50%, #c0c7d2 50%),
    linear-gradient(135deg, #c0c7d2 50%, transparent 50%);
}

.dark button {
  background-color: #374151;
  color: #f3f4f6;
}

.dark button:hover {
  background-color: #4b5563;
}

.dark .project-card,
.dark .repo-card {
  background-color: #243041;
  border-color: #415069;
}

.dark .project-tag {
  background: #374151;
  color: #e5e7eb;
}

.dark .project-card img {
  border-color: #4b5563;
  background: #1f2937;
}

.dark .repo-card a {
  color: #93c5fd;
}

/* Section fade-in */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

/* Mobile responsive */
@media (max-width: 800px) {
  .hero,
  .section-top,
  .welcome-row {
    flex-direction: column;
    align-items: stretch;
  }

  .project-controls {
    grid-template-columns: 1fr;
  }

  .project-card {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .project-card img {
    height: 220px;
  }

  #themeToggle,
  #saveNameBtn,
  #loadReposBtn,
  #contact button {
    width: 100%;
  }
}

@media (max-width: 600px) {
  #container {
    width: 95%;
    margin: 20px auto;
  }

  section {
    padding: 18px;
  }

  .hero-text h1 {
    font-size: 1.7rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .project-card img {
    height: 200px;
  }
}