@tailwind base;
@tailwind components;
@tailwind utilities;

/* Import component-specific styles */
@import "spine_viewer.css";
@import "components/dialog.css";
@import "components/forms.css";
@import "google_drive_folder_browser.css";
@import "google_drive_browser_dark.css";
@import "gallery_sidebar.css";
@import "gallery_dark_theme.css";

/* Panel resize styles */
.resize-handle-vertical {
  position: relative;
  cursor: col-resize;
  user-select: none;
  transition: background-color 0.2s;
}

.resize-handle-vertical:hover {
  background-color: #4a5058;
}

.panel-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}

.panel-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

/* Image card selected state */
.image-card.selected {
  border-color: #5b6edb;
  box-shadow: 0 0 0 2px rgba(91, 110, 219, 0.3);
}

/* Checkbox styling for multi-select */
.image-card input[type="checkbox"]:checked + span {
  background-color: #5b6edb;
  border-color: #5b6edb;
}

/* shadcn/ui CSS variables */
@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.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --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: 220 26% 14%;
    --foreground: 213 31% 91%;
    --card: 222 25% 18%;
    --card-foreground: 213 31% 91%;
    --popover: 222 25% 18%;
    --popover-foreground: 213 31% 91%;
    --primary: 245 58% 51%;
    --primary-foreground: 210 40% 98%;
    --secondary: 224 25% 23%;
    --secondary-foreground: 213 31% 91%;
    --muted: 223 23% 21%;
    --muted-foreground: 215 20% 65%;
    --accent: 245 58% 51%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62% 30%;
    --destructive-foreground: 210 40% 98%;
    --border: 223 23% 23%;
    --input: 223 23% 23%;
    --ring: 245 58% 51%;
  }
}

/* Custom scrollbar styles */
@layer utilities {
  /* Custom Scrollbar */
  .scrollbar-thin {
    scrollbar-width: thin;
  }
  
  .scrollbar-thumb-border::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  .scrollbar-thumb-border::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .scrollbar-thumb-border::-webkit-scrollbar-thumb {
    background-color: hsl(var(--border));
    border-radius: 4px;
  }
  
  .scrollbar-thumb-border::-webkit-scrollbar-thumb:hover {
    background-color: hsl(var(--muted-foreground) / 0.3);
  }
  
  /* Custom scrollbar for dark theme */
  .custom-scrollbar {
    scrollbar-width: thin;
    scrollbar-color: #3a3f47 transparent;
  }
  
  .custom-scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background-color: #3a3f47;
    border-radius: 3px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background-color: #4a5058;
  }

  /* Panel resizing */
  body.panel-resizing {
    cursor: col-resize !important;
    user-select: none !important;
  }

  body.panel-resizing * {
    cursor: col-resize !important;
    user-select: none !important;
  }

  .resize-handle-vertical {
    position: relative;
    flex-shrink: 0;
  }

  .resize-handle-vertical::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 30px;
    background-color: #4a5058;
    border-radius: 1px;
    opacity: 0;
    transition: opacity 0.2s;
  }

  .resize-handle-vertical:hover::after {
    opacity: 1;
  }
  
  /* Backdrop blur utilities */
  .backdrop-blur-sm { backdrop-filter: blur(4px); }
  .backdrop-blur { backdrop-filter: blur(8px); }
  .backdrop-blur-md { backdrop-filter: blur(12px); }
  .backdrop-blur-lg { backdrop-filter: blur(16px); }
  .backdrop-blur-xl { backdrop-filter: blur(24px); }
}

/* Custom button animations */
@layer components {
  /* Subtle button hover effects */
  .btn-subtle {
    @apply transition-all duration-200 ease-out;
  }
  
  .btn-subtle:hover {
    @apply shadow-sm;
  }
  
  .btn-subtle:active {
    @apply scale-[0.98];
  }
  
  /* Card hover effects */
  .card-hover {
    @apply transition-all duration-300 ease-out;
  }
  
  .card-hover:hover {
    @apply -translate-y-0.5 shadow-lg;
  }
  
  /* Focus visible styles */
  .focus-ring {
    @apply focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background;
  }
  
  /* Asset Manager specific styles */
  .asset-manager-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  }
  
  /* Tree item hover effects */
  .tree-item-content {
    transition: background-color 150ms ease, opacity 150ms ease;
  }
  
  /* Panel resize cursor */
  .panel-resizing {
    user-select: none;
    cursor: ew-resize !important;
  }
  
  .panel-resizing * {
    cursor: ew-resize !important;
  }
  
  /* Image card effects */
  .image-card {
    transition: all 200ms ease;
  }
  
  .folder-card {
    transition: all 200ms ease;
  }
  
  /* Custom focus styles for dark theme */
  input:focus,
  select:focus,
  textarea:focus {
    outline: none;
  }
}

/* Custom utility classes for shadcn/ui */
@layer utilities {
  /* Colors */
  .border-border { border-color: hsl(var(--border)); }
  .bg-background { background-color: hsl(var(--background)); }
  .bg-card { background-color: hsl(var(--card)); }
  .bg-primary { background-color: hsl(var(--primary)); }
  .bg-secondary { background-color: hsl(var(--secondary)); }
  .bg-muted { background-color: hsl(var(--muted)); }
  .bg-accent { background-color: hsl(var(--accent)); }
  .bg-destructive { background-color: hsl(var(--destructive)); }
  .text-foreground { color: hsl(var(--foreground)); }
  .text-card-foreground { color: hsl(var(--card-foreground)); }
  .text-primary-foreground { color: hsl(var(--primary-foreground)); }
  .text-secondary-foreground { color: hsl(var(--secondary-foreground)); }
  .text-muted-foreground { color: hsl(var(--muted-foreground)); }
  .text-accent-foreground { color: hsl(var(--accent-foreground)); }
  .text-destructive-foreground { color: hsl(var(--destructive-foreground)); }
  .text-primary { color: hsl(var(--primary)); }
  .ring-primary { --tw-ring-color: hsl(var(--primary)); }
  .ring-offset-background { --tw-ring-offset-color: hsl(var(--background)); }
  
  /* Layout */
  .container { width: 100%; margin-right: auto; margin-left: auto; padding-right: 2rem; padding-left: 2rem; }
  @media (min-width: 1400px) { .container { max-width: 1400px; } }
  
  /* Flexbox */
  .flex { display: flex; }
  .flex-col { flex-direction: column; }
  .flex-wrap { flex-wrap: wrap; }
  .items-center { align-items: center; }
  .items-start { align-items: flex-start; }
  .justify-between { justify-content: space-between; }
  .justify-center { justify-content: center; }
  .justify-end { justify-content: flex-end; }
  
  /* Grid */
  .grid { display: grid; }
  .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
  .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .gap-4 { gap: 1rem; }
  .gap-6 { gap: 1.5rem; }
  .gap-8 { gap: 2rem; }
  
  /* Spacing */
  .p-4 { padding: 1rem; }
  .p-6 { padding: 1.5rem; }
  .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
  .px-4 { padding-left: 1rem; padding-right: 1rem; }
  .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
  .mb-2 { margin-bottom: 0.5rem; }
  .mb-4 { margin-bottom: 1rem; }
  .mb-6 { margin-bottom: 1.5rem; }
  .mb-8 { margin-bottom: 2rem; }
  .mt-1 { margin-top: 0.25rem; }
  .mt-2 { margin-top: 0.5rem; }
  .ml-2 { margin-left: 0.5rem; }
  .mr-2 { margin-right: 0.5rem; }
  .space-y-2 > * + * { margin-top: 0.5rem; }
  .space-y-4 > * + * { margin-top: 1rem; }
  .space-x-2 > * + * { margin-left: 0.5rem; }
  .space-x-4 > * + * { margin-left: 1rem; }
  
  /* Typography */
  .text-xs { font-size: 0.75rem; line-height: 1rem; }
  .text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .text-base { font-size: 1rem; line-height: 1.5rem; }
  .text-lg { font-size: 1.125rem; line-height: 1.75rem; }
  .text-xl { font-size: 1.25rem; line-height: 1.75rem; }
  .text-2xl { font-size: 1.5rem; line-height: 2rem; }
  .text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
  .text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  .font-medium { font-weight: 500; }
  .font-semibold { font-weight: 600; }
  .font-bold { font-weight: 700; }
  .tracking-tight { letter-spacing: -0.025em; }
  
  /* Borders */
  .border { border-width: 1px; }
  .border-2 { border-width: 2px; }
  .border-b { border-bottom-width: 1px; }
  .rounded { border-radius: 0.25rem; }
  .rounded-md { border-radius: calc(var(--radius) - 2px); }
  .rounded-lg { border-radius: var(--radius); }
  .rounded-xl { border-radius: 0.75rem; }
  
  /* Shadows */
  .shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
  .shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); }
  .shadow-lg { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
  
  /* Effects */
  .opacity-0 { opacity: 0; }
  .opacity-50 { opacity: 0.5; }
  .opacity-100 { opacity: 1; }
  .transition-all { transition-property: all; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
  .transition-opacity { transition-property: opacity; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; }
  .duration-200 { transition-duration: 200ms; }
  .duration-300 { transition-duration: 300ms; }
  
  /* Positioning */
  .relative { position: relative; }
  .absolute { position: absolute; }
  .fixed { position: fixed; }
  .top-0 { top: 0; }
  .top-2 { top: 0.5rem; }
  .right-0 { right: 0; }
  .right-2 { right: 0.5rem; }
  .bottom-0 { bottom: 0; }
  .left-0 { left: 0; }
  .inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
  .z-10 { z-index: 10; }
  
  /* Display */
  .block { display: block; }
  .inline { display: inline; }
  .inline-block { display: inline-block; }
  .hidden { display: none; }
  
  /* Width/Height */
  .w-full { width: 100%; }
  .w-4 { width: 1rem; }
  .w-5 { width: 1.25rem; }
  .h-4 { height: 1rem; }
  .h-5 { height: 1.25rem; }
  .h-48 { height: 12rem; }
  .max-w-7xl { max-width: 80rem; }
  
  /* Overflow */
  .overflow-hidden { overflow: hidden; }
  .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  
  /* Hover States */
  .hover\:shadow-lg:hover { box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); }
  .hover\:scale-\[1\.02\]:hover { transform: scale(1.02); }
  .hover\:opacity-100:hover { opacity: 1; }
  .group:hover .group-hover\:opacity-100 { opacity: 1; }
  
  /* Focus States */
  .focus\:ring-2:focus { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
  .focus\:ring-primary:focus { --tw-ring-color: hsl(var(--primary)); }
  .focus\:ring-offset-2:focus { --tw-ring-offset-width: 2px; }
  
  /* Ring */
  .ring-2 { --tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color); --tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color); box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000); }
  
  /* Responsive */
  @media (min-width: 640px) {
    .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sm\:text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
  }
  
  @media (min-width: 768px) {
    .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .md\:flex-row { flex-direction: row; }
  }
  
  @media (min-width: 1024px) {
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
  
  @media (min-width: 1280px) {
    .xl\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  }
  
  @media (min-width: 1536px) {
    .\32xl\:grid-cols-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  }
}