/* Modern Color Palette */
:root {
  /* Primary Colors */
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --primary-blue-light: rgba(37, 99, 235, 0.1);

  /* Neutral Colors - Light Mode */
  --background: #ffffff;
  --background-secondary: #f8fafc;
  --surface: #ffffff;
  --surface-secondary: #f1f5f9;

  /* Text Colors - Light Mode */
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;

  /* Border Colors - Light Mode */
  --border-light: #e2e8f0;
  --border-medium: #cbd5e1;
  --border-focus: var(--primary-blue);

  /* Interactive States */
  --hover-overlay: rgba(0, 0, 0, 0.04);
  --focus-ring: rgba(37, 99, 235, 0.1);
}

/* Dark Mode Color Overrides */
@media (prefers-color-scheme: dark) {
  :root {
    /* Neutral Colors - Dark Mode */
    --background: #0a0a0a;
    --background-secondary: #1a1a1a;
    --surface: #1e293b;
    --surface-secondary: #334155;

    /* Text Colors - Dark Mode */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;

    /* Border Colors - Dark Mode */
    --border-light: #334155;
    --border-medium: #475569;

    /* Interactive States */
    --hover-overlay: rgba(255, 255, 255, 0.06);
    --focus-ring: rgba(37, 99, 235, 0.2);
  }
}

/* Global Styles */
body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  display: flex;
  align-items: column;
  justify-content: center;
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  width: 100%;
  max-width: 500px;
  padding: 20px;
  box-sizing: border-box;
}

header {
  margin-bottom: 20px;
}

.header-title {
  font-size: 1.7em;
  font-weight: bold;
  text-align: left;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.header-tagline {
  font-size: 1em;
  color: var(--text-secondary);
  text-align: left;
  margin-bottom: 20px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-light);
  border-top: 4px solid var(--primary-blue);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Search Bar Styles */
.search-bar {
  display: flex;
  justify-content: center;
}

.search-bar input {
  flex-grow: 1;
  padding: 12px;
  font-size: 16px;
  border: 1px solid var(--border-medium);
  border-radius: 4px 0 0 4px;
  outline: none;
  transition: all 0.2s ease;
  min-width: 300px;
  background-color: var(--surface);
  color: var(--text-primary);
}

.search-bar input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.search-bar button {
  padding: 12px 16px;
  font-size: 16px;
  border: 1px solid var(--primary-blue);
  background-color: var(--primary-blue);
  color: white;
  cursor: pointer;
  border-radius: 0 4px 4px 0;
  transition: background-color 0.2s ease;
}

.search-bar button:hover {
  background-color: var(--primary-blue-hover);
}

/* Google It Button */
.google-btn {
  padding: 6px 10px;
  font-size: 1em;
  border: none;
  background-color: var(--primary-blue);
  color: white;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
  transition: background-color 0.2s ease;
}

.google-btn:hover {
  background-color: var(--primary-blue-hover);
}

/* Shortcut Hint */
.shortcut-hint {
  margin-left: 4px;
  font-size: inherit;
  color: var(--text-tertiary);
}

/* Command List Styles */
.commands-heading {
  margin-bottom: 10px;
  font-size: 1.4em;
  font-weight: bold;
  color: var(--text-primary);
}

.command-list {
  margin-top: 10px;
}

.command-item {
  border: 1px solid var(--border-light);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background-color: var(--surface);
}

.command-title {
  background-color: var(--surface-secondary);
  padding: 10px;
  cursor: pointer;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-primary);
  transition: background-color 0.2s ease;
}

.command-title:hover {
  background-color: var(--background-secondary);
}

.arrow {
  font-size: 1em;
  margin-left: 10px;
  color: var(--text-secondary);
}

.command-details {
  padding: 10px;
  display: none;
  font-size: 0.9em;
  background-color: var(--surface);
  color: var(--text-primary);
}

.route-details {
  margin-bottom: 10px;
}

.route-details p {
  margin: 4px 0;
  color: var(--text-secondary);
}

/* Section header styles */
.section-header {
  font-size: 1.2em;
  font-weight: bold;
  margin-top: 20px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 5px;
  color: var(--text-primary);
}

/* Style section headers with custom arrow */
.section-details summary {
  list-style: none;
  position: relative;
  padding-right: 30px;
  cursor: pointer;
  color: var(--text-primary);
}

/* Hide default marker in WebKit browsers */
.section-details summary::-webkit-details-marker {
  display: none;
}

/* Add custom arrow using a pseudo-element */
.section-details summary::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: -7px;
  font-size: 1.5em;
  color: var(--text-secondary);
}

/* Change arrow when the section is open */
.section-details[open] summary::after {
  content: "▴";
}

/* Error Display Styles */
.error-container {
  text-align: center;
  margin-bottom: 20px;
  padding: 0 15px 15px 15px;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  background-color: var(--surface);
}

.error-message {
  font-size: 1em;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.error-suggestion {
  font-size: 1em;
  margin-bottom: 10px;
  color: var(--text-secondary);
}

/* Horizontal button layout for error actions */
.button-container {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

/* Standardized button style for error actions */
.error-btn {
  padding: 10px 16px;
  font-size: 0.9em;
  border: none;
  background-color: var(--primary-blue);
  color: white;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  flex: 1;
  min-width: 140px;
  transition: background-color 0.2s ease;
}

.error-btn:hover {
  background-color: var(--primary-blue-hover);
}

/* Footer Styles */
footer {
  text-align: center;
  margin-top: 20px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-secondary);
}

footer a {
  text-decoration: none;
  color: var(--primary-blue);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s ease;
}

footer a:hover {
  color: var(--primary-blue-hover);
  text-decoration: underline;
}

/* GitHub Icon */
.github-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
  .container {
    max-width: 700px;
  }
  .search-bar input {
    min-width: 400px;
  }
}

/* Enhanced Mobile Styles */
@media (max-width: 480px) {
  body {
    line-height: 1.6;
  }

  .container {
    padding: 16px;
    max-width: 100%;
  }

  /* Header improvements */
  header {
    margin-bottom: 20px;
    text-align: center;
  }

  .header-title {
    font-size: 1.8em;
    text-align: center;
    margin-bottom: -4px;
    font-weight: 600;
  }

  .header-tagline {
    text-align: center;
    font-size: 0.95em;
    margin-bottom: 16px;
    line-height: 1.4;
  }

  /* Search bar improvements */
  .search-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-bar input {
    min-width: unset;
    padding: 14px 16px;
    font-size: 16px;
    border-radius: 8px;
    border: 2px solid var(--border-medium);
    margin-bottom: 0;
  }

  .search-bar input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--focus-ring);
  }

  .search-bar button {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    background-color: var(--primary-blue);
    min-height: 48px;
  }

  .search-bar button:hover {
    background-color: var(--primary-blue-hover);
  }

  .google-btn {
    margin-top: 12px;
    padding: 10px 16px;
    font-size: 0.95em;
    font-weight: 500;
    border-radius: 6px;
  }

  /* Hide shortcut hints on mobile devices */
  .shortcut-hint {
    display: none;
  }

  /* Commands section improvements */
  .commands-heading {
    font-size: 1.4em;
    text-align: center;
    margin-bottom: 16px;
    margin-top: 32px;
    font-weight: 600;
  }

  .command-list {
    margin-top: 16px;
  }

  .command-item {
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  }

  .command-title {
    padding: 12px 16px;
    font-size: 0.95em;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
  }

  .command-details {
    padding: 12px 16px;
    font-size: 0.9em;
    line-height: 1.5;
  }

  .route-details {
    margin-bottom: 12px;
  }

  .route-details p {
    margin: 6px 0;
  }

  /* Section header improvements */
  .section-header {
    font-size: 1.2em;
    padding-bottom: 8px;
    font-weight: 600;
  }

  .section-details summary {
    font-size: 1.2em;
    font-weight: 600;
  }

  /* Error container improvements */
  .error-container {
    margin-bottom: 24px;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  }

  .error-message {
    font-size: 1.05em;
    margin-bottom: 12px;
    font-weight: 500;
    line-height: 1.4;
  }

  .error-suggestion {
    font-size: 0.95em;
    margin-bottom: 16px;
    line-height: 1.4;
  }

  .button-container {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .error-btn {
    width: 100%;
    flex: none;
    min-width: unset;
    font-size: 0.95em;
    font-weight: 600;
    padding: 12px 16px;
    min-height: 44px;
    border-radius: 6px;
  }

  /* Footer improvements */
  footer {
    margin-top: 32px;
    padding: 16px 0;
    font-size: 0.85em;
    flex-direction: column;
    gap: 8px;
  }

  /* Spinner improvements */
  .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
    margin: 0 auto 16px;
  }

  /* Dark mode mobile improvements */
  @media (prefers-color-scheme: dark) {
    .command-item {
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    .error-container {
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
  }
}
