/* ===============================
   1. TIPOGRAFIA E CORES GLOBAIS
   =============================== */
:root {
  /* Um tom de azul mais corporativo e confiável */
  --primary-color: #0f62fe; 
  --primary-hover: #0353e9;
  --bg-color: #f4f7f6;
  --text-main: #1a1a1a;
}

body {
  font-family: 'Inter', sans-serif !important;
  background-color: var(--bg-color);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased; /* Deixa a fonte mais nítida no celular */
}

/* ===============================
   2. INPUTS E SELECTS (Estilo Apple/Moderno)
   =============================== */
.form-control, .form-select {
  border-radius: 12px;
  border: 1px solid #d1d5db;
  padding: 0.75rem 1rem;
  background-color: #ffffff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(15, 98, 254, 0.15); /* Efeito de "anel" ao clicar */
}

.form-label {
  font-weight: 500;
  font-size: 0.9rem;
  color: #4b5563;
  margin-bottom: 0.4rem;
}

/* ===============================
   3. BOTÕES (Mais robustos e amigáveis para o dedo)
   =============================== */
.btn {
  border-radius: 12px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 0.6rem 1.2rem;
  transition: all 0.2s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:active {
  background-color: var(--primary-hover) !important;
  border-color: var(--primary-hover) !important;
  transform: translateY(-1px);
}

/* ===============================
   4. CARDS GLOBAIS (Sombras mais refinadas)
   =============================== */
.card {
  border: none !important;
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03), 0 1px 3px rgba(0,0,0,0.04) !important;
}

/* ===============================
   5. NAVBAR E TABBAR MOBILE 
   =============================== */
.navbar {
  background-color: #121212 !important; /* Um preto mais sofisticado */
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.mobile-tabbar {
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px); /* Aquele efeito embaçado do iPhone */
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.04);
}

.mobile-tabbar a.active {
  background: rgba(15, 98, 254, 0.1) !important; /* Fundo azul claro no botão ativo */
}

.mobile-tabbar a.active div, .mobile-tabbar a.active .icon {
  color: var(--primary-color) !important; /* Cor azul no texto/ícone ativo */
}

html, body { height: 100%; }
body { background: #f6f7fb; }

.card { border-radius: 16px; }
.card.shadow-sm { box-shadow: 0 .25rem 1rem rgba(0,0,0,.06) !important; }

.btn { border-radius: 12px; }

/* Botão Início (desktop) */
.btn-home{ border-radius: 999px; }
.btn, .form-control, .form-select { min-height: 44px; }

.navbar { position: sticky; top: 0; z-index: 1030; }

.mobile-tabbar-spacer { height: 72px; }

.mobile-tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0,0,0,.08);
  padding: 10px 12px;
  z-index: 1040;
}

.mobile-tabbar a{
  width: 25%;
  text-align: center;
  text-decoration: none;
  font-size: 12px;
  color: #333;
}

.mobile-tabbar .icon{
  font-size: 18px;
  line-height: 18px;
}

.checklist-sticky-actions{
  position: sticky;
  bottom: 0;
  background: linear-gradient(to top, #f6f7fb 60%, rgba(246,247,251,0));
  padding-top: 12px;
  margin-top: 16px;
}

/* ===== MOBILE COMPACT HEADER ===== */
@media (max-width: 768px) {

  .navbar {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .navbar-brand {
    font-size: 16px;
  }

  main.container {
    padding-top: 16px !important;
  }

  h2 {
    font-size: 20px;
  }

}

@media (max-width: 768px) {

  .page-header {
    margin-bottom: 12px !important;
  }

}

/* ===== MOBILE COMPACT NAVBAR (FORÇADO) ===== */
@media (max-width: 768px) {

  /* diminui a barra */
  nav.navbar {
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    min-height: 44px !important;
  }

  /* texto da marca menor */
  .navbar .navbar-brand {
    font-size: 16px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.1 !important;
  }

  /* botão "Sair" mais compacto */
  .navbar .btn {
    padding: 4px 10px !important;
    font-size: 13px !important;
    line-height: 1 !important;
  }

  /* tira respiro extra da navbar */
  .navbar .container {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  /* reduz o espaço do conteúdo logo abaixo */
  main.container {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }
}

/* Centralizar texto do botão sair no mobile */
@media (max-width: 768px) {

  .navbar .btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;
    padding: 0 12px !important;
  }

}

@media (max-width: 768px) {

  .navbar .btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 32px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
    border-radius: 20px !important;
  }

}

/* ===== Tabbar: item ativo ===== */
.mobile-tabbar a.active {
  font-weight: 700;
}

.mobile-tabbar a.active .icon {
  transform: translateY(-1px);
}

.mobile-tabbar a.active div {
  color: #0d6efd; /* azul bootstrap */
}

/* ===== TABBAR PILL ATIVO ===== */

.mobile-tabbar a {
  position: relative;
  border-radius: 16px;
  padding: 6px 0;
  transition: all 0.2s ease;
}

/* PILL */
.mobile-tabbar a.active {
  background: #0d6efd;
  color: white !important;
}

/* Texto ativo */
.mobile-tabbar a.active div {
  color: white !important;
}

/* Ícone ativo */
.mobile-tabbar a.active .icon {
  color: white !important;
}

.mobile-tabbar {
  padding: 8px 8px 12px 8px;
}

.mobile-tabbar .d-flex {
  gap: 6px;
}

/* ===============================
   MODO APP INSTALADO (PWA)
================================= */

.standalone-mode nav.navbar {
  display: none;
}

.standalone-mode main.container {
  padding-top: 1rem;
}

/* Dashboard - barra de conformidade */
.dash-progress {
  height: 10px;
  background: #e9ecef;
}

.dash-progress .progress-bar {
  width: calc(var(--pct, 0) * 1%);
  height: 100%;
}

/* Botões de ação (histórico) */
.btn-acao {
  width: 42px;
  height: 42px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.btn-acao i {
  font-size: 1.1rem;
}

/* Botões de ação (cards/listas) - reutiliza no Início */
.btn-acao {
  width: 42px;
  height: 42px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.btn-acao i {
  font-size: 1.1rem;
}

/* Botões do painel central (sem ícone) */
.btn-pill {
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 600;
}

/* um toque mais "premium" no outline */
.btn-pill.btn-outline-primary,
.btn-pill.btn-outline-secondary {
  border-width: 2px;
}

/* Veículos: botões de ação alinhados e padronizados */
.btn-acao{
  width: 44px;
  height: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  line-height: 1;
}

.veic-actions form{
  margin: 0;
}

tr.is-inactive{
  opacity: .65;
}

tr.is-inactive td{
  filter: grayscale(.2);
}

/* Fotos do veículo (Novo Checklist) */
.veh-photo-card{
  background: #fff;
  border: 2px dashed rgba(0,0,0,.15);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  min-height: 150px;
  transition: transform .06s ease, box-shadow .06s ease;
}

.veh-photo-card:hover{
  transform: translateY(-1px);
  box-shadow: 0 .25rem 1rem rgba(0,0,0,.06);
}

.veh-photo-title{
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
}

.veh-photo-placeholder{
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 90px;
  border-radius: 12px;
  background: rgba(0,0,0,.02);
  text-align: center;
  padding: 10px;
}

.veh-photo-preview img{
  width: 100%;
  max-height: 220px;
  object-fit: cover;
}

/* ===============================
   CARDS DO MENU INICIAL (PWA)
   =============================== */
.app-menu-card {
  border-radius: 16px !important;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,.05) !important;
}

.app-menu-card:hover, .app-menu-card:active {
  transform: translateY(-4px);
  box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
  border-color: rgba(0,0,0,.1) !important;
}

.icon-wrapper {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===============================
   AJUSTES FINAIS DO PAINEL DE CARDS
   =============================== */

/* Força os cards a ocuparem a mesma altura e ficarem centralizados */
.home-shortcuts .card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px; /* Altura ideal para o dedo no celular */
}

/* Tamanho dos ícones dentro dos cards no início */
.home-shortcuts .icon-wrapper i {
  font-size: 1.5rem; /* fs-4 */
}

/* Dá um destaque sutil de cor no card ativo */
.app-menu-card.active-shortcut {
  background-color: var(--primary-color) !important;
  color: #ffffff !important;
}

.app-menu-card.active-shortcut h6,
.app-menu-card.active-shortcut div i {
  color: #ffffff !important;
}

/* ===============================
   FORMULÁRIO APP (NOVO CHECKLIST)
   =============================== */
.section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  font-weight: 700;
  color: #6c757d;
  letter-spacing: 0.8px;
  margin-bottom: 0.8rem;
  margin-left: 0.3rem;
}

/* Deixa as fotos de evidência com um fundo mais destacado */
.item-check-card {
  border-radius: 16px;
  background-color: #ffffff;
  border: 1px solid rgba(0,0,0,0.04);
  transition: all 0.2s ease;
}

.item-check-card:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 4px 12px rgba(15, 98, 254, 0.08);
}

/* Suaviza ainda mais os cards de foto do veículo */
.veh-photo-card {
  border-radius: 16px;
  background-color: #fafbfc;
  border: 2px dashed #d1d5db;
}

.veh-photo-card:hover {
  border-color: var(--primary-color);
  background-color: #ffffff;
}

/* Deixa o botão de voltar com estilo iOS */
.btn-back-app {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background-color: #ffffff;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  border: 1px solid rgba(0,0,0,0.03);
  transition: all 0.2s ease;
}

.btn-back-app:active {
  background-color: #f4f7f6;
  transform: scale(0.95);
}
/* ==========================================================================
   TEMA PREMIUM DARK (Grafite, Chumbo e Azul Neon)
   ========================================================================== */
[data-bs-theme="dark"] {
    /* Fundo geral (Grafite Profundo) */
    --bs-body-bg: #121418; 
    --bs-body-color: #e9ecef;
    
    /* Cor principal (Azul Neon) */
    --bs-primary: #00d2ff; 
    --bs-primary-rgb: 0, 210, 255;
    
    /* Links e destaques */
    --bs-link-color: #00d2ff;
    --bs-link-hover-color: #5ce0ff;
    
    /* Bordas sutis e fundo dos Cards (Chumbo) */
    --bs-border-color: rgba(255, 255, 255, 0.08);
    --bs-secondary-bg: #1e2126; 
}

/* Deixando os Cards Flutuantes e Premium */
[data-bs-theme="dark"] .card {
    background-color: var(--bs-secondary-bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* Estilo especial para os botões do Menu Principal */
[data-bs-theme="dark"] .app-menu-card {
    background: linear-gradient(145deg, #1e2126, #16181c);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    transition: all 0.3s ease;
}

[data-bs-theme="dark"] .app-menu-card:hover {
    border-color: var(--bs-primary) !important;
    box-shadow: 0 0 15px rgba(0, 210, 255, 0.2) !important;
}

/* Ajuste nos inputs e formulários para não ofuscarem */
[data-bs-theme="dark"] .form-control, 
[data-bs-theme="dark"] .form-select {
    background-color: #16181c;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-bs-theme="dark"] .form-control:focus, 
[data-bs-theme="dark"] .form-select:focus {
    background-color: #1a1d22;
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.25rem rgba(0, 210, 255, 0.25);
}

/* Deixando os botões primários com contraste correto (Texto escuro no botão neon) */
[data-bs-theme="dark"] .btn-primary {
    color: #000;
    font-weight: 700;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

[data-bs-theme="dark"] .btn-primary:hover {
    background-color: #5ce0ff;
    border-color: #5ce0ff;
    color: #000;
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
}

/* ==========================================================================
   CORREÇÃO DE CONFLITOS DO DARK MODE (Inversão Inteligente)
   ========================================================================== */

/* 1. Transforma tudo que era "Texto Preto" em "Texto Claro" */
[data-bs-theme="dark"] .text-dark {
    color: #f8f9fa !important;
}

/* 2. Transforma os fundos forçados de "Branco/Claro" para "Chumbo/Escuro" */
[data-bs-theme="dark"] .bg-white,
[data-bs-theme="dark"] .bg-light {
    background-color: #1a1d22 !important;
    color: #f8f9fa !important;
    border-color: rgba(255, 255, 255, 0.05) !important;
}

/* 3. Clareia um pouco os textos "cinzas" para dar leitura no fundo preto */
[data-bs-theme="dark"] .text-muted {
    color: #aeb6bf !important;
}

/* 4. Garante que o fundo da página inteira respeite o Grafite */
[data-bs-theme="dark"] body {
    background-color: #121418 !important;
}

/* 5. Ajuste fino para os ícones e botões de voltar não sumirem */
[data-bs-theme="dark"] .btn-back-app {
    color: #f8f9fa !important;
}

/* 6. Força a cor clara nos Títulos */
[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6 {
    color: #f8f9fa !important;
}

/* 7. Reestiliza o botão de voltar (Seta) para o Dark Mode */
[data-bs-theme="dark"] .btn-back-app {
    color: #00d2ff !important; /* Azul neon para destacar a seta */
    background-color: rgba(0, 210, 255, 0.1) !important; /* Fundo azul translúcido */
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    transition: 0.2s;
    border: 1px solid rgba(0, 210, 255, 0.2);
}

[data-bs-theme="dark"] .btn-back-app:hover {
    background-color: rgba(0, 210, 255, 0.2) !important;
}

/* ==========================================================================
   MODO COMPACTO PREMIUM (Mais respiro e leveza na tela)
   ========================================================================== */

/* 1. Deixa os campos de digitar (Inputs e Selects) mais finos */
[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    padding: 0.35rem 0.75rem !important;
    font-size: 0.9rem !important;
    min-height: 38px !important;
}

/* 2. Diminui os títulos em cima dos campos (Labels) para não "gritarem" */
[data-bs-theme="dark"] .form-label {
    font-size: 0.75rem !important;
    margin-bottom: 0.2rem !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

/* 3. Afina os botões (como o de buscar azul e o de limpar) */
[data-bs-theme="dark"] .btn {
    padding: 0.4rem 1rem !important;
    font-size: 0.9rem !important;
}

/* 4. Compacta os textos de "Condutor", "Matrícula" e "KM" nos cards */
[data-bs-theme="dark"] .text-uppercase {
    font-size: 0.7rem !important;
    margin-bottom: 0.1rem !important;
}

/* 8. Corrige o fundo dos cartões customizados (Itens e Fotos) */
[data-bs-theme="dark"] .item-check-card,
[data-bs-theme="dark"] .veh-photo-card {
    background-color: #1a1d22 !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #f8f9fa !important;
    border-radius: 0.75rem;
}

/* Garante que o texto dentro desses cartões fique visível */
[data-bs-theme="dark"] .item-check-card .form-label,
[data-bs-theme="dark"] .veh-photo-title {
    color: #f8f9fa !important;
    opacity: 0.9;
}

/* 9. Corrige o fundo do rodapé fixo (Botão Finalizar) */
[data-bs-theme="dark"] .checklist-sticky-actions {
    background-color: #121418 !important; /* Mesma cor do fundo do app */
    background-image: linear-gradient(rgba(18, 20, 24, 0), #121418 20%) !important; /* Remove degradês brancos */
    border-top: 1px solid rgba(255, 255, 255, 0.05) !important; /* Linha divisória sutil */
}