:root {
  --bg: #e6e7eb;
  /* Light neutral gray */
  --card-bg: #f1f2f5;
  /* Slightly brighter for contrast */
  --text: #333840;
  /* Dark charcoal for readability */
  --border: #c2c5cc;
  /* Subtle gray border */
  --hover: #d9dbe1;
  /* Soft, muted hover */
  --primary: #2563eb;
  /* Keeping the blue for contrast */
  --primary-light: #3b82f6;
  --secondary: #6b7280;
  /* Balanced gray */
  --button-text: #ffffff;
  --button-text-hover: #ffffff;
  --error: #d1495b;
  /* Muted red */
  --success: #3a806a;
  /* Earthy green */
  --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  --color-border: #b8bfc7;
  /* Softer gray border */
  --link-color: var(--primary-light);
  --link-hover-color: var(--primary-light);
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #3b82f6;
    --primary-light: #60a5fa;
    --secondary: #9ca3af;
    --text: #e5e7eb;
    --button-text: #f3f4f6;
    --button-text-hover: #ffffff;
    --bg: #111827;
    --card-bg: #1a2033;
    --error: #f87171;
    --success: #34d399;
    --border: #374151;
    --hover: #1e40af;
    --link-color: var(--primary-light);
    --link-hover-color: var(--primary-light);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    --color-border: #2a334f;
  }
}

/* :root {
  --primary: #3b82f6;
  --primary-light: #60a5fa;
  --secondary: #9ca3af;
  --text: #f9fafb;
  --bg: #111827;
  --card-bg: #1f2937;
  --error: #ef4444;
  --success: #10b981;
  --border: #374151;
  --hover: #2d3748;
} */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding: 0 1rem;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color 0.3s ease-in-out, text-decoration 0.2s ease-in-out;
}

a:hover {
  color: var(--link-hover-color);
  text-decoration: underline;
}

header,
main,
footer {
  max-width: 900px;
  margin: 0 auto;
}

header {
  padding: 2rem 0;
  text-align: center;
}

.cf-turnstile {
  display: flex;
  justify-content: center;
  margin-top: 1.8rem;
}

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2.0rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
}

.title h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
  margin-top: 3.0rem;
  font-size: 2.8rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.05rem;
}

.tagline {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

.logo svg {
  width: 36px;
  height: 36px;
  margin-right: 0.75rem;
  fill: var(--primary);
}

.subtitle {
  color: var(--secondary);
  max-width: 600px;
  margin-top: 3rem;
  font-size: large;
  font-weight: 300;
  letter-spacing: 0.05rem;
  text-align: center;
  /* Centers the text */
  margin-left: auto;
  margin-right: auto;
}

form {
  background: var(--card-bg);
  padding: 1.5rem 1.5rem 0.5rem 1.5rem;
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  border: var(--color-border);
  margin-bottom: 2rem;
}

.input-button-container {
  margin-bottom: 0rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.combined-input {
  display: flex;
  border-radius: 8px;
  border: 1px solid var(--border);
  overflow: hidden;
  padding: 0;
  background: white;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

input {
  flex: 1;
  border: none;
  padding: 1.1rem 1rem;
  font-size: 1rem;
  background: transparent;
}

input:focus {
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--secondary);
  /* Use your CSS variable */
  opacity: 0.5;
  /* Ensures full visibility */
}

/* Dark mode support */
.dark input::placeholder,
.dark textarea::placeholder {
  color: var(--text);
  /* Adjust for dark mode */
}

button {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: var(--button-text);
  border: none;
  padding: 0 1.5rem 0 1.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s;
  white-space: nowrap;
  font-size: 15px;
}

button:hover {
  background: var(--primary-light);
  color: var(--button-text-hover);
}

.button-spinner {
  display: none;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 2s linear infinite;
}

/* This class will be added via JavaScript when loading */
button.loading .button-text {
  display: none;
}

button.loading .button-spinner {
  display: block;
}

.error {
  color: var(--error);
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.summary-section,
.empty-state {
  background: var(--card-bg);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  border: var(--color-border);
  margin-bottom: 2rem;
  overflow: hidden;
}

.summary-section {
  display: none;
}

.issue-header {
  display: flex;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.issue-icon {
  margin-right: 1rem;
}

.issue-icon svg {
  width: 28px;
  height: 28px;
  fill: var(--primary);
}

.issue-title {
  min-width: 0;
}

.issue-title h4 {
  margin-bottom: 0.5rem;
  word-wrap: break-word;
}

.issue-meta {
  display: flex;
  flex-wrap: wrap;
  font-size: 0.875rem;
  color: var(--secondary);
}

.issue-meta span {
  margin-right: 1rem;
}

.tag {
  background: var(--success);
  color: white;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

.summary-content {
  padding: 0rem;
}

.summary-block {
  margin-bottom: 0rem;
}

.summary-block h3 {
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.reaction {
  display: flex;
  align-items: center;
  padding: 0.25rem 0.5rem;
  background: var(--hover);
  border-radius: 999px;
  font-size: 0.875rem;
}

.share-row {
  display: flex;
  gap: 1rem;
  padding: 1.5rem 0 1.5rem 0;
  justify-content: center;
  align-items: center;
  border-top: 1px solid var(--border);
}

.share-button {
  display: flex;
  align-items: center;
  border-radius: 8px;
  padding: 1rem;
}

.share-button svg {
  width: 18px;
  height: 18px;
  margin-right: 0.5rem;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  stroke: var(--primary);
  margin-bottom: 1.5rem;
}

.empty-title {
  margin-bottom: 1rem;
}

.empty-text {
  max-width: 500px;
  margin: 0 auto 1.5rem;
  color: var(--secondary);
}

.sample-button {
  margin-top: 0.5rem;
}

.recent-searches,
.sample-issues {
  margin-bottom: 2rem;
}

.recent-searches h3,
.sample-issues h3 {
  margin-bottom: 1rem;
}

.search-history {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.history-item {
  font-size: 1.0rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-bg);
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border);
  min-width: 0;
  word-wrap: break-word;
  max-height: 4.0rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sample-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.sample-button {
  background: var(--hover);
  color: var(--text);
  font-weight: normal;
  font-size: 0.875rem;
}

footer {
  padding: 2rem 0;
  text-align: center;
  color: var(--secondary);
  font-size: 0.875rem;
}

.footer-links {
  margin-top: 1rem;
}

.footer-links a {
  color: var(--primary);
  text-decoration: none;
  margin: 0 0.5rem;
}

@media (max-width: 768px) {
  /* .share-row {
    flex-direction: column;
  } */

  .issue-meta {
    flex-direction: column;
  }

  .issue-meta span {
    margin-bottom: 0.25rem;
  }

  .title h1 {
    font-size: 2.2rem;
    font-weight: 700;
  }
}

/* Markdown Support */
.markdown-body {
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
  color-scheme: light;
  --color-canvas-default: #ffffff;
  --color-fg-default: #24292f;
}

/* Dark mode styles */
.markdown-body {
  box-sizing: border-box;
  min-width: 200px;
  max-width: 980px;
  margin: 0 auto;
  padding: 45px;
}

@media (max-width: 767px) {
  .markdown-body {
    padding: 15px;
  }
}

/* Apply GitHub dark theme when dark mode is active */
@media (prefers-color-scheme: dark) {
  .markdown-body {
    color-scheme: dark;
  }
}

/* OR if you're using a class to toggle dark mode */
html.dark-mode .markdown-body,
body.dark-mode .markdown-body {
  color-scheme: dark;
}

/* Loading Bar */
.loading-container {
  width: 50%;
  height: 4px;
  background: #ddd;
  margin: 10px auto 0 auto;
  /* Center align */
  border-radius: 2px;
  display: none;
  /* Initially hidden */
  overflow: hidden;
  position: relative;
}

.loading-bar {
  width: 100%;
  height: 100%;
  background: var(--primary);
  position: absolute;
  left: -30%;
  animation: loadingTrain 1.5s infinite linear;
}

@keyframes loadingTrain {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}