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

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #58a6ff;
  color: #0d1117;
  padding: 8px 16px;
  z-index: 100;
  text-decoration: none;
  font-weight: 600;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: #0d1117;
  color: #c9d1d9;
  padding: 2rem;
  line-height: 1.6;
}
/* Header with theme toggle */
.header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  position: relative;
}

h1 {
  text-align: center;
  font-size: 2.2rem;
  color: #58a6ff;
  margin-bottom: 0.3rem;
}

.theme-toggle {
  position: absolute;
  right: 0;
  background: none;
  border: 2px solid #30363d;
  border-radius: 8px;
  padding: 0.5rem;
  cursor: pointer;
  color: #8b949e;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

.theme-toggle:focus {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
}

/* Show sun icon by default (dark theme), hide moon */
.theme-toggle .icon-moon {
  display: none;
}

/* Light theme: show moon, hide sun */
body.light-theme .theme-toggle .icon-sun {
  display: none;
}

body.light-theme .theme-toggle .icon-moon {
  display: block;
}
.subtitle {
  text-align: center;
  color: #8b949e;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}
/* Search bar */
.search-container {
  max-width: 500px;
  margin: 0 auto 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 8px;
  color: #c9d1d9;
  transition: border-color 0.2s ease;
}

.search-input::placeholder {
  color: #484f58;
}

.search-input:focus {
  outline: none;
  border-color: #58a6ff;
}

.tab-bar {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 2rem;
}
.tab-btn {
  padding: 0.6rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid #30363d;
  border-radius: 8px;
  background: #161b22;
  color: #8b949e;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: inherit;
}
.tab-btn:hover {
  border-color: #58a6ff;
  color: #c9d1d9;
}
.tab-btn.active {
  background: #58a6ff;
  border-color: #58a6ff;
  color: #0d1117;
}
.section { display: none; }
.section.active { display: block; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(370px, 1fr));
  gap: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}
.card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 1.4rem;
}
.card h2 {
  font-size: 1.1rem;
  color: #58a6ff;
  border-bottom: 1px solid #30363d;
  padding-bottom: 0.5rem;
  margin-bottom: 0.8rem;
}
table { width: 100%; border-collapse: collapse; }
tr:not(:last-child) td { border-bottom: 1px solid #21262d; }
td { padding: 0.45rem 0.5rem; vertical-align: top; }
td:first-child {
  white-space: nowrap;
  width: 45%;
}
kbd {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 2px 7px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85rem;
  color: #f0883e;
}
.desc { color: #8b949e; font-size: 0.9rem; }
.note {
  background: #1c2128;
  border-left: 3px solid #58a6ff;
  padding: 0.6rem 0.8rem;
  margin-top: 0.8rem;
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: #8b949e;
}
.note strong { color: #58a6ff; }
footer {
  text-align: center;
  margin-top: 2rem;
  color: #484f58;
  font-size: 0.8rem;
}

/* Copyable command styling */
kbd.copyable {
  cursor: pointer;
  position: relative;
  transition: border-color 0.2s ease, color 0.2s ease;
}

kbd.copyable:hover {
  border-color: #58a6ff;
}

/* Toast notification for copy feedback */
.copy-toast {
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%);
  background: #3fb950;
  color: #0d1117;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-family: inherit;
  pointer-events: none;
}

/* Save button styling */
.save-cell {
  width: 32px;
  text-align: center;
  vertical-align: middle;
}

.save-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  color: #484f58;
  transition: color 0.2s ease, transform 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.save-btn svg {
  width: 16px;
  height: 16px;
}

.save-btn:hover {
  color: #58a6ff;
  transform: scale(1.1);
}

.save-btn.saved {
  color: #f0883e;
}

.save-btn.saved svg {
  fill: #f0883e;
}

.save-btn:focus {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Search empty state */
.search-empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #8b949e;
}

.search-empty-state p {
  margin: 0.5rem 0;
}

.search-empty-state strong {
  color: #f0883e;
}

/* Saved actions (export/import) */
.saved-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.action-btn {
  padding: 0.5rem 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 2px solid #30363d;
  border-radius: 6px;
  background: #161b22;
  color: #c9d1d9;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}

.action-btn:hover {
  border-color: #58a6ff;
  color: #58a6ff;
}

.action-btn:focus {
  outline: 2px solid #58a6ff;
  outline-offset: 2px;
}

/* Light theme */
body.light-theme {
  background: #f6f8fa;
  color: #24292f;
}

body.light-theme h1 {
  color: #0969da;
}

body.light-theme .subtitle {
  color: #57606a;
}

body.light-theme .search-input {
  background: #ffffff;
  border-color: #d0d7de;
  color: #24292f;
}

body.light-theme .search-input::placeholder {
  color: #8c959f;
}

body.light-theme .search-input:focus {
  border-color: #0969da;
}

body.light-theme .tab-btn {
  background: #ffffff;
  border-color: #d0d7de;
  color: #57606a;
}

body.light-theme .tab-btn:hover {
  border-color: #0969da;
  color: #24292f;
}

body.light-theme .tab-btn.active {
  background: #0969da;
  border-color: #0969da;
  color: #ffffff;
}

body.light-theme .card {
  background: #ffffff;
  border-color: #d0d7de;
}

body.light-theme .card h2 {
  color: #0969da;
  border-color: #d0d7de;
}

body.light-theme tr:not(:last-child) td {
  border-color: #d8dee4;
}

body.light-theme kbd {
  background: #f6f8fa;
  border-color: #d0d7de;
  color: #cf222e;
}

body.light-theme .desc {
  color: #57606a;
}

body.light-theme .note {
  background: #f0f6fc;
  border-color: #0969da;
  color: #57606a;
}

body.light-theme .note strong {
  color: #0969da;
}

body.light-theme footer {
  color: #8c959f;
}

body.light-theme .save-btn {
  color: #8c959f;
}

body.light-theme .save-btn:hover {
  color: #0969da;
}

body.light-theme .save-btn.saved {
  color: #cf222e;
}

body.light-theme .save-btn.saved svg {
  fill: #cf222e;
}

body.light-theme .theme-toggle {
  border-color: #d0d7de;
  color: #57606a;
}

body.light-theme .theme-toggle:hover {
  border-color: #0969da;
  color: #0969da;
}

body.light-theme .action-btn {
  background: #ffffff;
  border-color: #d0d7de;
  color: #24292f;
}

body.light-theme .action-btn:hover {
  border-color: #0969da;
  color: #0969da;
}

body.light-theme .search-empty-state {
  color: #57606a;
}

body.light-theme .search-empty-state strong {
  color: #cf222e;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  body {
    padding: 1rem;
  }

  .header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .theme-toggle {
    position: static;
  }

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

  .tab-bar {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  h1 {
    font-size: 1.8rem;
  }

  /* Allow command text to wrap on mobile */
  td:first-child {
    white-space: normal;
    width: auto;
  }

  kbd {
    word-break: break-word;
  }

  .card {
    padding: 1rem;
  }

  .search-container {
    max-width: 100%;
  }

  .saved-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-btn {
    width: 100%;
  }
}

/* Extra small screens */
@media (max-width: 480px) {
  body {
    padding: 0.75rem;
  }

  h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .tab-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  kbd {
    font-size: 0.8rem;
    padding: 1px 5px;
  }

  .desc {
    font-size: 0.85rem;
  }
}
