/* ============================================
   C-SKel SC Portal — Mobile-First Custom CSS
   ============================================ */

/* ---- Base Font ---- */
body {
  font-family: 'Plus Jakarta Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Bottom Mobile Nav Bar ---- */
#mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 999;
  display: none;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  padding-bottom: env(safe-area-inset-bottom);
}

#mobile-bottom-nav a,
#mobile-bottom-nav button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px 6px;
  font-size: 9px;
  font-weight: 700;
  color: #64748b;
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  letter-spacing: 0.02em;
  min-width: 0;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s, background 0.15s;
  border-radius: 12px 12px 0 0;
}

#mobile-bottom-nav a.active,
#mobile-bottom-nav a:active {
  color: #2563eb;
  background: #eff6ff;
}

#mobile-bottom-nav .nav-icon {
  font-size: 22px;
  line-height: 1;
}

/* Show bottom nav on small screens only */
@media (max-width: 767px) {
  #mobile-bottom-nav {
    display: flex;
  }
  /* Add bottom padding so content isn't hidden behind bottom nav */
  main {
    padding-bottom: 72px;
  }
  /* Hide desktop footer text on small screens */
  footer {
    padding-bottom: calc(72px + 16px);
  }
}

/* ---- Mobile Form Improvements ---- */
@media (max-width: 640px) {
  /* Remove large horizontal padding on forms */
  .max-w-6xl.mx-auto,
  .max-w-7xl.mx-auto {
    padding-left: 12px;
    padding-right: 12px;
  }

  /* Compact paper container on mobile */
  .paper {
    padding: 20px 16px !important;
  }

  /* Make tables scrollable on mobile */
  .overflow-x-auto {
    -webkit-overflow-scrolling: touch;
  }

  /* Score buttons — make slightly bigger for touch */
  .crit-btn,
  [class*="crit-btn-"] {
    width: 36px !important;
    height: 36px !important;
    font-size: 14px !important;
    touch-action: manipulation;
  }

  /* OPR action items table inputs */
  #oprActionsTable input,
  #oprActionsTable select,
  #monTable input,
  #monTable select {
    min-width: 80px;
    font-size: 12px;
  }
}

/* ---- Canvas Signature on Mobile ---- */
@media (max-width: 640px) {
  canvas {
    touch-action: none;
  }
}

/* ---- PWA Splash / Install prompt ---- */
#pwa-install-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 10000;
  background: linear-gradient(135deg, #1e3a5f, #2563eb);
  color: white;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  transform: translateY(100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
}

#pwa-install-bar.show {
  transform: translateY(0);
}

@media print {
  header, footer, nav, #mobile-bottom-nav, #quickAddOverlay, #quickAddPanel, #pwa-install-bar, #pwa-install-bar * {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
  }
}

#pwa-install-bar button {
  font-weight: 700;
  font-size: 12px;
  border-radius: 20px;
  padding: 6px 18px;
  cursor: pointer;
  transition: opacity 0.2s;
}

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shine 1.4s infinite;
  border-radius: 8px;
}

@keyframes skeleton-shine {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---- Active page highlight for bottom nav ---- */
#mobile-bottom-nav a[data-active="true"] {
  color: #2563eb;
  background: #eff6ff;
}

/* ---- Smooth page transitions ---- */
main {
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Card hover effects ---- */
.stat-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

/* ---- Ensure inputs are big enough on mobile (prevent iOS zoom) ---- */
@media (max-width: 767px) {
  input, select, textarea {
    font-size: 16px !important;
  }
}
