/* CSS Utilities - Common patterns and reusable styles */


/* Common border radius values */
.rounded-sm { border-radius: 0.25rem; }
.rounded { border-radius: 0.375rem; }
.rounded-md { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-xl { border-radius: 1rem; }

/* Common transition patterns */
.transition-fast { transition: all 0.15s ease; }
.transition-normal { transition: all 0.2s ease; }
.transition-slow { transition: all 0.3s ease; }
.transition-colors { 
  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;
}

/* Common background patterns */
.bg-primary { background-color: rgb(var(--color-bg-primary)); }
.bg-secondary { background-color: rgb(var(--color-bg-secondary)); }
.bg-tertiary { background-color: rgb(var(--color-bg-tertiary)); }

/* Common text colors */
.text-primary { color: rgb(var(--color-text-primary)); }
.text-secondary { color: rgb(var(--color-text-secondary)); }
.text-muted { color: rgb(var(--color-text-muted)); }

/* Text colors with hover states */
.text-primary-hover:hover { color: rgb(var(--color-primary)); }
.text-secondary-hover:hover { color: rgb(var(--color-text-secondary)); }

/* Dark mode text colors */
.dark .text-white { color: white; }
.dark .text-primary { color: rgb(var(--color-text-primary)); }
.dark .text-secondary { color: rgb(var(--color-text-secondary)); }

/* Common border patterns */
.border-default { border: 1px solid rgb(var(--color-border)); }
.border-focus { border-color: rgb(var(--color-border-focus)); }

/* Common shadow patterns */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }

/* Common focus patterns */
.focus-ring {
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.focus-ring-primary:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgb(var(--color-primary));
}

/* Common flex patterns */
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.flex-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

/* Common spacing patterns */
.gap-xs { gap: 0.25rem; }
.gap-sm { gap: 0.5rem; }
.gap-md { gap: 0.75rem; }
.gap-lg { gap: 1rem; }

/* Common padding patterns */
.p-xs { padding: 0.25rem; }
.p-sm { padding: 0.5rem; }
.p-md { padding: 0.75rem; }
.p-lg { padding: 1rem; }
.p-xl { padding: 1.5rem; }

/* Common margin patterns */
.m-xs { margin: 0.25rem; }
.m-sm { margin: 0.5rem; }
.m-md { margin: 0.75rem; }
.m-lg { margin: 1rem; }
.m-xl { margin: 1.5rem; }

/* Common button base styles */
.btn-base {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 500;
  border-radius: 0.375rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-base:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgb(var(--color-primary));
}

/* Common input base styles */
.input-base {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid rgb(var(--color-border));
  border-radius: 0.375rem;
  background-color: rgb(var(--color-bg-primary));
  color: rgb(var(--color-text-primary));
  font-size: 0.875rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-base:focus {
  outline: 2px solid transparent;
  outline-offset: 2px;
  border-color: rgb(var(--color-primary));
  box-shadow: 0 0 0 2px rgba(var(--color-primary), 0.1);
}

/* Common card base styles */
.card-base {
  background-color: rgb(var(--color-bg-primary));
  border: 1px solid rgb(var(--color-border));
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Common modal base styles */
.modal-base {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

/* Common animation patterns */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes slideOut {
  from { transform: translateY(0); opacity: 1; }
  to { transform: translateY(-10px); opacity: 0; }
}

.animate-fade-in { animation: fadeIn 0.3s ease; }
.animate-fade-out { animation: fadeOut 0.3s ease; }
.animate-slide-in { animation: slideIn 0.3s ease; }
.animate-slide-out { animation: slideOut 0.3s ease; }


/* Loading & Status Styles */

/* Loading and status patterns */
.loading-message {
  font-size: 0.875rem;
    color: rgb(var(--color-text-muted));
}

.loading-spinner {
  animation: spin 1s linear infinite;
    border-radius: 9999px;
    height: 2rem;
    width: 2rem;
    border-bottom: 2px solid rgb(var(--color-border));
    border-color: rgb(var(--color-primary));
    margin-left: auto; margin-right: auto;
}

.loading-container {
  text-align: center;
    padding-top: 2rem; padding-bottom: 2rem;
}

  /* Cache status indicators */
  .cache-status {
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
  }

  .cache-status-success {
    color: rgb(var(--color-success-dark));
    border: 1px solid #a7f3d0;
  }

  .cache-status-warning {
    color: rgb(var(--color-warning-dark));
    border: 1px solid #fde68a;
  }

  .cache-status-error {
    color: rgb(var(--color-error-dark));
    border: 1px solid #fecaca;
  }

  .cache-status-info {
    color: rgb(var(--color-info-dark));
    border: 1px solid #bfdbfe;
  }

  .cache-status-loading {
    color: rgb(var(--color-text-muted));
    border: 1px solid #d1d5db;
  }

/* Generic loading spinner - consistent across all interfaces */
.loading-spinner {
  border-color: rgb(var(--color-primary));
  border-top-color: transparent;
}

/* HTMX Indicator Styles - Global */
.htmx-indicator {
  display: none;
}

/* Only show indicators for form submissions, not content loading */
form.htmx-request .htmx-indicator,
button.htmx-request .htmx-indicator,
input[type="submit"].htmx-request .htmx-indicator {
  display: inline;
}

/* Only hide normal text for form submissions, not content loading */
form.htmx-request .not-htmx-indicator,
button.htmx-request .not-htmx-indicator,
input[type="submit"].htmx-request .not-htmx-indicator {
  display: none;
}


/* Search highlighting styles */
.search-highlight {
  background-color: #fef3c7;
  color: #92400e;
  border-radius: 3px;
  font-weight: 600;
  padding: 0.125rem 0.25rem;
}

.dark .search-highlight {
  background-color: #0070c5;
  color: #fbbf24;
}

/* ==========================================================================
   ELEGANT SCROLLBAR STYLING
   ========================================================================== */

/* Webkit scrollbar styling for modern browsers */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(var(--color-text-muted), 0.3);
  border-radius: 4px;
  transition: background-color 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-text-muted), 0.5);
}

::-webkit-scrollbar-thumb:active {
  background: rgba(var(--color-primary), 0.6);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

/* Dark mode scrollbar styling */
.dark ::-webkit-scrollbar-thumb {
  background: rgba(var(--color-text-muted), 0.4);
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-text-muted), 0.6);
}

.dark ::-webkit-scrollbar-thumb:active {
  background: rgba(var(--color-primary), 0.7);
}

/* Firefox scrollbar styling */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--color-text-muted), 0.3) transparent;
}

.dark * {
  scrollbar-color: rgba(var(--color-text-muted), 0.4) transparent;
}

/* Smooth scrolling for better UX */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar for specific containers */
.custom-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--color-primary), 0.5) transparent;
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(var(--color-primary), 0.5);
  border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--color-primary), 0.7);
}
