:root {
  --background: 231 60% 94%;
  --foreground: 231 48% 18%;
  --card: 231 60% 99%;
  --card-foreground: 231 48% 18%;
  --primary: 231 48% 48%;
  --primary-foreground: 231 60% 98%;
  --secondary: 231 50% 88%;
  --secondary-foreground: 231 48% 28%;
  --muted: 231 50% 88%;
  --muted-foreground: 231 40% 45%;
  --accent: 36 100% 50%;
  --accent-foreground: 36 100% 10%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 231 40% 85%;
  --input: 231 40% 88%;
  --ring: 231 48% 48%;
  --radius: 0.5rem;
}

.dark {
  --background: 231 20% 12%;
  --foreground: 231 60% 94%;
  --card: 231 20% 16%;
  --card-foreground: 231 60% 94%;
  --primary: 231 48% 58%;
  --primary-foreground: 231 48% 18%;
  --secondary: 231 20% 20%;
  --secondary-foreground: 231 60% 94%;
  --muted: 231 20% 20%;
  --muted-foreground: 231 30% 65%;
  --accent: 36 100% 55%;
  --accent-foreground: 36 100% 10%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 0 0% 98%;
  --border: 231 20% 25%;
  --input: 231 20% 25%;
  --ring: 231 48% 58%;
}

* {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

body {
  font-family: 'Inter', sans-serif;
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  flex-grow: 1;
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 3rem 1rem;
}

header {
  text-align: center;
  margin-bottom: 3rem;
}

header .logo-container {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

header h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: hsl(var(--primary));
  margin: 0;
  letter-spacing: -0.025em;
}

header p {
  color: hsl(var(--muted-foreground));
  margin-top: 1rem;
  font-size: 1.125rem;
}

header .links {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
}

header a {
  color: hsl(var(--primary));
  text-decoration: underline;
}

.grid-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: start;
}

@media (min-width: 1024px) {
  .grid-layout {
    grid-template-columns: 1fr 2fr;
  }
}

.card {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  padding: 1.5rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.card-description {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

input, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  background-color: transparent;
  color: hsl(var(--foreground));
  font-family: inherit;
}

input:focus, textarea:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 1px hsl(var(--ring));
}

textarea {
  resize: vertical;
}

textarea.no-resize {
  resize: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  border: none;
  transition: opacity 0.2s;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-accent {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}

.btn-accent:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-outline {
  background-color: transparent;
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
}

.btn-outline:hover:not(:disabled) {
  background-color: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
  border-color: hsl(var(--accent));
}

.btn-ghost {
  background-color: transparent;
  color: hsl(var(--foreground));
}

.btn-ghost:hover:not(:disabled) {
  background-color: hsl(var(--accent) / 0.1);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  width: auto;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th {
  text-align: left;
  padding: 0.75rem;
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  border-bottom: 1px solid hsl(var(--border));
}

td {
  padding: 0.75rem;
  border-bottom: 1px solid hsl(var(--border));
}

td a {
  color: hsl(var(--primary));
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

td a:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: hsl(var(--muted-foreground));
}

details {
  margin-top: 1rem;
}

summary {
  cursor: pointer;
  padding: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  user-select: none;
  color: hsl(var(--foreground));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

summary:hover {
  background-color: hsl(var(--accent) / 0.1);
  border-radius: var(--radius);
}

details[open] summary {
  margin-bottom: 1rem;
}

.form-description {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.form-error {
  font-size: 0.75rem;
  color: hsl(var(--destructive));
  margin-top: 0.25rem;
}

.error-card {
  margin-top: 2rem;
  border-color: hsl(var(--destructive) / 0.5);
}

.error-title {
  color: hsl(var(--destructive));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.error-textarea {
  background-color: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.3);
  font-family: monospace;
  font-size: 0.75rem;
}

.spinner {
  animation: spin 1s linear infinite;
}

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

#toast-container {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 50;
}

.toast {
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  min-width: 300px;
  transform: translateX(100%);
  animation: slideIn 0.2s forwards;
  position: relative;
}

.toast.destructive {
  background-color: hsl(var(--destructive));
  color: hsl(var(--destructive-foreground));
  border-color: hsl(var(--destructive));
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.toast-desc {
  font-size: 0.875rem;
  opacity: 0.9;
}

.toast-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.5;
}

.toast-close:hover {
  opacity: 1;
}

@keyframes slideIn {
  to { transform: translateX(0); }
}

@keyframes slideOut {
  to { transform: translateX(100%); opacity: 0; }
}

footer {
  text-align: center;
  padding: 1rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

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