@import url("./shared.css");

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  background-color: var(--background-dark);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Light theme */
body.light-theme {
  background-color: var(--background-light);
  color: var(--text-light);
}

/* Header */
header {
  text-align: center;
  padding: 3rem 1rem;
  background: linear-gradient(45deg, #1a1a1a, #2d2d2d);
}

.light-theme header {
  background: linear-gradient(45deg, #f0f0f0, #e0e0e0);
}

header h1 {
  font-size: 2.5rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.subtitle {
  font-size: 1.2rem;
  opacity: 0.8;
}

/* Main Content */
main {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Search Container */
.search-container {
  position: relative;
  max-width: 500px;
  margin: 2rem auto;
}

#project-search {
  width: 100%;
  padding: 12px 45px 12px 15px;
  border: 2px solid var(--primary-color);
  border-radius: 25px;
  background: var(--card-dark);
  color: var(--text-dark);
  font-size: 1rem;
}

.light-theme #project-search {
  background: var(--card-light);
  color: var(--text-light);
}

.search-icon {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
}

/* Project Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  padding: 1rem;
}

.project-grid li {
  background: var(--card-dark);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}

.light-theme .project-grid li {
  background: var(--card-light);
}

.project-grid li:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 12px rgba(0, 0, 0, 0.2);
}

.project-header {
  padding: 1.5rem 1.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.project-name {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
}

.project-date {
  font-size: 0.8rem;
  color: var(--text-dark);
  opacity: 0.7;
}

.light-theme .project-date {
  color: var(--text-light);
}

.project-description {
  padding: 0 1.5rem 1rem;
  color: var(--text-dark);
  font-size: 0.9rem;
  line-height: 1.5;
  opacity: 0.8;
  flex-grow: 1;
}

.light-theme .project-description {
  color: var(--text-light);
}

.project-commit {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-dark);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.light-theme .project-commit {
  border-top-color: rgba(0, 0, 0, 0.1);
  color: var(--text-light);
}

.project-commit:hover {
  background-color: rgba(187, 134, 252, 0.1);
}

.project-commit i {
  color: var(--primary-color);
  font-size: 0.9rem;
}

.commit-message {
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.commit-hash {
  color: var(--primary-color);
  font-family: monospace;
  font-size: 0.8rem;
}

.project-readme {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card-dark);
  border-radius: 8px;
  white-space: pre-wrap;
  overflow-x: auto;
  display: none;
}

.light-theme .project-readme {
  background: var(--card-light);
}

.project-readme.active {
  display: block;
}

.readme-toggle {
  background: none;
  border: none;
  color: var(--text-dark);
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

.light-theme .readme-toggle {
  color: var(--text-light);
}

.readme-toggle:hover {
  color: var(--primary-color);
}

/* Loading State */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  color: var(--primary-color);
}

.loading-spinner i {
  animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
  text-align: center;
  padding: 2rem;
  color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
  border-radius: 10px;
  margin: 1rem 0;
}

/* No Results */
.no-results {
  text-align: center;
  padding: 2rem;
  color: var(--text-dark);
  opacity: 0.7;
}

.light-theme .no-results {
  color: var(--text-light);
}

/* Footer */
footer {
  text-align: center;
  padding: 2rem;
  margin-top: auto;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 auto 1rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  background: var(--card-dark);
  color: var(--primary-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.light-theme .theme-toggle {
  background: var(--card-light);
}

.theme-toggle:hover {
  background: var(--primary-color);
  color: var(--background-dark);
}

#language-select {
  padding: 0.5rem;
  border: none;
  border-radius: 4px;
  background: var(--card-dark);
  color: var(--text-dark);
  cursor: pointer;
  transition: all 0.3s ease;
}

.light-theme #language-select {
  background: var(--card-light);
  color: var(--text-light);
}

.footer-text {
  font-size: 0.9rem;
  opacity: 0.7;
}

#about-link {
  color: var(--text-dark);
  background-color: var(--primary-color);
  border: var(--primary-color) 4px solid;
  border-radius: 10px;
  display: inline-block;
  text-decoration: none;
  transition: color 0.3s ease;
}

.light-theme #about-link {
  color: var(--text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
  header h1 {
    font-size: 2rem;
  }
  
  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
  }
  
  main {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  header h1 {
    font-size: 1.75rem;
  }
  
  .subtitle {
    font-size: 1rem;
  }
  
  #project-search {
    font-size: 0.9rem;
  }
}
