@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap');

@import "tailwindcss";

/* TailwindCSS v4 dark mode variant configuration */
@custom-variant dark (&:where(.dark, .dark *));

/* Global theme transition consistency */
:root {
  --theme-transition-duration: 200ms;
  --theme-transition-timing: ease-in-out;
  --highlight-transition-duration: 1.5s;
  --highlight-transition-timing: ease-out;
}

/* Global theme transition classes */
.theme-transition {
  transition:
    background-color var(--theme-transition-duration) var(--theme-transition-timing),
    border-color var(--theme-transition-duration) var(--theme-transition-timing),
    color var(--theme-transition-duration) var(--theme-transition-timing),
    fill var(--theme-transition-duration) var(--theme-transition-timing),
    stroke var(--theme-transition-duration) var(--theme-transition-timing),
    box-shadow var(--theme-transition-duration) var(--theme-transition-timing);
}

.theme-transition-colors {
  transition:
    background-color var(--theme-transition-duration) var(--theme-transition-timing),
    border-color var(--theme-transition-duration) var(--theme-transition-timing),
    color var(--theme-transition-duration) var(--theme-transition-timing);
}

.theme-transition-bg {
  transition: background-color var(--theme-transition-duration) var(--theme-transition-timing);
}

/* Override Tailwind's default transition utilities to use consistent timing */
.transition-colors {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: var(--theme-transition-timing);
  transition-duration: var(--theme-transition-duration);
}

.transition-opacity {
  transition-property: opacity;
  transition-timing-function: var(--theme-transition-timing);
  transition-duration: var(--theme-transition-duration);
}

.transition-transform {
  transition-property: transform;
  transition-timing-function: var(--theme-transition-timing);
  transition-duration: var(--theme-transition-duration);
}

.transition-all {
  transition-property: all;
  transition-timing-function: var(--theme-transition-timing);
  transition-duration: var(--theme-transition-duration);
}

.transition {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
  transition-timing-function: var(--theme-transition-timing);
  transition-duration: var(--theme-transition-duration);
}

/* Custom component styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  transition:
    background-color var(--theme-transition-duration) var(--theme-transition-timing),
    border-color var(--theme-transition-duration) var(--theme-transition-timing),
    color var(--theme-transition-duration) var(--theme-transition-timing),
    opacity var(--theme-transition-duration) var(--theme-transition-timing),
    transform var(--theme-transition-duration) var(--theme-transition-timing);
  cursor: pointer;
}

.btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

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

.btn-primary {
  background-color: #3b82f6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #2563eb;
}

.card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.dark .card {
  background-color: #1f2937;
  border-color: #374151;
}

/* Form styles */
.form-input {
  display: block;
  width: 100%;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: white;
}

.form-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

.dark .form-input {
  background-color: #1f2937;
  border-color: #4b5563;
  color: white;
}

.dark .form-input:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px #60a5fa;
}

/* Search box and input field dark mode styling */
.dark input[type="search"],
.dark input[type="text"],
.dark .search-input {
  background-color: #1f2937;
  border: 1px solid #4b5563;
  color: #f9fafb;
}

.dark input[type="search"]:focus,
.dark input[type="text"]:focus,
.dark .search-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 1px #3b82f6;
}

/* Placeholder text styling for dark mode */
.dark input::placeholder {
  color: #9ca3af;
}

/* Fix GlobalSearch component focus border issue */
.dark input[type="text"]:focus {
  border-color: #3b82f6 !important;
}

/* Select dropdown styling for dark mode */
.dark select {
  background-color: #1f2937;
  border: 1px solid #4b5563;
  color: #f9fafb;
}

.dark select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 1px #3b82f6 !important;
}

/* Fix dropdown/select component white border in dark mode */
.dark .relative>div,
.dark .dropdown,
.dark [role="listbox"],
.dark [role="combobox"] {
  border-color: #4b5563 !important;
}

.dark .relative>div:focus,
.dark .dropdown:focus,
.dark [role="listbox"]:focus,
.dark [role="combobox"]:focus {
  border-color: #3b82f6 !important;
}

/* HeadlessUI specific styling for dark mode */
.dark .headlessui-listbox-button {
  border-color: #4b5563 !important;
}

.dark .headlessui-listbox-button:focus {
  border-color: #3b82f6 !important;
}

/* Fix focus ring white border issue for both light and dark modes */
button:focus {
  --tw-ring-offset-width: 0px !important;
  --tw-ring-width: 2px !important;
  --tw-ring-color: rgb(59 130 246 / 0.5) !important;
  border-color: #3b82f6 !important;
}

/* Specifically target the project selector button for both modes */
.relative>button:focus {
  --tw-ring-offset-width: 0px !important;
  --tw-ring-offset-color: transparent !important;
  border-color: #3b82f6 !important;
}

/* Dark mode specific overrides */
.dark button:focus {
  --tw-ring-color: rgb(59 130 246 / 0.5) !important;
  border-color: #3b82f6 !important;
}

/* Override focus:border-transparent in components */
.dark *:focus {
  border-color: #3b82f6 !important;
}

/* Loading spinner */
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid #e5e7eb;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* Dark theme */
.dark {
  color-scheme: dark;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f3f4f6;
}

::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

.dark ::-webkit-scrollbar-track {
  background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Hide scrollbar while maintaining scroll functionality */
.scrollbar-hide {
  -ms-overflow-style: none;
  /* Internet Explorer 10+ */
  scrollbar-width: none;
  /* Firefox */
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
  /* Safari and Chrome */
}

/* Firestore-specific utility classes */
/* Form inputs and controls */
.firestore-input {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white;
}

.firestore-textarea {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white resize-none;
}

.firestore-select {
  @apply w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white;
}

/* Button styles */
.firestore-btn-icon {
  @apply p-2 rounded-md min-h-[44px] min-w-[44px] sm:p-0 sm:min-h-0 sm:min-w-0;
  transition: color var(--theme-transition-duration) var(--theme-transition-timing),
    background-color var(--theme-transition-duration) var(--theme-transition-timing);
}

.firestore-btn-icon-small {
  @apply p-1;
  transition: color var(--theme-transition-duration) var(--theme-transition-timing),
    background-color var(--theme-transition-duration) var(--theme-transition-timing);
}

.firestore-hover-gray {
  @apply text-gray-400 hover:text-gray-600 dark:hover:text-gray-200;
}

.firestore-hover-gray-bg {
  @apply hover:bg-gray-100 dark:hover:bg-gray-700;
}

.firestore-hover-blue {
  @apply text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300;
}

.firestore-hover-red {
  @apply text-red-600 dark:text-red-400 hover:text-red-800 dark:hover:text-red-300;
}

/* Row hover effects */
.firestore-row-hover {
  @apply hover:bg-gray-50 dark:hover:bg-gray-700/50;
  transition: background-color var(--theme-transition-duration) var(--theme-transition-timing);
}

/* Focus and interaction states */
.firestore-focus-blue {
  @apply focus:outline-none focus:ring-2 focus:ring-blue-500;
}

/* Null value display */
.firestore-null-value {
  @apply px-3 py-2 bg-gray-100 dark:bg-gray-600 rounded-md text-sm text-gray-500 dark:text-gray-400 italic;
}