/* Systematic Select2 Styling */
/* This provides consistent styling and easy identification of Select2 elements */

/* Base Select2 styling */
.select2-container {
  width: 100% !important;
}

.select2-container--default .select2-selection--single {
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.select2-container--default .select2-selection--single:hover {
  border-color: #9ca3af;
}

.select2-container--default.select2-container--focus
  .select2-selection--single {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

.select2-container--default .select2-selection--multiple {
  min-height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.select2-container--default .select2-selection--multiple:hover {
  border-color: #9ca3af;
}

.select2-container--default.select2-container--focus
  .select2-selection--multiple {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  outline: none;
}

/* Dropdown styling */
.select2-dropdown {
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.select2-container--default .select2-results__option {
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.select2-container--default
  .select2-results__option--highlighted[aria-selected] {
  background-color: #3b82f6;
  color: white;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
  background-color: #f3f4f6;
  color: #374151;
}

/* Search box styling */
.select2-container--default .select2-search--dropdown .select2-search__field {
  border: 1px solid #d1d5db;
  border-radius: 0.25rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  margin: 0.5rem;
  width: calc(100% - 1rem);
}

/* Preset-specific styling */

/* Searchable selects */
.select2-searchable .select2-container {
  min-width: 200px;
}

/* Multi-select styling */
.select2-multi .select2-selection--multiple .select2-selection__choice {
  background-color: #3b82f6;
  border: 1px solid #2563eb;
  color: white;
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
  margin: 0.125rem;
  font-size: 0.75rem;
}

.select2-multi .select2-selection--multiple .select2-selection__choice__remove {
  color: white;
  margin-right: 0.25rem;
}

.select2-multi
  .select2-selection--multiple
  .select2-selection__choice__remove:hover {
  color: #fbbf24;
}

/* Tags styling */
.select2-tags .select2-selection--multiple .select2-selection__choice {
  background-color: #10b981;
  border: 1px solid #059669;
  color: white;
  border-radius: 0.25rem;
  padding: 0.125rem 0.5rem;
  margin: 0.125rem;
  font-size: 0.75rem;
}

.select2-tags .select2-selection--multiple .select2-selection__choice__remove {
  color: white;
  margin-right: 0.25rem;
}

.select2-tags
  .select2-selection--multiple
  .select2-selection__choice__remove:hover {
  color: #fbbf24;
}

/* Required field styling */
.select2-required .select2-container--default .select2-selection--single {
  border-color: #dc2626;
}

.select2-required .select2-container--default .select2-selection--single:hover {
  border-color: #b91c1c;
}

.select2-required
  .select2-container--default.select2-container--focus
  .select2-selection--single {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Compact styling */
.select2-compact .select2-container {
  width: 200px !important;
}

/* Disabled styling */
.select2-disabled .select2-container--default .select2-selection--single {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

.select2-disabled .select2-container--default .select2-selection--multiple {
  background-color: #f9fafb;
  color: #6b7280;
  cursor: not-allowed;
}

/* Loading state */
.select2-loading .select2-container--default .select2-selection--single::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  border: 2px solid #d1d5db;
  border-top: 2px solid #3b82f6;
  border-radius: 50%;
  animation: select2-spin 1s linear infinite;
}

@keyframes select2-spin {
  0% {
    transform: translateY(-50%) rotate(0deg);
  }
  100% {
    transform: translateY(-50%) rotate(360deg);
  }
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .select2-container {
    width: 100% !important;
  }

  .select2-compact .select2-container {
    width: 100% !important;
  }
}

/* Form integration */
.form-group .select2-container {
  margin-bottom: 0;
}

.form-group .select2-container + .invalid-feedback {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: #dc2626;
}

/* Error state */
.is-invalid .select2-container--default .select2-selection--single {
  border-color: #dc2626;
}

.is-invalid .select2-container--default .select2-selection--multiple {
  border-color: #dc2626;
}

.is-invalid
  .select2-container--default.select2-container--focus
  .select2-selection--single,
.is-invalid
  .select2-container--default.select2-container--focus
  .select2-selection--multiple {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
/* Custom Utility Classes for Restock - Design System */

/* ===== BUTTON STYLES ===== */
.btn-primary {
  @apply bg-blue-600 hover:bg-blue-700 text-white font-medium py-2 px-4 rounded-md transition-colors;
}

.btn-secondary {
  @apply bg-gray-600 hover:bg-gray-700 text-white font-medium py-2 px-4 rounded-md transition-colors;
}

.btn-outline {
  @apply bg-white text-gray-700 border border-gray-300 px-4 py-2 rounded-md hover:bg-gray-50 transition-colors font-medium;
}

.btn-danger {
  @apply bg-red-600 hover:bg-red-700 text-white font-medium py-2 px-4 rounded-md transition-colors;
}

.btn-sm {
  @apply py-1.5 px-3 text-sm;
}

.btn-lg {
  @apply py-3 px-6 text-lg;
}

/* ===== FORM STYLES ===== */
.form-input {
  @apply block w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500;
  height: 42px !important;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid #d1d5db !important;
  font-size: 1rem !important; /* Increased from sm:text-sm */
}

.form-select {
  @apply block w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500 bg-white;
  height: 42px !important;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid #d1d5db !important;
  font-size: 1rem !important; /* Increased from sm:text-sm */
}

.form-textarea {
  @apply block w-full border-gray-300 rounded-md shadow-sm focus:ring-blue-500 focus:border-blue-500;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid #d1d5db !important;
  font-size: 1rem !important; /* Increased from sm:text-sm */
}

/* Form inputs that should match Select2 styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select:not(.select2-hidden-accessible) {
  height: 42px !important;
  padding: 0.5rem 0.75rem !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  font-size: 1rem !important; /* Increased from 0.875rem */
  line-height: 1.5rem !important; /* Increased from 1.25rem */
}

/* Search input with icon - override padding to accommodate icon */
input[type="search"].pl-10 {
  padding-left: 2.5rem !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
select:not(.select2-hidden-accessible):focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
  outline: none !important;
}

.form-label {
  @apply block font-medium text-gray-700;
  font-size: 1rem !important; /* Increased from text-sm */
}

.form-help-text {
  font-size: 0.875rem !important; /* Increased from text-sm */
  @apply text-gray-500;
}

.form-error-text {
  font-size: 0.875rem !important; /* Increased from text-sm */
  @apply text-red-600;
}

/* ===== STATUS BADGES ===== */
.status-success {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-green-100 text-green-800;
}

.status-warning {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-yellow-100 text-yellow-800;
}

.status-error {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-red-100 text-red-800;
}

.status-info {
  @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800;
}

/* ===== ALERT STYLES ===== */
.alert-success {
  @apply bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-md;
}

.alert-error {
  @apply bg-red-50 border border-red-200 text-red-800 px-4 py-3 rounded-md;
}

.alert-warning {
  @apply bg-yellow-50 border border-yellow-200 text-yellow-800 px-4 py-3 rounded-md;
}

.alert-info {
  @apply bg-blue-50 border border-blue-200 text-blue-800 px-4 py-3 rounded-md;
}

/* ===== CARD STYLES ===== */
.card {
  @apply bg-white rounded-lg shadow-sm border border-gray-200;
}

.card-hover {
  @apply bg-white rounded-lg shadow-sm border border-gray-200 hover:shadow-md transition-shadow;
}

/* ===== NAVIGATION STYLES ===== */
.nav-link {
  @apply text-gray-600 hover:text-gray-900 px-3 py-2 rounded-md text-sm font-medium transition-colors;
}

.nav-link-active {
  @apply text-blue-600 bg-blue-50 px-3 py-2 rounded-md text-sm font-medium;
}

/* ===== TYPOGRAPHY ===== */
.text-primary {
  @apply text-gray-900;
}

.text-secondary {
  @apply text-gray-600;
}

.text-muted {
  @apply text-gray-500;
}

.text-small {
  @apply text-xs text-gray-400;
}

/* ===== ICON STYLES ===== */
.icon {
  @apply w-5 h-5;
}

.icon-sm {
  @apply w-4 h-4;
}

.icon-lg {
  @apply w-6 h-6;
}

.icon-xl {
  @apply w-8 h-8;
}

/* Icon Colors */
.icon-blue {
  @apply text-blue-600;
}

.icon-green {
  @apply text-green-600;
}

.icon-red {
  @apply text-red-600;
}

.icon-yellow {
  @apply text-yellow-600;
}

.icon-gray {
  @apply text-gray-600;
}

.icon-white {
  @apply text-white;
}

/* ===== ORGANIZATION BRANDING ===== */
.org-brand {
  @apply rounded-full;
}

.org-brand-sm {
  @apply w-3 h-3 rounded-full;
}

.org-brand-md {
  @apply w-4 h-4 rounded-full;
}

.org-brand-lg {
  @apply w-6 h-6 rounded-full;
}

/* ===== LAYOUT UTILITIES ===== */
.page-container {
  @apply max-w-7xl mx-auto px-4 sm:px-6 lg:px-8;
}

.content-section {
  @apply py-6;
}

/* ===== NAVIGATION UTILITIES ===== */
.nav-link-mobile {
  @apply text-gray-200 hover:text-white block px-3 py-2 rounded-md text-base font-medium;
}

.sidebar-link {
  @apply text-gray-700 hover:bg-gray-50 hover:text-gray-900 group flex items-center px-2 py-2 text-sm font-medium rounded-md transition-colors;
}

.sidebar-link-active {
  @apply bg-blue-50 text-blue-700 group flex items-center px-2 py-2 text-sm font-medium rounded-md;
}

/* ===== ICON CONTAINERS ===== */
.icon-container {
  @apply w-8 h-8 rounded-full flex items-center justify-center;
}

.icon-container-sm {
  @apply w-6 h-6 rounded-full flex items-center justify-center;
}

.icon-container-lg {
  @apply w-10 h-10 rounded-full flex items-center justify-center;
}

/* ===== RESPONSIVE UTILITIES ===== */
.mobile-only {
  @apply md:hidden;
}

.desktop-only {
  @apply hidden md:block;
}

/* ===== FOCUS & ACCESSIBILITY ===== */
.focus-ring {
  @apply focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500;
}

.sr-only {
  @apply sr-only;
}

/* ===== COMMON HOVER EFFECTS ===== */
.hover-lift {
  @apply hover:shadow-md transition-shadow;
}

.hover-scale {
  @apply hover:scale-105 transition-transform;
}

.hover-fade {
  @apply hover:opacity-80 transition-opacity;
}

/* ===== MOBILE TOUCH TARGETS ===== */
/* Minimum 44x44px touch targets for mobile accessibility */
.btn-touch {
  @apply min-h-[44px] min-w-[44px] px-4 py-3;
}

.btn-touch-sm {
  @apply min-h-[44px] min-w-[44px] px-3 py-2;
}

.btn-touch-lg {
  @apply min-h-[56px] min-w-[56px] px-6 py-4;
}

/* Touch-friendly spacing between buttons */
.btn-spacing {
  @apply space-x-4;
}

.btn-spacing-sm {
  @apply space-x-2;
}

.btn-spacing-lg {
  @apply space-x-6;
}

/* Mobile-optimized form controls */
.form-touch {
  @apply min-h-[44px] px-4 py-3 text-base;
}

.form-touch-sm {
  @apply min-h-[44px] px-3 py-2 text-sm;
}

/* Touch-friendly checkboxes and radios */
.checkbox-touch {
  @apply w-6 h-6;
}

.radio-touch {
  @apply w-6 h-6;
}

/* Mobile navigation touch targets */
.nav-touch {
  @apply min-h-[56px] min-w-[56px] flex items-center justify-center;
}

/* Mobile card touch targets */
.card-touch {
  @apply min-h-[60px] p-4;
}

/* Mobile action buttons with proper spacing */
.action-group {
  @apply flex flex-col sm:flex-row gap-4;
}

.action-group-tight {
  @apply flex flex-col sm:flex-row gap-2;
}

/* ===== MOBILE KEYBOARD OPTIMIZATION ===== */
/* Proper input types for mobile keyboards */
.input-phone {
  @apply form-touch;
  input-type: tel;
}

.input-email {
  @apply form-touch;
  input-type: email;
}

.input-number {
  @apply form-touch;
  input-type: number;
}

.input-search {
  @apply form-touch;
  input-type: search;
}

.input-url {
  @apply form-touch;
  input-type: url;
}

/* Mobile-optimized form inputs with proper keyboard types */
.mobile-input-phone {
  @apply form-touch;
  input-type: tel;
  autocomplete: tel;
}

.mobile-input-email {
  @apply form-touch;
  input-type: email;
  autocomplete: email;
}

.mobile-input-name {
  @apply form-touch;
  autocomplete: name;
}

.mobile-input-organization {
  @apply form-touch;
  autocomplete: organization;
}

/* Prevent zoom on iOS for inputs with font-size < 16px */
.mobile-input-no-zoom {
  @apply text-base;
}

/* Mobile-friendly textarea */
.mobile-textarea {
  @apply form-touch resize-none;
}

/* Mobile search input */
.mobile-search {
  @apply form-touch;
  input-type: search;
  autocomplete: off;
}

/* Mobile date inputs */
.mobile-date {
  @apply form-touch;
  input-type: date;
}

.mobile-datetime {
  @apply form-touch;
  input-type: datetime-local;
}

/* Mobile time inputs */
.mobile-time {
  @apply form-touch;
  input-type: time;
}

/* ===== MOBILE GESTURE SUPPORT ===== */
/* Swipe actions for mobile cards */
.swipe-item {
  @apply relative transition-transform duration-200 ease-out;
}

.swipe-active {
  @apply transition-none;
}

.swipe-revealed {
  @apply transform -translate-x-24;
}

.swipe-actions {
  @apply absolute right-0 top-0 h-full flex items-center bg-gray-100 border-l border-gray-200;
}

.swipe-action-edit,
.swipe-action-delete {
  @apply w-12 h-full flex items-center justify-center text-gray-600 hover:text-white transition-colors;
}

.swipe-action-edit {
  @apply bg-blue-500 hover:bg-blue-600;
}

.swipe-action-delete {
  @apply bg-red-500 hover:bg-red-600;
}

/* Pull to refresh indicator */
.pull-to-refresh {
  @apply fixed top-0 left-0 right-0 z-50 bg-blue-600 text-white text-center py-2 transform -translate-y-full transition-transform duration-200;
}

.pull-to-refresh.visible {
  @apply translate-y-0;
}

/* Long press feedback */
.long-press-active {
  @apply scale-105 shadow-lg;
}

/* Touch feedback for buttons */
.touch-feedback {
  @apply active:scale-95 transition-transform duration-100;
}

/* ===== EMPTY STATE STYLES ===== */
.empty-state {
  @apply flex flex-col items-center justify-center py-12 px-4 text-center;
}

.empty-state-icon {
  @apply w-12 h-12 text-gray-400 mb-4;
}

.empty-state-icon svg {
  @apply w-full h-full;
}

.empty-state-title {
  @apply text-lg font-medium text-gray-900 mb-2;
}

.empty-state-description {
  @apply text-sm text-gray-500;
}

/* ===== MOBILE COMPACT UTILITIES ===== */
/* Reduced padding for mobile screens */
.mobile-compact-padding {
  @apply px-2 py-2 sm:px-6 sm:py-6;
}

/* Reduced margins for mobile screens */
.mobile-compact-margin {
  @apply mb-2 sm:mb-4;
}

/* Flat styling (reduced shadows/borders) for mobile */
.mobile-flat {
  @apply shadow-none sm:shadow-sm border-0 sm:border;
}

/* Tight spacing for mobile card sections */
.mobile-tight {
  @apply gap-2 sm:gap-4;
}

/* ===== DATA TABLE CONTAINERS ===== */
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  /* Prevent container from expanding beyond viewport */
  box-sizing: border-box;
}

/* Support both horizontal and vertical scrolling */
.table-scroll.table-scroll-vertical {
  overflow-y: auto;
}

.table-scroll::-webkit-scrollbar {
  height: 8px;
  width: 8px;
}

.table-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.table-scroll::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Ensure tables inside .table-scroll don't force page expansion */
.table-scroll table {
  width: 100%;
  min-width: max-content; /* Allow table to be wider than container */
  table-layout: auto;
  margin: 0;
}

/* Ensure data-table wrapper doesn't expand beyond viewport */
.data-table {
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden; /* Prevent content from spilling out */
}

/* Ensure main content containers don't expand beyond viewport */
main,
.container,
.content-wrapper {
  max-width: 100%;
  overflow-x: hidden;
  box-sizing: border-box;
}
/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, or any plugin's
 * vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *


 */

/* Import utilities for button styling */
@import "utilities.css";

/* Select2 Custom Styling for Tailwind */
.select2-container--default .select2-selection--single {
  height: 42px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  padding: 0.5rem 0.75rem !important;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  line-height: 30px !important;
  padding-left: 0 !important;
  padding-right: 20px !important;
}

.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 40px !important;
  right: 8px !important;
}

.select2-container--default .select2-selection--single:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

.select2-dropdown {
  border: 1px solid #d1d5db !important;
  border-radius: 0.375rem !important;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05) !important;
}

/* ===== GLOBAL LOADING OVERLAY ===== */
/* Loading overlay container */
#global-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
}

#global-loading-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* Loading spinner */
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top: 4px solid #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Blue variant for non-overlay spinners */
.loading-spinner.spinner-blue {
  border: 4px solid rgba(37, 99, 235, 0.2);
  border-top: 4px solid #2563eb;
}

/* Green variant */
.loading-spinner.spinner-green {
  border: 4px solid rgba(16, 185, 129, 0.2);
  border-top: 4px solid #10b981;
}

/* Gray variant */
.loading-spinner.spinner-gray {
  border: 4px solid rgba(107, 114, 128, 0.2);
  border-top: 4px solid #6b7280;
}

/* Small spinner */
.loading-spinner.spinner-sm {
  width: 24px;
  height: 24px;
  border-width: 2px;
}

/* Large spinner */
.loading-spinner.spinner-lg {
  width: 64px;
  height: 64px;
  border-width: 5px;
}

/* Loading message */
.loading-message {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 500;
  margin-top: 1rem;
  text-align: center;
  max-width: 300px;
}

/* Spin animation */
@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Inline loading state for buttons */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
  cursor: not-allowed;
}

.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  color: inherit;
}

/* Inline loading spinner container */
.inline-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* IMEI Check Loading Animation Styles */
.imei-check-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.imei-check-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.imei-check-button {
  position: relative;
  transition: all 0.2s ease-in-out;
}

.imei-check-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.imei-check-button.loading {
  background-color: #6b7280;
  color: #ffffff;
}

.imei-check-button.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid transparent;
  border-top: 2px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.imei-check-button.loading .button-text {
  opacity: 0;
}

.imei-check-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.imei-check-status.loading {
  color: #6b7280;
}

.imei-check-status.success {
  color: #10b981;
}

.imei-check-status.error {
  color: #ef4444;
}

.imei-check-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f3f3f3;
  border-top: 2px solid #10b981;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* IMEI Input Loading State */
.imei-input.loading {
  border-color: #10b981;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%2310b981' d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
  animation: imei-pulse 1.5s ease-in-out infinite;
}

@keyframes imei-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

/* ===== MOBILE VIEWPORT FIXES ===== */
/* Fix for mobile viewport height issues with bottom navigation */
:root {
  --vh: 1vh;
}

/* Ensure body takes full height */
html {
  height: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
}

body {
  height: 100%;
  height: 100vh;
  height: calc(var(--vh, 1vh) * 100);
  position: relative;
  font-size: 1.125rem; /* Increase base font size from 16px to 18px */
  line-height: 1.75; /* Better line height for readability */
  overflow-x: hidden; /* Prevent horizontal page expansion from wide tables */
  max-width: 100vw; /* Ensure body doesn't exceed viewport width */
}

/* Global text size increases - bump everything up one size level */
.text-xs {
  font-size: 0.875rem !important; /* 14px instead of 12px */
}

.text-sm {
  font-size: 1rem !important; /* 16px instead of 14px */
}

/* text-base is now the default body size (18px) */
.text-base {
  font-size: 1.125rem !important; /* 18px instead of 16px */
}

.text-lg {
  font-size: 1.25rem !important; /* 20px instead of 18px */
}

.text-xl {
  font-size: 1.5rem !important; /* 24px instead of 20px */
}

.text-2xl {
  font-size: 1.875rem !important; /* 30px instead of 24px */
}

.text-3xl {
  font-size: 2.25rem !important; /* 36px instead of 30px */
}

/* Increase form input text sizes */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select:not(.select2-hidden-accessible),
textarea {
  font-size: 1rem !important; /* 16px for better mobile readability */
}

/* Increase button text sizes */
button,
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-danger {
  font-size: 1rem !important; /* 16px */
}

/* Increase table text sizes */
table {
  font-size: 1rem !important; /* 16px base */
}

table th {
  font-size: 0.875rem !important; /* 14px for headers */
}

table td {
  font-size: 1rem !important; /* 16px for cells */
}

/* Increase navigation text sizes */
nav a,
nav button {
  font-size: 1rem !important; /* 16px */
}

/* Increase sidebar text sizes */
aside a,
aside button {
  font-size: 1rem !important; /* 16px */
}

/* Responsive table styles - fix overflow at the source */
@media (max-width: 768px) {
  /* Make table cells responsive - reduce padding on mobile */
  table th,
  table td {
    padding-left: 0.5rem !important; /* px-2 instead of px-6 */
    padding-right: 0.5rem !important;
    padding-top: 0.5rem !important; /* py-2 instead of py-4 */
    padding-bottom: 0.5rem !important;
  }

  /* Allow text to wrap in table cells on mobile */
  table td {
    white-space: normal !important; /* Remove whitespace-nowrap on mobile */
    word-break: break-word;
  }

  /* Make table headers wrap too */
  table th {
    white-space: normal !important;
    word-break: break-word;
    font-size: 0.875rem !important; /* Increased from 0.7rem */
  }

  /* Ensure tables fit within viewport */
  table {
    width: 100%;
    table-layout: auto;
    font-size: 1rem !important; /* Increased from 0.875rem */
  }

  /* Table header text size */
  table thead th {
    font-size: 0.875rem !important; /* Increased from 0.7rem */
    padding: 0.375rem 0.5rem !important;
  }

  /* Prevent images and media from overflowing */
  img,
  video,
  iframe {
    max-width: 100%;
    height: auto;
  }

  /* Ensure form inputs don't overflow */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="tel"],
  input[type="url"],
  input[type="search"],
  select,
  textarea {
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* Mobile bottom navigation positioning fix */
@media (max-width: 768px) {
  /* Use CSS custom properties for dynamic viewport height */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    /* Ensure it stays at the very bottom */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }

  /* Main content padding to account for bottom nav */
  .user-layout main {
    padding-bottom: 4rem; /* 64px for bottom nav height */
    min-height: calc(100vh - 4rem);
    min-height: calc(var(--vh, 1vh) * 100 - 4rem);
  }

  /* Ensure no gap between content and bottom nav */
  .user-layout {
    min-height: 100vh;
    min-height: calc(var(--vh, 1vh) * 100);
  }

  /* Fix for iOS Safari address bar issues */
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 50;
    /* Use safe-area-inset for devices with home indicator */
    padding-bottom: env(safe-area-inset-bottom);
    /* Ensure it's always visible */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    /* iOS Safari specific: Force hardware acceleration */
    will-change: transform;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
  }

  /* iOS Safari specific: Ensure bottom nav stays at bottom during toolbar transitions */
  @supports (-webkit-touch-callout: none) {
    .mobile-bottom-nav {
      /* Force position recalculation on iOS */
      position: fixed !important;
      bottom: 0 !important;
      /* Prevent any gap during toolbar transitions */
      margin-bottom: 0 !important;
      padding-bottom: env(safe-area-inset-bottom) !important;
    }
  }

  /* Real-time positioning support */
  .mobile-bottom-nav {
    /* Ensure it can be repositioned by JavaScript */
    transition: none !important;
    /* Force immediate positioning */
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    z-index: 50 !important;
  }
}

/* ===== MOBILE VIEWPORT JAVASCRIPT SUPPORT ===== */
/* Classes for JavaScript viewport height management */
.viewport-height-fixed {
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

/* When viewport-height-fixed is used with flex, use min-height instead of height */
.viewport-height-fixed.flex {
  height: auto;
  min-height: 100vh;
  min-height: calc(var(--vh, 1vh) * 100);
}

.mobile-content-with-nav {
  min-height: calc(100vh - 4rem);
  min-height: calc(var(--vh, 1vh) * 100 - 4rem);
}

/* ===== FOOTER POSITIONING FIX ===== */
/* Ensure footer is never fixed or sticky - it should be in normal document flow */
.user-layout footer {
  position: relative !important;
  bottom: auto !important;
  margin-top: auto;
}

/* Ensure footer doesn't scroll with page on non-user-facing pages */
body.user-layout footer {
  position: static !important;
}

/* Ensure footer on non-user-facing pages (application layout) is not fixed */
/* This applies to pages using application.html.erb layout */
body:not(.user-layout) footer {
  position: static !important;
  bottom: auto !important;
}

/* Override html/body height for non-user-facing pages to allow natural scrolling */
/* This prevents the footer from being stuck at viewport bottom */
body:not(.user-layout) {
  height: auto !important;
  min-height: 100vh; /* Still allow minimum height for short content */
}

html:has(body:not(.user-layout)) {
  height: auto !important;
}

/* ===== MOBILE DEPTH REDUCTION ===== */
/* Global mobile overrides for consistent compact spacing */
@media (max-width: 639px) {
  /* Reduce border radius on cards */
  .rounded-xl {
    border-radius: 0.5rem; /* rounded-lg */
  }

  /* Reduce shadow intensity */
  .shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  }

  /* Reduce default card padding where not explicitly set */
  .card,
  .bg-white.shadow-sm {
    padding: 0.5rem; /* p-2 */
  }

  /* Tighter spacing in common containers */
  .space-y-4 > * + * {
    margin-top: 0.5rem; /* space-y-2 */
  }
}

/* Turbo Frame Loading Indicator and Transitions */
.turbo-frame-loading {
  transition: opacity 0.2s ease-in-out;
  backdrop-filter: blur(2px);
}

.turbo-frame-content {
  transition: opacity 0.15s ease-in-out;
}

/* Fade effect when frame is loading */
turbo-frame#main_content[busy] .turbo-frame-content {
  opacity: 0.6;
  pointer-events: none;
}

/* Ensure loading indicator is above content but below modals */
#turbo-frame-loading {
  z-index: 40;
}

/* ===== GROUPED ENTRIES STYLING ===== */
/* Grouped entry wrapper styling */
.grouped-entry-wrapper {
  transition: all 0.2s ease-in-out;
}

.grouped-entry-wrapper:hover {
  border-color: #3b82f6;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Grouped entry summary */
.grouped-entry-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Expand icon animation */
.expand-icon {
  transition: transform 0.2s ease-in-out;
}

.expand-icon.rotate-180 {
  transform: rotate(180deg);
}

/* Grouped entries content */
.grouped-entries-content {
  transition: all 0.3s ease-in-out;
}

.grouped-entries-content.hidden {
  display: none;
}

/* Hidden grouped entry items */
.entry-collapsible.grouped-entry-item {
  display: none !important;
}

/* Visual indentation for grouped entries when expanded */
.entry-collapsible[data-grouped-in]:not(.grouped-entry-item) td:first-child {
  padding-left: 2rem !important;
  position: relative;
}

/* Add a subtle visual indicator (vertical line) for grouped items */
.entry-collapsible[data-grouped-in]:not(.grouped-entry-item) td:first-child::before {
  content: '';
  position: absolute;
  left: 1.25rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: #93c5fd; /* Light blue to match group wrapper */
}

/* Table-based entry rows */
.entry-row {
  border-bottom: 1px solid #e5e7eb;
}

.entry-content-row {
  border-bottom: 1px solid #e5e7eb;
}

.entry-content-row.hidden {
  display: none;
}

/* Grouped entry table rows */
.grouped-entry-row {
  border-bottom: 2px solid #3b82f6;
}

/* Entry inline fields (visible in collapsed state) */
.entry-inline-field {
  min-width: 120px;
}

/* Table-specific field styling */
.entry-table-field {
  min-width: 100px;
  max-width: 200px;
}

/* Compact select2 in table cells */
td .select2-container {
  width: 100% !important;
  min-width: 120px;
}

td .select2-container .select2-selection {
  min-height: 32px;
  padding: 2px 8px;
  border-radius: 0.375rem;
}

td .select2-container .select2-selection__rendered {
  line-height: 28px;
  padding-left: 4px;
  font-size: 0.875rem;
}

/* Ensure table cells have proper vertical alignment */
.entry-row td {
  vertical-align: middle;
}

/* Grouped entry rows */
.grouped-entry-row td {
  vertical-align: middle;
  font-weight: 500;
}

/* Entry details placeholder */
.entry-details-placeholder {
  color: #9ca3af;
}

/* Grouped entry placeholders (for future use) */
.grouped-entry-placeholder {
  min-height: 1rem;
}

/* Group cost input - editable cost field in grouped rows */
.group-cost-input {
  width: 100px;
  padding: 0.375rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease-in-out;
}

.group-cost-input:hover {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.group-cost-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
  outline: none;
}
