:root {
  --bg: #0B1120;
  --card: #111827;
  --primary: #3B82F6;
  --secondary: #8B5CF6;
  --accent: #14B8A6;
  --border: rgba(255, 255, 255, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg);
  color: #e2e8f0;
}

/* Glassmorphism cards */
.glass-card {
  background: rgba(17, 24, 39, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.12);
}

/* Category cards */
.category-card {
  background: rgba(17, 24, 39, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(139, 92, 246, 0.08));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.category-card:hover::before,
.category-card.selected::before {
  opacity: 1;
}

.category-card:hover {
  transform: translateY(-4px);
  border-color: rgba(59, 130, 246, 0.5);
  box-shadow: 0 12px 40px rgba(59, 130, 246, 0.18);
}

.category-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25), 0 12px 40px rgba(59, 130, 246, 0.2);
}

.category-card .icon-wrapper {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.3s ease;
}

.category-card:hover .icon-wrapper,
.category-card.selected .icon-wrapper {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
}

/* Form inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="url"],
textarea,
select {
  background: rgba(11, 17, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f8fafc;
  border-radius: 0.75rem;
  padding: 0.75rem 1rem;
  width: 100%;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: #64748b;
}

/* Option chips */
.option-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}

.option-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.option-chip.selected {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
  color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.option-chip i {
  width: 14px;
  height: 14px;
}

/* Toggle switch */
.toggle-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
}

.toggle-switch input {
  appearance: none;
  width: 44px;
  height: 24px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  position: relative;
  transition: background 0.2s ease;
  cursor: pointer;
}

.toggle-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked {
  background: var(--primary);
}

.toggle-switch input:checked::after {
  transform: translateX(20px);
}

/* Buttons */
button {
  cursor: pointer;
  transition: all 0.2s ease;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Version / language pills */
.pill-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.pill-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.pill-btn.active {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
  color: #60a5fa;
}

/* History / favorite cards */
.history-card {
  background: rgba(17, 24, 39, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1rem;
  padding: 1.25rem;
  transition: all 0.2s ease;
  backdrop-filter: blur(12px);
}

.history-card:hover {
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.history-card .tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Animations */
@keyframes pulse-slow {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

.animate-pulse-slow {
  animation: pulse-slow 8s ease-in-out infinite;
}

.view-enter {
  animation: viewEnter 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes viewEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-enter {
  animation: stepEnter 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes stepEnter {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Modal */
#modal {
  transition: opacity 0.2s ease;
}

#modal:not(.hidden) {
  display: flex;
}

/* Toast */
#toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Admin */
.admin-tab-btn.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
}

.admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-row:hover {
  background: rgba(255, 255, 255, 0.06);
}

/* Prose overrides for result */
.prose-invert h1,
.prose-invert h2,
.prose-invert h3,
.prose-invert h4 {
  color: #f8fafc;
  margin-top: 1.5em;
  margin-bottom: 0.6em;
}

.prose-invert p {
  margin-bottom: 0.75em;
  color: #cbd5e1;
}

.prose-invert ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose-invert ol {
  list-style: decimal;
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose-invert li {
  margin-bottom: 0.35rem;
  color: #cbd5e1;
}

.prose-invert strong {
  color: #e2e8f0;
  font-weight: 600;
}

.prose-invert code {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.9em;
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .category-card {
    padding: 1rem 0.5rem;
  }

  .category-card .icon-wrapper {
    width: 40px;
    height: 40px;
  }

  .category-card .cat-title {
    font-size: 0.85rem;
  }
}

/* Selection color */
::selection {
  background: rgba(59, 130, 246, 0.35);
  color: white;
}
