/* ==========================================================================
   WJ TRANSPORTES — DESIGN SYSTEM OFICIAL & RESPONSIVO
   Cores: #231f54 (Azul Escuro), #579cba / #5c9ebd (Azul Água),
          #399107 (Verde Ação), #e5f3b6 (Verde Claro), #e9e100 (Amarelo)
   Breakpoints: Mobile (< 768px), Tablet (768px - 991px), Desktop (>= 992px)
   ========================================================================== */

:root {
  --wj-primary: #231f54;
  --wj-primary-rgb: 35, 31, 84;
  --wj-primary-hover: #19163c;
  
  --wj-secondary: #579cba;
  --wj-secondary-light: #5c9ebd;
  --wj-secondary-rgb: 87, 156, 186;
  
  --wj-accent: #399107;
  --wj-accent-hover: #2e7506;
  --wj-accent-rgb: 57, 145, 7;
  
  --wj-light-green: #e5f3b6;
  --wj-yellow: #e9e100;
  
  --wj-dark: #0f172a;
  --wj-light: #f8fafc;
  --wj-border: #e2e8f0;
  --wj-text-muted: #64748b;
  
  --wj-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --wj-radius: 12px;
  --wj-radius-lg: 20px;
  --wj-shadow-sm: 0 2px 8px rgba(35, 31, 84, 0.04);
  --wj-shadow: 0 10px 25px -5px rgba(35, 31, 84, 0.08), 0 8px 10px -6px rgba(35, 31, 84, 0.04);
  --wj-shadow-lg: 0 20px 35px -10px rgba(35, 31, 84, 0.15);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--wj-font);
  color: #1e293b;
  background-color: #ffffff;
  overflow-x: hidden;
  line-height: 1.6;
  font-size: 1rem;
}

/* Tipografia Fluida */
h1, h2, h3, h4, h5, h6 {
  color: var(--wj-primary);
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1, .h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
h2, .h2 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h3, .h3 { font-size: clamp(1.3rem, 2.5vw, 1.85rem); }
h4, .h4 { font-size: clamp(1.15rem, 2vw, 1.45rem); }
h5, .h5 { font-size: clamp(1rem, 1.5vw, 1.25rem); }
h6, .h6 { font-size: 0.95rem; }

.fw-extrabold { font-weight: 800; }

/* Botões Customizados */
.btn {
  font-weight: 600;
  transition: all 0.25s ease;
  touch-action: manipulation;
}

.btn-wj-primary {
  background-color: var(--wj-primary);
  color: #ffffff;
  border: none;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
}
.btn-wj-primary:hover, .btn-wj-primary:focus {
  background-color: var(--wj-primary-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(35, 31, 84, 0.25);
}

.btn-wj-action {
  background-color: var(--wj-accent);
  color: #ffffff;
  border: none;
  font-weight: 600;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
}
.btn-wj-action:hover, .btn-wj-action:focus {
  background-color: var(--wj-accent-hover);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(57, 145, 7, 0.3);
}

.btn-wj-outline {
  border: 2px solid var(--wj-secondary);
  color: var(--wj-primary);
  font-weight: 600;
  padding: 0.65rem 1.5rem;
  border-radius: 50px;
  background: transparent;
}
.btn-wj-outline:hover, .btn-wj-outline:focus {
  background-color: var(--wj-secondary);
  color: #ffffff;
}

/* Header & Navbar */
.navbar-wj {
  background-color: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  padding: 0.8rem 0;
}
.navbar-wj .nav-link {
  color: var(--wj-primary);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  transition: color 0.2s ease;
}
.navbar-wj .nav-link:hover, .navbar-wj .nav-link.active {
  color: var(--wj-secondary);
}

.navbar-brand-logo {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--wj-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
}
.navbar-brand-logo .logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--wj-secondary), var(--wj-primary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.15rem;
  flex-shrink: 0;
}

/* Hero Section */
.hero-section {
  position: relative;
  background: linear-gradient(135deg, rgba(35, 31, 84, 0.96) 0%, rgba(87, 156, 186, 0.88) 100%), url('https://images.unsplash.com/photo-1541888946425-d0fbb18086f6?auto=format&fit=crop&w=1920&q=80') center/cover no-repeat;
  color: #ffffff;
  padding: 8rem 0 5.5rem;
  min-height: 82vh;
  display: flex;
  align-items: center;
}
.hero-title {
  font-size: clamp(2rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.15;
  color: #ffffff;
  margin-bottom: 1.25rem;
}
.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: #e2e8f0;
  margin-bottom: 1.8rem;
  line-height: 1.6;
}
.hero-badge {
  background-color: rgba(229, 243, 182, 0.22);
  color: var(--wj-light-green);
  border: 1px solid var(--wj-light-green);
  padding: 0.35rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

/* Cards de Serviços */
.service-card {
  background: #ffffff;
  border: 1px solid var(--wj-border);
  border-radius: var(--wj-radius);
  padding: 1.75rem;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--wj-shadow-lg);
  border-color: var(--wj-secondary);
}
.service-icon-box {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(87, 156, 186, 0.12);
  color: var(--wj-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.25rem;
  flex-shrink: 0;
}

/* Seção de Métricas / Stats Bar */
.stats-bar {
  background: #ffffff;
  border-radius: var(--wj-radius);
  box-shadow: var(--wj-shadow);
  padding: 2.2rem 1.5rem;
  margin-top: -3.5rem;
  position: relative;
  z-index: 10;
  border: 1px solid var(--wj-border);
}
.stat-number {
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  font-weight: 800;
  color: var(--wj-primary);
  line-height: 1;
}

/* Simulador de Orçamento Card */
.calculator-box {
  background: #ffffff;
  color: var(--wj-dark);
  border-radius: var(--wj-radius-lg);
  box-shadow: var(--wj-shadow-lg);
  border: 1px solid var(--wj-border);
  padding: 2.25rem;
}
.calculator-box label,
.calculator-box .form-label {
  color: var(--wj-dark);
}
.calculator-box .fw-bold {
  color: var(--wj-dark);
}
.calculator-box .text-muted {
  color: var(--wj-text-muted) !important;
}
.calculator-box .text-primary {
  color: var(--wj-primary) !important;
}
.calculator-box .text-success {
  color: var(--wj-accent) !important;
}

/* Range Inputs Touch-Friendly */
.form-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  background-color: var(--wj-primary);
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.form-range::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background-color: var(--wj-primary);
  cursor: pointer;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* Botão Flutuante de WhatsApp */
.whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #25D366;
  color: white;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
  z-index: 9999;
  text-decoration: none;
  transition: all 0.3s ease;
}
.whatsapp-float:hover, .whatsapp-float:focus {
  transform: scale(1.08);
  color: white;
}
.whatsapp-float::before {
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background-color: #25D366;
  opacity: 0.6;
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.3); opacity: 0; }
  100% { transform: scale(0.95); opacity: 0; }
}

/* ==========================================================================
   ESTRUTURA DO PAINEL ADMIN & ÁREA DO CLIENTE
   ========================================================================== */

.admin-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  background-color: #f8fafc;
}

.admin-sidebar {
  width: 260px;
  background-color: #231f54;
  color: white;
  flex-shrink: 0;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1050;
}

.admin-sidebar .nav-link {
  color: #cbd5e1;
  padding: 0.65rem 1rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  transition: all 0.2s ease;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.admin-content {
  flex-grow: 1;
  background-color: #f8fafc;
  overflow-y: auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.85rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 1040;
  display: none;
}
.sidebar-backdrop.show {
  display: block;
}

/* Área do Cliente Navigation */
.client-nav {
  background-color: #231f54;
}
.client-nav .nav-link {
  color: #cbd5e1;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.6rem 0.9rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}
.client-nav .nav-link:hover,
.client-nav .nav-link.active {
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* ==========================================================================
   COMPONENTES ESPECÍFICOS DO DASHBOARD ADMIN
   ========================================================================== */

.kpi-card {
  background: #ffffff;
  border-radius: var(--wj-radius);
  border: 1px solid var(--wj-border);
  padding: 1.25rem;
  transition: all 0.25s ease;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--wj-shadow-sm);
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--wj-shadow);
  border-color: var(--wj-secondary);
}
.kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.kpi-value {
  font-size: clamp(1.25rem, 2.5vw, 1.6rem);
  font-weight: 800;
  line-height: 1.2;
}

.dashboard-card {
  background: #ffffff;
  border-radius: var(--wj-radius);
  border: 1px solid var(--wj-border);
  box-shadow: var(--wj-shadow-sm);
  padding: 1.25rem 1.5rem;
  transition: box-shadow 0.2s ease;
}
.dashboard-card:hover {
  box-shadow: var(--wj-shadow);
}

.truck-status-list {
  max-height: 420px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 4px;
}
.truck-status-list::-webkit-scrollbar {
  width: 5px;
}
.truck-status-list::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

.quick-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50px;
  white-space: nowrap;
  transition: all 0.2s ease;
}
.quick-action-btn:hover {
  transform: translateY(-2px);
}

/* ==========================================================================
   TABELAS ANALÍTICAS E RESPONSIVIDADE
   ========================================================================== */

.table-responsive {
  -webkit-overflow-scrolling: touch;
  border-radius: var(--wj-radius);
}

.table-responsive::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}
.table-responsive::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.table-analytics {
  font-size: 0.85rem;
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 800px;
}
.table-analytics thead th {
  background-color: var(--wj-primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  padding: 10px 8px;
  border: none;
  white-space: nowrap;
}
.table-analytics tbody tr:nth-child(even) {
  background-color: #f8fafc;
}
.table-analytics tbody td {
  padding: 8px 8px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
  white-space: nowrap;
}
.table-analytics tfoot td {
  background-color: #f1f5f9;
  font-weight: 800;
  border-top: 2px solid var(--wj-primary);
  white-space: nowrap;
}

/* Badges e Status */
.badge-status-pago {
  background-color: #dcfce7;
  color: #166534;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  display: inline-block;
}
.badge-status-pendente {
  background-color: #fef9c3;
  color: #854d0e;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  display: inline-block;
}
.badge-status-atraso {
  background-color: #fee2e2;
  color: #991b1b;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 50px;
  font-size: 0.8rem;
  display: inline-block;
}

/* Nav Pills Scrollable */
.nav-pills-scrollable {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  gap: 0.5rem;
}
.nav-pills-scrollable::-webkit-scrollbar {
  height: 4px;
}
.nav-pills-scrollable .nav-item {
  flex-shrink: 0;
}
@media (min-width: 992px) {
  .nav-pills-scrollable {
    flex-wrap: wrap;
    overflow-x: visible;
  }
}

/* Map Containers */
#live-map, #admin-fleet-map {
  height: clamp(320px, 45vh, 440px);
  width: 100%;
  border-radius: var(--wj-radius);
  border: 1px solid var(--wj-border);
}

/* Footer */
.footer-wj {
  background-color: var(--wj-primary);
  color: #cbd5e1;
  padding: 4rem 0 2rem;
}
.footer-wj h5 {
  color: #ffffff;
  margin-bottom: 1.25rem;
  font-size: 1.1rem;
}
.footer-wj a {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-wj a:hover {
  color: #ffffff;
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 2rem;
  margin-top: 3rem;
  font-size: 0.85rem;
}

/* ==========================================================================
   MEDIA QUERIES RESPONSIVAS
   ========================================================================== */

/* Tablets e Telas Menores (< 992px) */
@media (max-width: 991.98px) {
  .hero-section {
    padding: 6.5rem 0 4rem;
    min-height: auto;
  }
  
  .stats-bar {
    margin-top: 2rem;
    padding: 1.75rem 1.25rem;
  }
  
  .calculator-box {
    margin-top: 2rem;
    padding: 1.75rem 1.5rem;
  }
  
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -290px;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
  .admin-sidebar.show {
    left: 0;
  }
  
  .admin-topbar {
    padding: 0.75rem 1rem;
  }

  .dashboard-card {
    padding: 1rem;
  }
}

/* Mobile Devices (< 768px) */
@media (max-width: 767.98px) {
  .hero-section {
    padding: 5.5rem 0 3rem;
    text-align: center;
  }
  
  .hero-section .d-flex.gap-3 {
    justify-content: center;
  }
  
  .stats-bar {
    margin-top: 1.5rem;
    padding: 1.25rem 0.75rem;
  }
  
  .stats-bar .border-end {
    border-right: none !important;
  }
  
  .stats-bar .col-6:nth-child(1),
  .stats-bar .col-6:nth-child(3) {
    border-right: 1px solid var(--wj-border) !important;
  }
  .stats-bar .col-6:nth-child(1),
  .stats-bar .col-6:nth-child(2) {
    border-bottom: 1px solid var(--wj-border);
    padding-bottom: 0.75rem;
  }
  .stats-bar .col-6:nth-child(3),
  .stats-bar .col-6:nth-child(4) {
    padding-top: 0.75rem;
  }
  
  .navbar-brand-logo {
    font-size: 1.15rem;
  }
  
  .footer-wj {
    padding: 3rem 0 1.5rem;
    text-align: center;
  }
  .footer-wj .d-flex.gap-3 {
    justify-content: center;
  }

  .kpi-card {
    padding: 1rem;
  }
  .kpi-icon {
    width: 40px;
    height: 40px;
    font-size: 1.25rem;
  }
}

/* Telas Pequenas (< 576px) */
@media (max-width: 575.98px) {
  .calculator-box {
    padding: 1.25rem 1rem;
    border-radius: 16px;
  }
  
  .btn-wj-primary, .btn-wj-action, .btn-wj-outline {
    padding: 0.65rem 1.25rem;
    font-size: 0.92rem;
  }
  
  .whatsapp-float {
    bottom: 16px;
    right: 16px;
    width: 50px;
    height: 50px;
    font-size: 26px;
  }
  
  .service-card {
    padding: 1.25rem;
  }
  
  .card-body {
    padding: 1.25rem;
  }
  
  .display-6 {
    font-size: 1.65rem;
  }
}

/* ==========================================================================
   ADMIN MOBILE CARDS (Transformação de Tabelas em Cards no Mobile)
   ========================================================================== */
.admin-mobile-cards {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.admin-mobile-card {
  background: #ffffff;
  border: 1px solid var(--wj-border);
  border-radius: var(--wj-radius);
  padding: 1rem;
  box-shadow: var(--wj-shadow-sm);
  transition: all 0.2s ease;
}
.admin-mobile-card:hover {
  border-color: var(--wj-secondary);
  box-shadow: var(--wj-shadow);
}

.admin-mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding-bottom: 0.65rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid #f1f5f9;
}

.admin-mobile-card-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--wj-primary);
  margin-bottom: 0;
}

.admin-mobile-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem 0.75rem;
  font-size: 0.85rem;
}

.admin-mobile-card-grid.cols-1 {
  grid-template-columns: 1fr;
}

.admin-mobile-card-item {
  display: flex;
  flex-direction: column;
}

.admin-mobile-card-item.full-width {
  grid-column: 1 / -1;
}

.admin-mobile-card-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--wj-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.admin-mobile-card-value {
  font-size: 0.88rem;
  color: #1e293b;
  font-weight: 500;
  word-break: break-word;
}

.admin-mobile-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px dashed #e2e8f0;
  flex-wrap: wrap;
}

/* ==========================================================================
   BOTÃO VOLTAR AO TOPO (SCROLL TO TOP)
   ========================================================================== */
.scroll-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: var(--wj-primary);
  color: #ffffff;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(35, 31, 84, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
  outline: none;
}

.scroll-to-top:hover,
.scroll-to-top:focus {
  background-color: var(--wj-secondary);
  color: #ffffff;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(87, 156, 186, 0.45);
}

.scroll-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Quando posicionado junto ao botão flutuante de WhatsApp */
.scroll-to-top.with-whatsapp {
  bottom: 92px;
}

@media (max-width: 575.98px) {
  .scroll-to-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }
  .scroll-to-top.with-whatsapp {
    bottom: 76px;
  }
}


