@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --primary: #00bcd4;
  --primary-hover: #0097a7;
  --bg: #0a0f1c;
  --text: #ffffff;
  --text-secondary: #b3b3b3;
  --card-bg: rgba(255, 255, 255, 0.08);
}

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

body {
  font-family: 'Inter', sans-serif;
  background: linear-gradient(-45deg, #0f2027, #203a43, #2c5364, #1b2735);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
  min-height: 100vh;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

header {
  padding: 20px 40px;
  text-align: center;
  background: rgba(10, 15, 28, 0.6);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

header h1 {
  font-size: 2rem;
  color: var(--primary);
  font-weight: 700;
  letter-spacing: 1px;
}

header span {
  font-size: 1rem;
  color: var(--text-secondary);
}

/* --- Hero Section --- */
.hero-section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 40px;
  margin: 40px auto;
  max-width: 700px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.hero-section h2 {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: #ffffff;
}

.hero-section p {
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-size: 1rem;
}

.input-form {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#orgName {
  flex: 1;
  padding: 12px 15px;
  font-size: 1rem;
  border-radius: 8px;
  border: none;
  background: #111;
  color: #fff;
}

#orgName:focus {
  outline: none;
  border: 1px solid var(--primary);
  box-shadow: 0 0 5px var(--primary);
}

#analyzeButton {
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: 600;
}

#analyzeButton:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

/* --- Loader --- */
.loader {
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 10px;
}

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

/* --- Results Header Bar --- */
.results-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 20px;
  margin-top: 30px;
  margin-bottom: 15px;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.results-header-bar h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #ffffff;
}

/* --- Sort Dropdown --- */
.sort-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sort-container label {
  color: #ffffff;
  font-weight: 500;
  font-size: 1rem;
}

.sort-container select {
  background: rgba(10, 20, 35, 0.9);
  color: #00e0ff;
  border: 1px solid rgba(0, 188, 212, 0.4);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
  outline: none;
  appearance: none;
}

.sort-container select:hover,
.sort-container select:focus {
  background: rgba(0, 188, 212, 0.2);
  border-color: #00bcd4;
  color: #ffffff;
  box-shadow: 0 0 8px rgba(0, 188, 212, 0.5);
}

.sort-container select option {
  background-color: #0b1a26;
  color: #ffffff;
  font-weight: 500;
  border: none;
}

.sort-container select option:checked,
.sort-container select option:hover {
  background-color: #00bcd4 !important;
  color: #ffffff !important;
}

/* --- Results Grid --- */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
  margin: 0 auto;
  max-width: 900px;
}

/* --- Repo Card --- */
.repo-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}

.repo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.repo-card h3 {
  font-size: 1.4rem;
  text-align: center;
  color: var(--primary);
  margin-bottom: 10px;
}

.repo-card .description {
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.ai-summary {
  position: relative;
  font-size: 1rem;
  background: rgba(0, 188, 212, 0.15);
  border-left: 3px solid var(--primary);
  padding: 16px 18px;
  border-radius: 12px;
  margin-bottom: 20px;
  text-align: left;
  line-height: 1.5;
  max-height: 220px;
  overflow-y: auto;
  white-space: normal;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: var(--primary) rgba(255, 255, 255, 0.05);
}

.ai-summary::-webkit-scrollbar {
  width: 8px;
}

.ai-summary::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

/* --- Buttons & Footer Info --- */
.repo-card .view-btn {
  width: 100%;
  padding: 10px 0;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: 0.3s;
}

.repo-card .view-btn:hover {
  background: var(--primary-hover);
}

.card-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* --- Error Box --- */
.error {
  color: #f44336;
  text-align: center;
  background: rgba(255, 0, 0, 0.1);
  padding: 15px;
  border-radius: 8px;
  margin-top: 20px;
}
