/**
 * MigroStack Cross-Browser Compatibility CSS
 * ==========================================
 * This file addresses browser-specific issues and ensures consistent
 * rendering across Chrome, Firefox, Safari, and Edge.
 *
 * Version: 1.0.0
 * Last Updated: 2026-01-17
 *
 * Compatibility Targets:
 * - Chrome/Edge (Chromium) 80+
 * - Firefox 78+
 * - Safari 13+
 * - iOS Safari 13+
 *
 * Organization:
 * 1. CSS Feature Detection and Fallbacks
 * 2. Vendor Prefixes for Modern Properties
 * 3. Flexbox Compatibility
 * 4. Grid Layout Compatibility
 * 5. Form Element Normalization
 * 6. Scrollbar Standardization
 * 7. Backdrop Filter Compatibility
 * 8. Animation and Transition Fixes
 * 9. Typography and Font Rendering
 * 10. Box Model Consistency
 * 11. Safari-Specific Fixes
 * 12. Firefox-Specific Fixes
 * 13. Edge/IE Legacy Fixes
 */

/* ============================================================
   1. CSS FEATURE DETECTION AND FALLBACKS
   ============================================================ */

/* CSS Custom Properties Fallbacks for older browsers */
/* This provides fallback values for browsers that don't support CSS variables */

:root {
  /* Provide standard values that work without CSS variables */
  color: #323130;
  background-color: #F5F5F5;
}

/* Feature detection for CSS Grid */
@supports not (display: grid) {
  .grid,
  .stats-grid,
  .status-grid,
  .admin-stats-grid,
  .user-stats-grid {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-flex-wrap: wrap;
        -ms-flex-wrap: wrap;
            flex-wrap: wrap;
    gap: 1rem;
  }

  .grid > *,
  .stats-grid > *,
  .status-grid > * {
    -webkit-box-flex: 1;
        -ms-flex: 1 1 250px;
            flex: 1 1 250px;
    min-width: 250px;
  }
}

/* Feature detection for gap property in flexbox */
@supports not (gap: 1rem) {
  .flex,
  .btn-group,
  .nav-section,
  .header-left,
  .search-box {
    margin: -0.5rem;
  }

  .flex > *,
  .btn-group > *,
  .nav-section > *,
  .header-left > *,
  .search-box > * {
    margin: 0.5rem;
  }
}


/* ============================================================
   2. VENDOR PREFIXES FOR MODERN PROPERTIES
   ============================================================ */

/* User Select - prevent text selection on interactive elements */
.btn,
button,
.nav-item,
.theme-toggle,
[role="button"] {
  -webkit-user-select: none;
     -moz-user-select: none;
      -ms-user-select: none;
          user-select: none;
}

/* Text selection styling */
::selection {
  background: var(--primary-blue, #F59E0B);
  color: #ffffff;
}

::-moz-selection {
  background: var(--primary-blue, #F59E0B);
  color: #ffffff;
}

/* Appearance - normalize form elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="date"],
textarea,
select {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
}

/* Box sizing - ensure consistent box model */
*,
*::before,
*::after {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

/* Transform with vendor prefixes */
.btn:hover:not(:disabled),
.card:hover,
.theme-toggle:hover,
.nav-item:hover {
  -webkit-transform: translateY(-1px);
      -ms-transform: translateY(-1px);
          transform: translateY(-1px);
}

/* Transition with vendor prefixes */
.btn,
.card,
.nav-item,
.modal,
.alert,
input,
textarea,
select,
a {
  -webkit-transition: all 200ms ease;
     -moz-transition: all 200ms ease;
       -o-transition: all 200ms ease;
          transition: all 200ms ease;
}

/* Filter with vendor prefixes */
.btn:disabled,
.btn.disabled,
.card.disabled {
  -webkit-filter: grayscale(20%);
          filter: grayscale(20%);
}


/* ============================================================
   3. FLEXBOX COMPATIBILITY
   ============================================================ */

/* Flexbox with full vendor prefixes */
.flex,
.d-flex,
.modal,
.modal.active,
.btn,
.nav-item,
.admin-sidebar,
.admin-header,
.modal-footer,
.search-box,
.btn-group {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -ms-flexbox;
  display: flex;
}

.inline-flex,
.btn {
  display: -webkit-inline-box;
  display: -webkit-inline-flex;
  display: -moz-inline-box;
  display: -ms-inline-flexbox;
  display: inline-flex;
}

/* Flex direction */
.flex-col,
.flex-column,
.admin-sidebar,
.page-loading-splash {
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
     -moz-box-orient: vertical;
     -moz-box-direction: normal;
      -ms-flex-direction: column;
          flex-direction: column;
}

.flex-row {
  -webkit-box-orient: horizontal;
  -webkit-box-direction: normal;
  -webkit-flex-direction: row;
     -moz-box-orient: horizontal;
     -moz-box-direction: row;
      -ms-flex-direction: row;
          flex-direction: row;
}

/* Flex wrap */
.flex-wrap {
  -webkit-flex-wrap: wrap;
      -ms-flex-wrap: wrap;
          flex-wrap: wrap;
}

.flex-nowrap {
  -webkit-flex-wrap: nowrap;
      -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;
}

/* Align items */
.items-center,
.align-items-center,
.btn,
.nav-item,
.modal,
.modal.active,
.admin-header,
.page-loading-splash {
  -webkit-box-align: center;
  -webkit-align-items: center;
     -moz-box-align: center;
      -ms-flex-align: center;
          align-items: center;
}

.items-start,
.align-items-start {
  -webkit-box-align: start;
  -webkit-align-items: flex-start;
     -moz-box-align: start;
      -ms-flex-align: start;
          align-items: flex-start;
}

.items-end,
.align-items-end {
  -webkit-box-align: end;
  -webkit-align-items: flex-end;
     -moz-box-align: end;
      -ms-flex-align: end;
          align-items: flex-end;
}

.items-stretch {
  -webkit-box-align: stretch;
  -webkit-align-items: stretch;
     -moz-box-align: stretch;
      -ms-flex-align: stretch;
          align-items: stretch;
}

/* Justify content */
.justify-center,
.justify-content-center,
.btn,
.modal,
.modal.active,
.page-loading-splash {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
     -moz-box-pack: center;
      -ms-flex-pack: center;
          justify-content: center;
}

.justify-between,
.justify-content-between,
.admin-header,
.modal-header,
.section-header {
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
     -moz-box-pack: justify;
      -ms-flex-pack: justify;
          justify-content: space-between;
}

.justify-start {
  -webkit-box-pack: start;
  -webkit-justify-content: flex-start;
     -moz-box-pack: start;
      -ms-flex-pack: start;
          justify-content: flex-start;
}

.justify-end,
.modal-footer {
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
     -moz-box-pack: end;
      -ms-flex-pack: end;
          justify-content: flex-end;
}

/* Flex grow/shrink */
.flex-1,
.sidebar-nav,
.admin-main,
.nav-item-text {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
     -moz-box-flex: 1;
      -ms-flex: 1;
          flex: 1;
}

.flex-grow {
  -webkit-box-flex: 1;
  -webkit-flex-grow: 1;
     -moz-box-flex: 1;
      -ms-flex-positive: 1;
          flex-grow: 1;
}

.flex-shrink-0 {
  -webkit-flex-shrink: 0;
      -ms-flex-negative: 0;
          flex-shrink: 0;
}


/* ============================================================
   4. GRID LAYOUT COMPATIBILITY
   ============================================================ */

/* CSS Grid with prefixes for IE11/Edge Legacy */
.grid,
.stats-grid,
.status-grid,
.portal-form-grid,
.admin-stats-grid,
.user-stats-grid {
  display: -ms-grid;
  display: grid;
}

/* Grid template columns */
.grid-cols-2 {
  -ms-grid-columns: 1fr 1fr;
  grid-template-columns: repeat(2, 1fr);
}

/* Auto-fit grid (fallback for older browsers) */
.stats-grid,
.status-grid {
  -ms-grid-columns: (minmax(250px, 1fr))[auto-fit];
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Grid gap (older syntax support) */
.grid,
.stats-grid,
.status-grid {
  grid-gap: 1rem;
  gap: 1rem;
}


/* ============================================================
   5. FORM ELEMENT NORMALIZATION
   ============================================================ */

/* Remove default styling across browsers */
button,
input,
optgroup,
select,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

/* Remove inner border and padding in Firefox */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/* Restore focus styles for Firefox */
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/* Remove the inheritance of text transform in Firefox */
button,
select {
  text-transform: none;
}

/* Correct the inability to style clickable types in iOS and Safari */
button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

/* Remove the inner padding in Chrome and Safari on macOS */
[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/* Correct the cursor style of increment and decrement buttons in Safari */
::-webkit-inner-spin-button,
::-webkit-outer-spin-button {
  height: auto;
}

/* Correct the text style of placeholders in Chrome, Edge, and Safari */
::-webkit-input-placeholder {
  color: inherit;
  opacity: 0.54;
}

/* Firefox placeholder */
::-moz-placeholder {
  color: inherit;
  opacity: 0.54;
}

/* IE/Edge placeholder */
:-ms-input-placeholder {
  color: inherit;
  opacity: 0.54;
}

/* Modern placeholder */
::placeholder {
  color: var(--input-placeholder, #9CA3AF);
  opacity: 1;
}

/* Remove default input styling on iOS */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea {
  -webkit-appearance: none;
  -webkit-border-radius: 0;
  border-radius: var(--radius-md, 0.5rem);
}

/* Prevent zoom on input focus in iOS (min 16px font-size) */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select,
  textarea,
  input[type="text"],
  input[type="password"],
  input[type="email"],
  input[type="url"],
  input[type="tel"],
  input[type="number"],
  input[type="search"] {
    font-size: 16px;
  }
}

/* Fix textarea resize in IE */
textarea {
  overflow: auto;
  resize: vertical;
}

/* Select arrow styling cross-browser */
select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5em 1.5em;
  padding-right: 2.5rem;
}

/* Dark theme select arrow */
[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23a1a1aa' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

/* Focus styles - consistent across browsers */
input:focus,
textarea:focus,
select:focus,
button:focus {
  outline: none;
  -webkit-box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
          box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
  border-color: var(--input-focus, #F59E0B);
}

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--primary-blue, #F59E0B);
  outline-offset: 2px;
}

/* Remove focus ring for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* Checkbox and radio styling */
input[type="checkbox"],
input[type="radio"] {
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--border-color, #D1D5DB);
  background: var(--bg-input, #FFFFFF);
  cursor: pointer;
  vertical-align: middle;
  position: relative;
}

input[type="checkbox"] {
  border-radius: 0.25rem;
}

input[type="radio"] {
  border-radius: 50%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
  background: var(--primary-blue, #F59E0B);
  border-color: var(--primary-blue, #F59E0B);
}

input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 0px;
  width: 5px;
  height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  -webkit-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
          transform: rotate(45deg);
}

input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: white;
}


/* ============================================================
   6. SCROLLBAR STANDARDIZATION
   ============================================================ */

/* WebKit (Chrome, Safari, Edge Chromium) scrollbars */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary, #ECECEC);
  border-radius: 6px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-blue, #F59E0B);
  border-radius: 6px;
  border: 2px solid var(--bg-secondary, #ECECEC);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-blue-light, #FBBF24);
}

::-webkit-scrollbar-corner {
  background: var(--bg-secondary, #ECECEC);
}

/* Firefox scrollbars */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary-blue, #F59E0B) var(--bg-secondary, #ECECEC);
}

/* Dark theme scrollbars */
[data-theme="dark"] ::-webkit-scrollbar-track {
  background: var(--bg-tertiary, #27272A);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--primary-blue, #F59E0B);
  border-color: var(--bg-tertiary, #27272A);
}

[data-theme="dark"] * {
  scrollbar-color: var(--primary-blue, #F59E0B) var(--bg-tertiary, #27272A);
}


/* ============================================================
   7. BACKDROP FILTER COMPATIBILITY
   ============================================================ */

/* Backdrop filter with fallback */
.modal-overlay,
.sidebar-overlay,
.mobile-sidebar-overlay,
.dropdown-backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* Apply backdrop-filter only when supported */
@supports ((-webkit-backdrop-filter: blur(4px)) or (backdrop-filter: blur(4px))) {
  .modal-overlay,
  .sidebar-overlay,
  .mobile-sidebar-overlay,
  .dropdown-backdrop {
    background: rgba(0, 0, 0, 0.3);
    -webkit-backdrop-filter: blur(4px);
            backdrop-filter: blur(4px);
  }
}

/* Glassmorphism effect with fallback */
.glass-effect {
  background: rgba(255, 255, 255, 0.9);
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  .glass-effect {
    background: rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
            backdrop-filter: blur(10px) saturate(180%);
  }
}

[data-theme="dark"] .glass-effect {
  background: rgba(24, 24, 27, 0.9);
}

@supports ((-webkit-backdrop-filter: blur(10px)) or (backdrop-filter: blur(10px))) {
  [data-theme="dark"] .glass-effect {
    background: rgba(24, 24, 27, 0.7);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
            backdrop-filter: blur(10px) saturate(180%);
  }
}


/* ============================================================
   8. ANIMATION AND TRANSITION FIXES
   ============================================================ */

/* Keyframe animations with vendor prefixes */
@-webkit-keyframes spin {
  to {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

@keyframes spin {
  to {
    -webkit-transform: rotate(360deg);
            transform: rotate(360deg);
  }
}

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

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

@-webkit-keyframes pulse-logo {
  0%, 100% {
    opacity: 1;
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  50% {
    opacity: 0.8;
    -webkit-transform: scale(0.98);
            transform: scale(0.98);
  }
}

@keyframes pulse-logo {
  0%, 100% {
    opacity: 1;
    -webkit-transform: scale(1);
            transform: scale(1);
  }
  50% {
    opacity: 0.8;
    -webkit-transform: scale(0.98);
            transform: scale(0.98);
  }
}

@-webkit-keyframes modalSlideIn {
  from {
    opacity: 0;
    -webkit-transform: translateY(-20px);
            transform: translateY(-20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
            transform: translateY(0);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    -webkit-transform: translateY(-20px);
            transform: translateY(-20px);
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
            transform: translateY(0);
  }
}

/* Animation utility classes with vendor prefixes */
.animate-spin {
  -webkit-animation: spin 1s linear infinite;
          animation: spin 1s linear infinite;
}

.animate-fade-in {
  -webkit-animation: fadeIn 0.3s ease;
          animation: fadeIn 0.3s ease;
}

.spinner,
.splash-spinner,
.portal-loading-spinner {
  -webkit-animation: spin 1s linear infinite;
          animation: spin 1s linear infinite;
}

.splash-logo {
  -webkit-animation: pulse-logo 2s ease-in-out infinite;
          animation: pulse-logo 2s ease-in-out infinite;
}

.modal-content {
  -webkit-animation: modalSlideIn 0.3s ease;
          animation: modalSlideIn 0.3s ease;
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    -webkit-animation-duration: 0.01ms !important;
            animation-duration: 0.01ms !important;
    -webkit-animation-iteration-count: 1 !important;
            animation-iteration-count: 1 !important;
    -webkit-transition-duration: 0.01ms !important;
         -o-transition-duration: 0.01ms !important;
            transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ============================================================
   9. TYPOGRAPHY AND FONT RENDERING
   ============================================================ */

/* Font smoothing across browsers */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Fix font rendering in Firefox */
body {
  -moz-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
      -ms-text-size-adjust: 100%;
          text-size-adjust: 100%;
}

/* Prevent font boosting on mobile */
body {
  max-height: 100000000px;
}

/* Fix text overflow in older browsers */
.text-ellipsis,
.nav-item-text {
  overflow: hidden;
  -o-text-overflow: ellipsis;
     text-overflow: ellipsis;
  white-space: nowrap;
}

/* Word break for long content */
.break-word {
  word-wrap: break-word;
  overflow-wrap: break-word;
  -ms-word-break: break-all;
  word-break: break-word;
  -webkit-hyphens: auto;
      -ms-hyphens: auto;
          hyphens: auto;
}


/* ============================================================
   10. BOX MODEL CONSISTENCY
   ============================================================ */

/* Ensure consistent box model */
html {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

*, *::before, *::after {
  -webkit-box-sizing: inherit;
     -moz-box-sizing: inherit;
          box-sizing: inherit;
}

/* Image handling */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Table border collapse */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Remove default list styles */
ul, ol {
  list-style: none;
}


/* ============================================================
   11. SAFARI-SPECIFIC FIXES
   ============================================================ */

/* Fix Safari flex gap */
@supports not (gap: 1rem) {
  .flex > * + *,
  .btn-group > * + *,
  .modal-footer > * + * {
    margin-left: 0.5rem;
  }

  .flex-col > * + *,
  .btn-group-vertical > * + * {
    margin-top: 0.5rem;
    margin-left: 0;
  }
}

/* Fix Safari button styling */
button {
  border-radius: var(--radius-md, 0.5rem);
}

/* Fix Safari position: sticky */
.sticky,
.admin-sidebar {
  position: -webkit-sticky;
  position: sticky;
}

/* Fix Safari 100vh issue */
@supports (-webkit-touch-callout: none) {
  .min-h-screen {
    min-height: -webkit-fill-available;
  }
}

/* Fix Safari momentum scrolling */
.overflow-y-auto,
.overflow-x-auto,
.sidebar-nav,
.modal-body,
table {
  -webkit-overflow-scrolling: touch;
}

/* Fix Safari input zoom */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
  select:focus,
  textarea:focus,
  input:focus {
    font-size: 16px;
  }
}

/* Fix Safari date input */
input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}

/* Fix Safari color input */
input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 0.25rem;
}


/* ============================================================
   12. FIREFOX-SPECIFIC FIXES
   ============================================================ */

/* Fix Firefox button inner padding */
button::-moz-focus-inner {
  border: 0;
  padding: 0;
}

/* Fix Firefox number input spinner */
input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Fix Firefox placeholder opacity */
::-moz-placeholder {
  opacity: 1;
}

/* Firefox-specific scrollbar width */
@-moz-document url-prefix() {
  * {
    scrollbar-width: thin;
  }
}

/* Fix Firefox select appearance */
@-moz-document url-prefix() {
  select {
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
  }
}


/* ============================================================
   13. EDGE/IE LEGACY FIXES
   ============================================================ */

/* IE11 flex fixes */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .flex,
  .d-flex {
    display: -ms-flexbox;
  }

  .flex-col {
    -ms-flex-direction: column;
  }

  .items-center {
    -ms-flex-align: center;
  }

  .justify-center {
    -ms-flex-pack: center;
  }

  .justify-between {
    -ms-flex-pack: justify;
  }
}

/* Edge Legacy clear type */
@supports (-ms-ime-align: auto) {
  body {
    -ms-overflow-style: -ms-autohiding-scrollbar;
  }
}

/* IE11 min-height fix for flex containers */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
  .admin-main,
  .modal-content {
    min-height: 1px;
  }
}


/* ============================================================
   14. SMOOTH SCROLL BEHAVIOR
   ============================================================ */

/* Smooth scrolling with fallback */
html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}


/* ============================================================
   15. PRINT STYLES
   ============================================================ */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    -webkit-box-shadow: none !important;
            box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  pre {
    white-space: pre-wrap !important;
  }

  pre,
  blockquote {
    border: 1px solid #999;
    page-break-inside: avoid;
  }

  thead {
    display: table-header-group;
  }

  tr,
  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }

  .admin-sidebar,
  .theme-toggle,
  .mobile-menu-toggle,
  .no-print {
    display: none !important;
  }

  .admin-main {
    margin-left: 0 !important;
  }
}


/* ============================================================
   16. HIGH CONTRAST MODE SUPPORT
   ============================================================ */

@media (prefers-contrast: high) {
  :root {
    --border-color: #000;
    --border-color-light: #333;
    --border-color-dark: #000;
  }

  .btn,
  .card,
  input,
  textarea,
  select {
    border-width: 2px;
  }

  a {
    text-decoration: underline;
  }
}

@media (forced-colors: active) {
  .btn-primary,
  .btn-success,
  .btn-danger,
  .btn-warning {
    forced-color-adjust: none;
  }
}


/* ============================================================
   17. DARK MODE COLOR SCHEME HINT
   ============================================================ */

[data-theme="dark"] {
  color-scheme: dark;
}

[data-theme="light"] {
  color-scheme: light;
}


/* ============================================================
   18. MOBILE TOUCH IMPROVEMENTS
   ============================================================ */

/* Larger touch targets on touch devices */
@media (hover: none) and (pointer: coarse) {
  .btn,
  button,
  .nav-item,
  a,
  input[type="button"],
  input[type="submit"],
  input[type="reset"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Disable hover effects on touch devices */
  .btn:hover,
  .card:hover,
  .nav-item:hover {
    -webkit-transform: none;
        -ms-transform: none;
            transform: none;
  }

  /* Tap highlight color */
  a,
  button,
  .btn,
  .nav-item,
  [role="button"] {
    -webkit-tap-highlight-color: rgba(245, 158, 11, 0.2);
  }
}


/* ============================================================
   19. TABLE RESPONSIVENESS
   ============================================================ */

/* Responsive tables with horizontal scroll */
.table-responsive,
.users-table,
.data-table,
.admin-table {
  display: block;
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: -ms-autohiding-scrollbar;
}

/* Ensure table doesn't break layout */
table {
  min-width: 100%;
  width: -webkit-max-content;
  width: -moz-max-content;
  width: max-content;
}

@media (max-width: 767px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
