/* shadcn/ui inspired components for Django */
:root {
  --background: 0 0% 100%;
  --foreground: 224 71.4% 4.1%;
  --card: 0 0% 100%;
  --card-foreground: 224 71.4% 4.1%;
  --popover: 0 0% 100%;
  --popover-foreground: 224 71.4% 4.1%;
  --primary: 262.1 83.3% 57.8%;
  --primary-foreground: 210 20% 98%;
  --secondary: 220 14.3% 95.9%;
  --secondary-foreground: 220.9 39.3% 11%;
  --muted: 220 14.3% 95.9%;
  --muted-foreground: 220 8.9% 46.1%;
  --accent: 220 14.3% 95.9%;
  --accent-foreground: 220.9 39.3% 11%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 210 20% 98%;
  --border: 220 13% 91%;
  --input: 220 13% 91%;
  --ring: 262.1 83.3% 57.8%;
  --radius: 0.5rem;
}

.dark {
  --background: 224 71.4% 4.1%;
  --foreground: 210 20% 98%;
  --card: 224 71.4% 4.1%;
  --card-foreground: 210 20% 98%;
  --popover: 224 71.4% 4.1%;
  --popover-foreground: 210 20% 98%;
  --primary: 263.4 70% 50.4%;
  --primary-foreground: 210 20% 98%;
  --secondary: 215 27.9% 16.9%;
  --secondary-foreground: 210 20% 98%;
  --muted: 215 27.9% 16.9%;
  --muted-foreground: 217.9 10.6% 64.9%;
  --accent: 215 27.9% 16.9%;
  --accent-foreground: 210 20% 98%;
  --destructive: 0 62.8% 30.6%;
  --destructive-foreground: 210 20% 98%;
  --border: 215 27.9% 16.9%;
  --input: 215 27.9% 16.9%;
  --ring: 263.4 70% 50.4%;
}

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

body {
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  font-feature-settings: "rlig" 1, "calt" 1;
}

/* Button Component */
.btn-shadcn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  padding: 0.5rem 1rem;
  height: 2.25rem;
  border: none;
  cursor: pointer;
}

.btn-shadcn:focus-visible {
  outline: none;
  ring: 1px solid hsl(var(--ring));
}

.btn-shadcn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

.btn-shadcn:hover {
  background-color: hsl(var(--primary) / 0.9);
}

.btn-shadcn-outline {
  @apply inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50;
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0.5rem 1rem;
  height: 2.25rem;
}

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

.btn-shadcn-ghost {
  @apply inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50;
  color: hsl(var(--foreground));
  padding: 0.5rem 1rem;
  height: 2.25rem;
}

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

/* Card Component */
.card-shadcn {
  border-radius: 0.5rem;
  background-color: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.card-header {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.card-header > * + * {
  margin-top: 0.375rem;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

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

.card-content {
  padding: 1.5rem;
  padding-top: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 1.5rem;
  padding-top: 0;
}

/* Input Component */
.input-shadcn {
  display: flex;
  height: 2.5rem;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-shadcn::placeholder {
  color: hsl(var(--muted-foreground));
}

.input-shadcn:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

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

/* Label Component */
.label-shadcn {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
  display: block;
}

/* Badge Component */
.badge-shadcn {
  @apply inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  border: 1px solid transparent;
}

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

.badge-secondary {
  background-color: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

/* Avatar Component */
.avatar-shadcn {
  @apply relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full;
}

.avatar-image {
  @apply aspect-square h-full w-full object-cover;
}

.avatar-fallback {
  @apply flex h-full w-full items-center justify-center rounded-full bg-muted;
  background-color: hsl(var(--muted));
  color: hsl(var(--muted-foreground));
}

/* Separator Component */
.separator-shadcn {
  @apply shrink-0 bg-border;
  background-color: hsl(var(--border));
  height: 1px;
  width: 100%;
}

.separator-vertical {
  height: 100%;
  width: 1px;
}

/* Textarea Component */
.textarea-shadcn {
  display: flex;
  min-height: 80px;
  width: 100%;
  border-radius: 0.375rem;
  border: 1px solid hsl(var(--input));
  background-color: hsl(var(--background));
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--foreground));
  transition: border-color 0.2s, box-shadow 0.2s;
  resize: vertical;
}

.textarea-shadcn::placeholder {
  color: hsl(var(--muted-foreground));
}

.textarea-shadcn:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 2px hsl(var(--ring) / 0.2);
}

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

/* Select Component */
.select-shadcn {
  @apply flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50;
  background-color: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  color: hsl(var(--foreground));
}

/* Utility Classes */
.text-muted-foreground {
  color: hsl(var(--muted-foreground));
}

.bg-muted {
  background-color: hsl(var(--muted));
}

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

.border-input {
  border-color: hsl(var(--input));
}

/* Form Styles */
.form-group {
  margin-bottom: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .form-row {
    grid-template-columns: 1fr 1fr;
  }
}

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

.form-section > * + * {
  margin-top: 1rem;
}

/* ChatGPT-like container */
.chatgpt-container {
  max-width: 768px;
  margin: 0 auto;
  padding: 1rem;
}

/* Message bubble styles */
.message-bubble {
  @apply rounded-2xl p-4 mb-4 max-w-[85%] break-words;
}

.message-user {
  @apply ml-auto bg-primary text-primary-foreground;
  background-color: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.message-assistant {
  @apply mr-auto bg-muted;
  background-color: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Loading animation */
.loading-dots {
  @apply flex space-x-1;
}

.loading-dot {
  @apply w-2 h-2 bg-muted-foreground rounded-full animate-pulse;
}

.loading-dot:nth-child(1) { animation-delay: 0s; }
.loading-dot:nth-child(2) { animation-delay: 0.2s; }
.loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Form styling */
.form-group {
  @apply mb-4;
}

.form-row {
  @apply grid grid-cols-1 md:grid-cols-2 gap-4;
}

.form-row-3 {
  @apply grid grid-cols-1 md:grid-cols-3 gap-4;
}

/* Hero section */
.hero-gradient {
  background: linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary) / 0.8) 100%);
}

/* Animated background */
.animated-bg {
  background: linear-gradient(-45deg, hsl(var(--primary)), hsl(var(--primary) / 0.8), hsl(var(--accent)), hsl(var(--muted)));
  background-size: 400% 400%;
  animation: gradient 15s ease infinite;
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Responsive utilities */
@media (max-width: 768px) {
  .chatgpt-container {
    padding: 0.5rem;
  }
  
  .message-bubble {
    max-width: 95%;
  }
}