/* ========================================================
   GLAC & Refrigeration Service - Mobile Optimization & Crisp UI
   ======================================================== */

/* 1. FIX MOBILE BLUR ISSUE (Completely hide backdrop when sidebar closed) */
.ehs-sidebar-backdrop {
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.ehs-sidebar-backdrop.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  background: rgba(15, 23, 42, 0.5) !important;
  backdrop-filter: blur(2px) !important;
  -webkit-backdrop-filter: blur(2px) !important;
  z-index: 1029 !important;
}

/* 2. CRISP FONT RENDERING & PREVENT MOBILE SUBPIXEL BLUR */
html, body {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: optimizeLegibility !important;
  -webkit-text-size-adjust: 100% !important;
  overflow-x: hidden !important;
}

/* 3. MOBILE RESPONSIVE LAYOUT ENHANCEMENTS */
@media (max-width: 991.98px) {
  body {
    padding-bottom: 74px !important; /* Space for bottom nav */
  }

  .ehs-content {
    margin-left: 0 !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .ehs-main {
    padding: 1rem 0.85rem !important;
  }

  .ehs-topbar {
    padding: 0.75rem 1rem !important;
    position: sticky;
    top: 0;
    z-index: 1020;
    background: #ffffff !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  }

  /* Stat cards on mobile */
  .ehs-stat-card {
    padding: 0.85rem 0.95rem !important;
    min-height: 82px !important;
  }

  .ehs-stat-label {
    font-size: 0.72rem !important;
  }

  .ehs-stat-value {
    font-size: 1.15rem !important;
  }

  .ehs-stat-icon {
    width: 38px !important;
    height: 38px !important;
    font-size: 1rem !important;
  }

  /* Prevent mobile form auto-zoom causing zoom blur */
  .form-control, .form-select {
    font-size: 15px !important;
  }
}

/* 4. SMOOTH TABLE TOUCH SCROLLING */
.table-responsive {
  -webkit-overflow-scrolling: touch !important;
  scrollbar-width: thin;
}

/* 5. MOBILE BOTTOM NAVIGATION BAR */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: #ffffff !important;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1040;
  box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.06);
}

.mobile-bottom-nav .nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.7rem;
  font-weight: 600;
  text-decoration: none;
  padding: 4px 10px;
  position: relative;
  transition: all 0.15s ease;
}

.mobile-bottom-nav .nav-item i {
  font-size: 1.2rem;
  margin-bottom: 2px;
}

.mobile-bottom-nav .nav-item.active {
  color: #0284c7 !important;
}

.mobile-bottom-nav .nav-item .badge-pill {
  position: absolute;
  top: 1px;
  right: 12px;
  background: #ef4444;
  color: white;
  border-radius: 9999px;
  font-size: 0.58rem;
  padding: 1px 4px;
}

/* 6. FLOATING QUICK ACTION BUTTON FOR MOBILE */
.mobile-fab {
  position: fixed;
  bottom: 74px;
  right: 16px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
  z-index: 1039;
  text-decoration: none;
  transition: transform 0.2s;
}

.mobile-fab:hover, .mobile-fab:active {
  transform: scale(1.08);
  color: white;
}

@media (min-width: 992px) {
  .mobile-bottom-nav, .mobile-fab {
    display: none !important;
  }
}

/* 7. WARRANTY BADGES & ALERT EFFECTS */
.badge-warranty-active {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border: 1px solid #a7f3d0 !important;
  font-weight: 600;
}

.badge-warranty-warning {
  background-color: #fffbeb !important;
  color: #b45309 !important;
  border: 1px solid #fde68a !important;
  font-weight: 700;
  animation: pulse-amber 2s infinite ease-in-out;
}

.badge-warranty-expired {
  background-color: #fef2f2 !important;
  color: #b91c1c !important;
  border: 1px solid #fecaca !important;
  font-weight: 600;
}

@keyframes pulse-amber {
  0% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(245, 158, 11, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
  }
}

/* Warranty Card Alert Box */
.warranty-alert-card {
  border-left: 4px solid #f59e0b !important;
  background: #fffdf5;
}

/* 8. PRINT INVOICE STYLES */
@media print {
  .ehs-sidebar, .ehs-topbar, .mobile-bottom-nav, .mobile-fab, .btn-print, .btn-back, footer, .no-print {
    display: none !important;
  }
  .ehs-content, .ehs-main {
    margin: 0 !important;
    padding: 0 !important;
  }
  .invoice-card {
    border: none !important;
    box-shadow: none !important;
  }
}
