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

@layer utilities {
  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
  
  /* Custom scrollbar styling */
  .custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground)) hsl(var(--muted));
  }
  
  .custom-scrollbar::-webkit-scrollbar {
    height: 8px;
    width: 8px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-track {
    background: hsl(var(--muted));
    border-radius: 4px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground));
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--foreground));
  }
  
  .custom-scrollbar::-webkit-scrollbar-corner {
    background: hsl(var(--muted));
  }
}

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
  }
}

@layer base {
  * {
    @apply border-border;
  }
  body {
    @apply bg-background text-foreground;
  }
}

@layer components {
  .btn {
    @apply inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 px-4 py-2;
  }
  
  .btn-primary {
    @apply bg-primary text-primary-foreground hover:bg-primary/90;
  }
  
  .btn-secondary {
    @apply bg-secondary text-secondary-foreground hover:bg-secondary/80;
  }
  
  .btn-outline {
    @apply border border-input bg-background hover:bg-accent hover:text-accent-foreground;
  }
  
  .card {
    @apply rounded-lg border bg-card text-card-foreground shadow-sm;
  }
  
  .input {
    @apply flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50;
  }
  
  .btn-sm {
    @apply px-3 py-1.5 text-xs;
  }
  
  /* Custom prose styles for better theme integration */
  .prose-custom {
    @apply prose max-w-none;
    font-size: 0.875rem; /* 14px */
    line-height: 1.5;
  }
  
  .prose-custom p {
    font-size: 0.875rem; /* 14px */
    line-height: 1.5;
  }
  
  .prose-custom h1 {
    font-size: 1.5rem; /* 24px */
  }
  
  .prose-custom h2 {
    font-size: 1.25rem; /* 20px */
  }
  
  .prose-custom h3 {
    font-size: 1.125rem; /* 18px */
  }
  
  .prose-custom h4 {
    font-size: 1rem; /* 16px */
  }
  
  .prose-custom li {
    font-size: 0.875rem; /* 14px */
  }
  
  .prose-custom blockquote {
    font-size: 0.875rem; /* 14px */
  }
  
  .prose-custom h1,
  .prose-custom h2,
  .prose-custom h3,
  .prose-custom h4,
  .prose-custom h5,
  .prose-custom h6 {
    @apply text-foreground;
  }
  
  .prose-custom p,
  .prose-custom li,
  .prose-custom td,
  .prose-custom th {
    @apply text-foreground;
  }
  
  .prose-custom strong {
    @apply text-foreground font-semibold;
  }
  
  .prose-custom blockquote {
    @apply text-muted-foreground border-l-border;
  }
  
  .prose-custom code {
    @apply text-foreground bg-muted px-1.5 py-0.5 rounded text-sm;
  }
  
  .prose-custom pre {
    @apply bg-muted text-foreground border border-border;
  }
  
  .prose-custom pre code {
    @apply bg-transparent p-0;
  }
  
  .prose-custom a {
    @apply text-primary hover:text-primary/80;
  }
  
  .prose-custom ul,
  .prose-custom ol {
    @apply text-foreground;
  }
  
  .prose-custom hr {
    @apply border-border;
  }
  
  .prose-custom table {
    @apply border-border;
  }
  
  .prose-custom thead th {
    @apply border-border bg-muted/50;
  }
  
  .prose-custom tbody td {
    @apply border-border;
  }
  
  /* SimpleMDE custom styling */
  .CodeMirror {
    @apply bg-background text-foreground border-border;
  }
  
  .CodeMirror-cursor {
    @apply border-foreground;
  }
  
  .editor-toolbar {
    @apply border-border bg-card;
  }
  
  .editor-toolbar a {
    @apply text-muted-foreground hover:text-foreground;
  }
  
  .editor-toolbar a.active {
    @apply text-primary bg-primary/10;
  }
  
  .editor-preview {
    @apply bg-background text-foreground;
  }
  
  .editor-preview h1,
  .editor-preview h2,
  .editor-preview h3,
  .editor-preview h4,
  .editor-preview h5,
  .editor-preview h6 {
    @apply text-foreground;
  }
  
  .editor-preview p,
  .editor-preview li {
    @apply text-foreground;
  }
  
  .editor-preview blockquote {
    @apply text-muted-foreground border-l-border;
  }
  
  .editor-preview code {
    @apply bg-muted text-foreground;
  }
  
  .editor-preview pre {
    @apply bg-muted border-border;
  }
  
  /* Searchable Select Component */
  .searchable-select {
    @apply relative;
  }
  
  .searchable-select-trigger {
    @apply cursor-pointer;
  }
  
  .searchable-select-trigger:hover {
    @apply bg-accent;
  }
  
  .searchable-select-dropdown {
    @apply mt-1;
  }
  
  .searchable-select-option {
    @apply transition-colors;
  }
  
  .searchable-select-option:hover {
    @apply bg-accent text-accent-foreground;
  }
  
  .searchable-select-option.selected {
    @apply bg-primary text-primary-foreground;
  }
  
  .searchable-select-value.placeholder {
    @apply text-muted-foreground;
  }
  
  .searchable-select-value.selected {
    @apply text-foreground;
  }
  
  /* Rating stars styling */
  .star-filled {
    @apply text-yellow-500;
    fill: currentColor;
  }
  
  .star-half {
    @apply text-yellow-500;
    background: linear-gradient(90deg, #eab308 50%, #d1d5db 50%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .star-empty {
    @apply text-gray-300;
  }
}