/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* ==========================================================================
   FALLBACK STYLES FOR OLDER BROWSERS
   These provide basic styling if Tailwind CSS v4 features aren't supported.
   Applies to browsers that don't support @layer (Chrome < 99, Firefox < 97)
   ========================================================================== */

/* Basic reset and defaults - works on all browsers */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Fallback body styles */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: #1f2937;
  background-color: #f8fafc;
  margin: 0;
  padding: 0;
}

/* Fallback for common utility classes - only applies if Tailwind classes fail */
@supports not (background: rgb(from red r g b)) {
  /* Basic colors */
  .bg-white { background-color: #ffffff; }
  .bg-slate-50 { background-color: #f8fafc; }
  .bg-slate-100 { background-color: #f1f5f9; }
  .bg-orange-500, .bg-primary { background-color: #133968 !important; }
  .bg-orange-600 { background-color: #1b4e8f; }
  .bg-green-100 { background-color: #dcfce7; }
  .bg-red-100 { background-color: #fee2e2; }

  .text-white { color: #ffffff; }
  .text-slate-500 { color: #64748b; }
  .text-slate-600 { color: #475569; }
  .text-slate-700 { color: #334155; }
  .text-slate-800 { color: #1e293b; }
  .text-slate-900 { color: #0f172a; }
  .text-orange-500 { color: #133968; }
  .text-orange-600 { color: #1b4e8f; }
  .text-green-700 { color: #15803d; }
  .text-red-700 { color: #b91c1c; }

  /* Basic layout */
  .flex { display: flex; }
  .inline-flex { display: inline-flex; }
  .grid { display: grid; }
  .block { display: block; }
  .hidden { display: none; }

  .flex-col { flex-direction: column; }
  .flex-1 { flex: 1 1 0%; }
  .items-center { align-items: center; }
  .justify-center { justify-content: center; }
  .justify-between { justify-content: space-between; }
  .gap-2 { gap: 0.5rem; }
  .gap-4 { gap: 1rem; }

  /* Spacing */
  .p-2 { padding: 0.5rem; }
  .p-3 { padding: 0.75rem; }
  .p-4 { padding: 1rem; }
  .p-6 { padding: 1.5rem; }
  .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; }
  .mt-2 { margin-top: 0.5rem; }
  .mt-4 { margin-top: 1rem; }

  /* Typography */
  .text-sm { font-size: 0.875rem; }
  .text-base { font-size: 1rem; }
  .text-lg { font-size: 1.125rem; }
  .text-xl { font-size: 1.25rem; }
  .text-2xl { font-size: 1.5rem; }
  .font-medium { font-weight: 500; }
  .font-semibold { font-weight: 600; }
  .font-bold { font-weight: 700; }
  .text-center { text-align: center; }

  /* Borders and rounded corners */
  .rounded { border-radius: 0.25rem; }
  .rounded-md { border-radius: 0.375rem; }
  .rounded-lg { border-radius: 0.5rem; }
  .rounded-xl { border-radius: 0.75rem; }
  .border { border-width: 1px; border-style: solid; }
  .border-slate-200 { border-color: #e2e8f0; }
  .border-slate-300 { border-color: #cbd5e1; }

  /* Shadows */
  .shadow { box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1); }
  .shadow-sm { box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05); }
  .shadow-md { box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1); }

  /* Width and height */
  .w-full { width: 100%; }
  .h-10 { height: 2.5rem; }
  .h-11 { height: 2.75rem; }
  .min-h-screen { min-height: 100vh; }

  /* Buttons - basic fallback */
  button, .btn, [type="submit"] {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease;
  }

  /* Forms - basic fallback */
  input, select, textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #ffffff;
  }

  input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #2e6bb5;
    box-shadow: 0 0 0 2px rgba(46, 107, 181, 0.2);
  }
}

/* ==========================================================================
   END FALLBACK STYLES
   ========================================================================== */

/* Cross-platform font rendering consistency */
html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Prevent horizontal overflow on Windows */
body {
  overflow-x: hidden;
}

/* Ensure consistent input sizing across platforms */
input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
}

/* Hide scrollbar on header navigation while keeping scroll functionality */
header nav {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

header nav::-webkit-scrollbar {
  display: none;  /* Chrome, Safari, Opera */
}

/* Sidebar scrollbar styling */
aside[data-app-shell-target="sidebar"] nav {
  scrollbar-width: thin;
  scrollbar-color: rgb(203 213 225) transparent; /* slate-300 */
}

aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar {
  width: 4px;
}

aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar-track {
  background: transparent;
}

aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar-thumb {
  background-color: rgb(203 213 225); /* slate-300 */
  border-radius: 4px;
}

aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar-thumb:hover {
  background-color: rgb(148 163 184); /* slate-400 */
}

/* Dark mode scrollbar */
.dark aside[data-app-shell-target="sidebar"] nav {
  scrollbar-color: rgb(71 85 105) transparent; /* slate-600 */
}

.dark aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar-thumb {
  background-color: rgb(71 85 105); /* slate-600 */
}

.dark aside[data-app-shell-target="sidebar"] nav::-webkit-scrollbar-thumb:hover {
  background-color: rgb(100 116 139); /* slate-500 */
}

/* Print styles for barcode printing - 50mm x 25mm labels */
@media print {
  body.print-barcode {
    margin: 0 !important;
    padding: 0 !important;
  }

  body.print-barcode > *:not(.barcode-print-wrapper) {
    display: none !important;
  }

  body.print-barcode .barcode-print-wrapper {
    display: block;
    margin: 0;
    padding: 0;
  }

  body.print-barcode .barcode-label {
    width: 50mm;
    height: 25mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
    page-break-after: always;
  }

  body.print-barcode .barcode-label:last-child {
    page-break-after: avoid;
  }

  body.print-barcode .barcode-label img {
    width: 48mm;
    height: 18mm;
  }

  body.print-barcode .barcode-label .barcode-text {
    font-size: 9pt;
    font-family: monospace;
    margin-top: 1mm;
  }
}

  body.print-go-live nav,
  body.print-go-live header,
  body.print-go-live footer,
  body.print-go-live aside,
  body.print-go-live .no-print {
    display: none !important;
  }

  body.print-go-live {
    background: white !important;
  }

  body.print-go-live main,
  body.print-go-live .go-live-print-area {
    width: 100% !important;
    max-width: none !important;
  }

  body.print-go-live main {
    padding: 0 !important;
  }

  body.print-go-live .go-live-print-area {
    padding: 0 !important;
  }

  body.print-go-live .go-live-print-card {
    break-inside: avoid;
    box-shadow: none !important;
  }
}

/* Pagy pagination styles */
.pagy.series-nav {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  margin-bottom: 1rem;
}

.pagy.series-nav a,
.pagy.series-nav span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 0.375rem;
  border: 1px solid rgb(226 232 240);
  background-color: white;
  color: rgb(71 85 105);
  transition: all 0.15s ease;
}

.pagy.series-nav a:hover {
  background-color: rgb(241 245 249);
  border-color: rgb(203 213 225);
  color: rgb(15 23 42);
}

.pagy.series-nav a[aria-current="page"],
.pagy.series-nav [aria-disabled="true"] {
  background-color: rgb(15 23 42);
  border-color: rgb(15 23 42);
  color: white;
  cursor: default;
}

.pagy.series-nav a[aria-label="Previous"],
.pagy.series-nav a[aria-label="Next"] {
  font-weight: 600;
}
