@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* Manus-inspired warm color palette */
    --color-cream: 245 240 232;         /* Main background - warm cream */
    --color-cream-light: 250 247 242;   /* Lighter cream */
    --color-cream-dark: 235 228 218;    /* Darker cream for hover */
    
    --color-bg: 245 240 232;
    --color-bg-card: 255 255 255;
    --color-bg-elevated: 250 247 242;
    --color-bg-sidebar: 255 255 255;
    
    --color-border: 230 222 210;
    --color-border-muted: 240 235 227;
    
    --color-text: 55 48 40;              /* Warm dark brown */
    --color-text-secondary: 120 110 98;
    --color-text-muted: 165 155 140;
    
    --color-primary: 55 48 40;           /* Dark brown as primary */
    --color-primary-hover: 35 30 25;
    --color-accent: 232 121 87;          /* Warm coral accent */
    --color-accent-hover: 218 100 65;
    
    --color-success: 76 140 74;
    --color-success-bg: 240 248 240;
    
    --color-error: 200 75 75;
    --color-error-bg: 254 245 245;
    
    /* Typography */
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    
    /* Shadows - softer, warmer */
    --shadow-sm: 0 1px 3px 0 rgb(55 48 40 / 0.04);
    --shadow-md: 0 4px 12px -2px rgb(55 48 40 / 0.08);
    --shadow-lg: 0 12px 32px -4px rgb(55 48 40 / 0.12);
    --shadow-xl: 0 24px 48px -8px rgb(55 48 40 / 0.16);
    
    /* Animation */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  }

  .dark {
    --color-cream: 28 25 22;
    --color-cream-light: 35 32 28;
    --color-cream-dark: 22 20 18;
    
    --color-bg: 28 25 22;
    --color-bg-card: 38 35 30;
    --color-bg-elevated: 45 42 36;
    --color-bg-sidebar: 32 29 25;
    
    --color-border: 60 55 48;
    --color-border-muted: 50 45 40;
    
    --color-text: 245 240 232;
    --color-text-secondary: 185 175 162;
    --color-text-muted: 135 125 112;
    
    --color-primary: 245 240 232;
    --color-primary-hover: 255 255 255;
    --color-accent: 245 145 115;
    --color-accent-hover: 255 165 135;
    
    --color-success: 120 180 120;
    --color-success-bg: 35 55 35;
    
    --color-error: 230 130 130;
    --color-error-bg: 65 35 35;
    
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 12px -2px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 12px 32px -4px rgb(0 0 0 / 0.4);
    --shadow-xl: 0 24px 48px -8px rgb(0 0 0 / 0.5);
  }
  
  html {
    font-family: var(--font-sans);
  }
  
  body {
    background: rgb(var(--color-bg));
    color: rgb(var(--color-text));
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

@layer components {
  /* Manus-style card */
  .card {
    @apply bg-white dark:bg-[rgb(38,35,30)] rounded-2xl shadow-md;
    border: 1px solid rgb(var(--color-border-muted));
  }
  
  .card-elevated {
    @apply bg-white dark:bg-[rgb(38,35,30)] rounded-2xl;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgb(var(--color-border-muted));
  }
  
  /* Primary button - dark style like Manus */
  .btn-primary {
    @apply font-medium rounded-full px-5 py-2.5
           transition-all duration-200 
           disabled:opacity-50 disabled:cursor-not-allowed;
    background: rgb(var(--color-primary));
    color: rgb(var(--color-cream));
    box-shadow: var(--shadow-sm);
  }
  
  .btn-primary:hover:not(:disabled) {
    background: rgb(var(--color-primary-hover));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  
  .btn-primary:active:not(:disabled) {
    transform: translateY(0);
  }
  
  /* Secondary button */
  .btn-secondary {
    @apply font-medium rounded-full px-5 py-2.5 
           transition-all duration-200;
    background: rgb(var(--color-cream-dark));
    color: rgb(var(--color-text));
    border: 1px solid rgb(var(--color-border));
  }
  
  .btn-secondary:hover {
    background: rgb(var(--color-cream));
    box-shadow: var(--shadow-sm);
  }
  
  /* Ghost button */
  .btn-ghost {
    @apply rounded-full px-4 py-2 transition-all duration-200;
    color: rgb(var(--color-text-secondary));
  }
  
  .btn-ghost:hover {
    background: rgb(var(--color-cream-dark));
    color: rgb(var(--color-text));
  }
  
  /* Pill button - like Manus action buttons */
  .btn-pill {
    @apply inline-flex items-center gap-2 px-4 py-2.5 rounded-full
           text-sm font-medium transition-all duration-200;
    background: white;
    color: rgb(var(--color-text));
    border: 1px solid rgb(var(--color-border));
    box-shadow: var(--shadow-sm);
  }
  
  .btn-pill:hover {
    background: rgb(var(--color-cream-light));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  
  .btn-pill:active {
    transform: translateY(0);
  }
  
  /* Accent button */
  .btn-accent {
    @apply font-medium rounded-full px-5 py-2.5
           transition-all duration-200;
    background: rgb(var(--color-accent));
    color: white;
    box-shadow: var(--shadow-sm);
  }
  
  .btn-accent:hover {
    background: rgb(var(--color-accent-hover));
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
  }
  
  /* Manus-style input */
  .input-manus {
    @apply w-full px-5 py-4 rounded-2xl outline-none transition-all duration-200;
    background: white;
    color: rgb(var(--color-text));
    border: 1px solid rgb(var(--color-border));
    box-shadow: var(--shadow-sm);
  }
  
  .input-manus::placeholder {
    color: rgb(var(--color-text-muted));
  }
  
  .input-manus:focus {
    box-shadow: var(--shadow-md);
    border-color: rgb(var(--color-text-muted));
  }
  
  /* Badge styling */
  .badge {
    @apply inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-xs font-medium;
    background: rgb(var(--color-cream-dark));
    color: rgb(var(--color-text-secondary));
    border: 1px solid rgb(var(--color-border));
  }
  
  .badge-success {
    background: rgb(var(--color-success-bg));
    color: rgb(var(--color-success));
    border-color: rgb(var(--color-success) / 0.2);
  }
  
  .badge-error {
    background: rgb(var(--color-error-bg));
    color: rgb(var(--color-error));
    border-color: rgb(var(--color-error) / 0.2);
  }
  
  /* Section label */
  .section-label {
    @apply flex items-center gap-2 text-xs font-semibold uppercase tracking-wider mb-3;
    color: rgb(var(--color-text-muted));
  }
  
  /* Code block */
  .code-block {
    @apply rounded-xl overflow-hidden;
    background: white;
    border: 1px solid rgb(var(--color-border));
  }
  
  /* Sidebar styling */
  .sidebar {
    background: white;
    border-right: 1px solid rgb(var(--color-border-muted));
  }
  
  .dark .sidebar {
    background: rgb(var(--color-bg-sidebar));
  }
  
  /* Serif heading */
  .heading-serif {
    font-family: var(--font-serif);
    font-weight: 400;
    letter-spacing: -0.02em;
  }
}

/* Custom scrollbar - warm tones */
@layer utilities {
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: rgb(var(--color-border)) transparent;
  }
  
  .scrollbar-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  .scrollbar-thin::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: rgb(var(--color-border));
    border-radius: 3px;
  }
  
  .scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background-color: rgb(var(--color-text-muted));
  }
}

/* Animation keyframes */
@keyframes slide-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

@keyframes thinking-pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.6;
    transform: scale(0.92);
  }
}

@keyframes thinking-glow {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(232, 121, 87, 0.4);
  }
  50% {
    box-shadow: 0 0 8px 2px rgba(232, 121, 87, 0.3);
  }
}

.animate-slide-up {
  animation: slide-up 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

.animate-scale-in {
  animation: scale-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.animate-float {
  animation: float 3s ease-in-out infinite;
}

.animate-thinking {
  animation: thinking-pulse 1.5s ease-in-out infinite, thinking-glow 1.5s ease-in-out infinite;
}

/* Stagger animation delays */
.stagger-1 { animation-delay: 0.05s; }
.stagger-2 { animation-delay: 0.1s; }
.stagger-3 { animation-delay: 0.15s; }
.stagger-4 { animation-delay: 0.2s; }
.stagger-5 { animation-delay: 0.25s; }

/* Selection */
::selection {
  background: rgb(var(--color-accent) / 0.2);
  color: rgb(var(--color-text));
}
