@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* CRITICAL DISPLAY CONTROL - DO NOT REMOVE */
.hidden {
  display: none !important;
}

:root {
  --brand-purple: #8b5cf6;
  --brand-cyan: #06b6d4;
  --brand-electric: #3b82f6;
  --brand-dark-violet: #0f172a;
  --brand-deep-bg: #0b0f28;
  --brand-surface: #1e293b;
  --border-glass: rgba(255, 255, 255, 0.12);
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: #f8fafc;
  color: #0f172a;
  overflow-x: hidden;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  -webkit-font-smoothing: antialiased;
}

/* Typography Enhancements */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.gradient-bg {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
}

.navbar-gradient {
  background: linear-gradient(135deg, #0b0f28 0%, #1e1b4b 50%, #0f172a 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

/* Navbar Branding & Link Controls */
.brand-title {
  font-size: 1.35rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
}

.logo-glow-wrapper {
  position: relative;
  display: inline-flex;
}

.brand-logo-img {
  height: 26px;
  width: 26px;
  object-fit: cover;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.6));
  transition: transform 0.3s ease;
}

.brand-logo-img:hover {
  transform: scale(1.08) rotate(5deg);
}

.nav-pill-link {
  color: #94a3b8 !important;
  font-weight: 600;
  font-size: 0.82rem;
  padding: 3px 8px !important;
  border-radius: 50rem;
  transition: all 0.25s ease;
}

.nav-pill-link:hover, .nav-pill-link.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.btn-call-cta {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  border: none;
  font-weight: 700;
  transition: all 0.25s ease;
}

.btn-call-cta:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35) !important;
}

.btn-cyan-gradient {
  background: linear-gradient(135deg, #06b6d4 0%, #2563eb 100%);
  color: #ffffff !important;
  font-weight: 700;
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(6, 182, 212, 0.3);
}

.btn-cyan-gradient:hover {
  background: linear-gradient(135deg, #0891b2 0%, #1d4ed8 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(6, 182, 212, 0.45);
}

/* Icon Box Styling */
.icon-box {
  width: 54px !important;
  height: 54px !important;
  min-width: 54px !important;
  min-height: 54px !important;
  border-radius: 16px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.4rem !important;
  margin-bottom: 1.25rem !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
}

/* Glassmorphism Hero Cards & Container */
.hero-glass-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  transition: all 0.25s ease;
}

.hero-glass-card:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-3px);
  border-color: rgba(6, 182, 212, 0.3);
}

/* Sidebar Styles */
.sidebar {
  min-height: 100vh;
  background-color: #0b0f28;
  color: white;
  transition: all 0.3s;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar a {
  color: #94a3b8;
  text-decoration: none;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  border-radius: 12px;
  margin: 4px 12px;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.sidebar a:hover, .sidebar a.active {
  background: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
  color: white !important;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.navbar-brand {
  font-weight: 800;
  padding: 8px 12px;
  font-size: 1.35rem;
  color: white !important;
}

#public-header {
  position: sticky;
  top: 0;
  z-index: 1040;
  width: 100%;
  margin-top: 0;
  background: linear-gradient(135deg, #0b0f28 0%, #1e1b4b 50%, #0f172a 100%);
}

/* Stats Cards */
.card-stats {
  margin-bottom: 20px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
  border: none;
  border-radius: 16px;
  transition: all 0.25s ease;
}

.card-stats:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px -5px rgba(0,0,0,0.1);
}

.card-stats .card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
}

.card-stats .icon {
  font-size: 2.75rem;
  opacity: 0.85;
}

.table-responsive {
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  border: 1px solid #f1f5f9;
}

.setting-card {
  border-radius: 16px;
  border-top: 4px solid;
}

.setting-card.work { border-top-color: #3b82f6; }
.setting-card.geofence { border-top-color: #ef4444; }
.setting-card.holiday { border-top-color: #10b981; }

.hover-lift {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 35px -10px rgba(0,0,0,0.1) !important;
}

.hover-cyan:hover {
  color: #06b6d4 !important;
  transition: color 0.2s ease;
}

/* Map Heartbeat Animation */
.heartbeat {
  animation: heartbeat 1.5s infinite;
}
@keyframes heartbeat {
  0% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.8; box-shadow: 0 0 12px red; }
  100% { transform: scale(1); opacity: 1; }
}

/* Custom Ping & Status Badges */
.btn-ping {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  font-weight: 600;
  transition: all 0.2s ease;
  border-radius: 8px;
}
.btn-ping:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.badge-ping {
  background-color: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.speed-badge {
  background-color: #fef3c7;
  color: #d97706;
  font-weight: 700;
  border-radius: 6px;
  padding: 2px 8px;
}

.battery-badge {
  background-color: #f3f4f6;
  color: #374151;
  font-weight: 600;
  border-radius: 6px;
  padding: 2px 8px;
}

.pending-badge {
  background-color: #fff7ed;
  color: #c2410c;
  border: 1px solid #ffedd5;
  font-weight: 700;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #0b0f28;
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #7c3aed;
}

/* ==========================================================================
   MOBILE UI RESPONSIVE FIXES & LAYOUT SAFEGUARDS
   ========================================================================== */

/* Safeguard against horizontal overflow / page wobbling */
body, #auth-container, #dashboard-container, footer, header, main, section {
  max-width: 100vw;
  overflow-x: clip;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

@media (max-width: 991.98px) {
  /* ISSUE 1 FIX: Eliminate huge vertical gap between Navbar and Hero Section */
  .hero-section,
  #auth-container > section:first-of-type {
    min-height: auto !important;
    padding-top: 1rem !important;
    padding-bottom: 2rem !important;
    display: block !important;
  }

  .hero-section .container,
  #auth-container > section:first-of-type .container {
    padding-top: 0.25rem !important;
    padding-bottom: 0.75rem !important;
  }

  /* Subpage header banners top gap fix */
  .subpage-banner,
  body > .text-white.py-5,
  body > div.py-5,
  section.py-5 {
    padding-top: 1.25rem !important;
    padding-bottom: 1.5rem !important;
  }

  /* ISSUE 2 FIX: Keep Navigation Bar pinned top without half hiding */
  #public-header {
    position: sticky !important;
    top: 0 !important;
    z-index: 1040 !important;
  }

  #public-header .navbar-brand {
    padding-top: 0.35rem !important;
    padding-bottom: 0.35rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  .brand-title {
    font-size: 1.15rem !important;
  }

  .brand-logo-img {
    height: 24px !important;
    width: 24px !important;
  }

  /* ISSUE 3 FIX: Eliminate row negative margin horizontal overflow on mobile screens */
  .row {
    --bs-gutter-x: 0.75rem;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  /* Fix container padding on small screens */
  .container, .container-fluid {
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
  }
}

/* ==========================================================================
   ADVANCED PWA ADD TO HOME SCREEN & COOKIE CONSENT DIALOG STYLES
   ========================================================================== */

/* 1. Add to Home Screen Dialog (Top Center) */
.pwa-dialog-wrapper {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1070;
  max-width: 420px;
  width: calc(100% - 32px);
  box-sizing: border-box;
  animation: pwaSlideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes pwaSlideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.pwa-dialog-card {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(6, 182, 212, 0.35);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(6, 182, 212, 0.15);
  position: relative;
  overflow: hidden;
}

.pwa-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.pwa-close-btn:hover {
  opacity: 1;
}

.pwa-app-icon {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border: 2px solid rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
}

.pwa-features-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.pwa-feature-item {
  display: flex;
  align-items: center;
}

/* Mobile alignment for PWA Dialog */
@media (max-width: 576px) {
  .pwa-dialog-wrapper {
    top: 12px;
    left: 50% !important;
    right: auto !important;
    width: calc(100% - 24px) !important;
    max-width: 420px !important;
  }
  .pwa-dialog-card {
    padding: 1.25rem !important;
  }
  .pwa-features-grid {
    font-size: 0.78rem;
    padding: 8px 12px;
  }
}

/* 2. Cookie Consent Bottom Banner */
.cookie-dialog-wrapper {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 1080px;
  z-index: 1060;
  animation: cookieSlideUp 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cookieSlideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 40px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.cookie-dialog-card {
  background: linear-gradient(135deg, rgba(11, 15, 40, 0.95) 0%, rgba(30, 27, 75, 0.95) 100%);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(168, 85, 247, 0.3);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(124, 58, 237, 0.15);
}

.cookie-icon-wrapper {
  background: rgba(6, 182, 212, 0.15) !important;
  border: 1px solid rgba(6, 182, 212, 0.3);
}

/* ==========================================================================
   PERFORMANCE & ACCESSIBILITY OPTIMIZATIONS (LIGHTHOUSE ENHANCEMENTS)
   ========================================================================== */

/* Font Display Swap Fallback */
@font-face {
  font-display: swap;
}

/* Accessibility Color Contrast Enhancements for Badges */
.bg-primary-subtle.text-primary-emphasis {
  color: #1e40af !important;
  background-color: #dbeafe !important;
}

.bg-success-subtle.text-success-emphasis {
  color: #065f46 !important;
  background-color: #d1fae5 !important;
}

/* Clear focus outlines for keyboard navigation & screen readers */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid #06b6d4 !important;
  outline-offset: 2px !important;
}


