/* Firefox-Specific Rendering Compatibility Styles */

/* Firefox font rendering adjustments */
body {
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Firefox backdrop-filter support with fallback */
.app-container {
  /* Firefox supports backdrop-filter but may need vendor prefix in older versions */
  backdrop-filter: blur(var(--backdrop-blur, 10px));
  -webkit-backdrop-filter: blur(var(--backdrop-blur, 10px));
}

/* Firefox glassmorphism adjustments */
.header,
.settings-panel,
.note-editor {
  backdrop-filter: blur(var(--backdrop-blur, 10px));
  -webkit-backdrop-filter: blur(var(--backdrop-blur, 10px));
}

/* Firefox scrollbar styling (uses different syntax than Chrome) */
.notes-list {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

.settings-content {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) transparent;
}

/* Firefox input rendering fixes */
.search-input,
.note-title-header,
.tags-input,
.settings-input {
  /* Ensure consistent font rendering in Firefox */
  -moz-osx-font-smoothing: grayscale;
}

/* Firefox button rendering consistency */
button,
.icon-btn,
.add-note-btn,
.save-btn {
  /* Firefox button appearance normalization */
  -moz-appearance: none;
  appearance: none;
}

/* Firefox select dropdown styling */
.settings-select {
  -moz-appearance: none;
  appearance: none;
}

/* Firefox-specific focus outline improvements */
*:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Firefox popup dimensions enforcement */
html,
body {
  min-width: 380px;
  max-width: 380px;
  min-height: 600px;
  max-height: 600px;
}

/* Firefox text selection styling */
::selection {
  background-color: var(--accent-primary);
  color: white;
}

::-moz-selection {
  background-color: var(--accent-primary);
  color: white;
}

/* Firefox placeholder styling consistency */
::placeholder {
  opacity: 0.6;
}

::-moz-placeholder {
  opacity: 0.6;
}

/* Firefox range input (slider) styling */
input[type="range"]::-moz-range-track {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  height: 4px;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: none;
  box-shadow: 0 1px 2px var(--shadow-dark);
  cursor: pointer;
}

/* Firefox color input styling */
input[type="color"] {
  -moz-appearance: none;
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
}

/* Firefox contenteditable styling */
[contenteditable="true"] {
  -moz-user-select: text;
  user-select: text;
}

/* Firefox animation performance optimization */
@media (prefers-reduced-motion: no-preference) {
  * {
    /* Enable GPU acceleration for smoother animations in Firefox */
    transform: translateZ(0);
    will-change: auto;
  }
}

/* Firefox-specific dark mode adjustments */
@media (prefers-color-scheme: dark) {

  /* Ensure proper contrast in Firefox dark mode */
  body {
    color-scheme: dark;
  }
}

/* Firefox-specific light mode adjustments */
@media (prefers-color-scheme: light) {
  body {
    color-scheme: light;
  }
}

/* Firefox SVG rendering improvements */
svg {
  /* Ensure crisp SVG rendering in Firefox */
  shape-rendering: geometricPrecision;
}

/* Firefox flexbox rendering consistency */
.app-container,
.notes-container,
.settings-panel {
  /* Ensure consistent flexbox behavior */
  min-height: 0;
  min-width: 0;
}

/* Firefox grid layout compatibility */
.style-grid,
.citation-formats {
  /* Ensure grid works consistently in Firefox */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
}

/* Firefox transition performance */
* {
  /* Optimize transitions for Firefox */
  transition-timing-function: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Firefox box-shadow rendering */
.app-container,
.note-item,
.settings-section {
  /* Ensure consistent shadow rendering */
  box-shadow:
    0 8px 32px var(--shadow-dark),
    inset 0 1px 0 var(--shadow-light);
}

/* Firefox border-radius consistency */
.app-container,
.note-item {
  /* Ensure consistent border radius rendering */
  border-radius: inherit;
}

/* Firefox overflow handling */
.notes-list,
.settings-content {
  /* Ensure smooth scrolling in Firefox */
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Firefox text overflow ellipsis */
.site-domain,
.site-url,
.note-title {
  /* Ensure ellipsis works correctly */
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

/* Firefox filter effects */
.app-container::before {
  /* Ensure backdrop effects work in Firefox */
  filter: blur(34px) saturate(125%);
  will-change: transform;
}