/* ============================================
   CDC – Central Digital do Condutor
   CSS Global + Responsivo
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --azul-escuro:   #0a1628;
  --azul-medio:    #102a52;
  --azul-claro:    #1a4080;
  --azul-accent:   #1e5aaa;
  --verde:         #00c853;
  --verde-hover:   #00a846;
  --prata:         #b0bec5;
  --prata-claro:   #eceff1;
  --branco:        #ffffff;
  --cinza-bg:      #f4f6fa;
  --cinza-borda:   #dde3ec;
  --texto-escuro:  #0d1b2e;
  --texto-medio:   #3a4a5c;
  --texto-claro:   #6b7d93;
  --sombra-sm:     0 2px 8px rgba(10,22,40,.10);
  --sombra-md:     0 6px 24px rgba(10,22,40,.14);
  --sombra-lg:     0 16px 48px rgba(10,22,40,.18);
  --radius:        12px;
  --radius-sm:     8px;
  --radius-lg:     20px;
  --transition:    .25s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--cinza-bg);
  color: var(--texto-escuro);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--prata-claro); }
::-webkit-scrollbar-thumb { background: var(--azul-claro); border-radius: 10px; }

/* ── Utilities ── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem; letter-spacing: .3px;
  transition: all var(--transition); cursor: pointer;
}
.btn-primary {
  background: var(--verde); color: var(--branco);
  box-shadow: 0 4px 16px rgba(0,200,83,.35);
}
.btn-primary:hover { background: var(--verde-hover); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,200,83,.4); }

.btn-secondary {
  background: transparent; color: var(--branco);
  border: 2px solid rgba(255,255,255,.5);
}
.btn-secondary:hover { background: rgba(255,255,255,.12); border-color: var(--branco); transform: translateY(-2px); }

.btn-outline {
  background: transparent; color: var(--azul-accent);
  border: 2px solid var(--azul-accent);
}
.btn-outline:hover { background: var(--azul-accent); color: var(--branco); }

.btn-danger { background: #ef4444; color: var(--branco); }
.btn-danger:hover { background: #dc2626; }

.btn-sm { padding: 8px 18px; font-size: .8rem; }
.btn-lg { padding: 16px 36px; font-size: 1rem; }

.badge {
  display: inline-block; padding: 4px 12px;
  border-radius: 20px; font-size: .75rem; font-weight: 600;
}
.badge-green  { background: rgba(0,200,83,.15); color: #00a846; }
.badge-yellow { background: rgba(255,193,7,.15);  color: #d97706; }
.badge-blue   { background: rgba(26,64,128,.12); color: var(--azul-accent); }
.badge-red    { background: rgba(239,68,68,.12);  color: #dc2626; }
.badge-gray   { background: rgba(107,125,147,.12); color: var(--texto-claro); }

/* ── Tag status ── */
.status-concluido  { background: rgba(0,200,83,.13);  color: #00a846; }
.status-andamento  { background: rgba(30,90,170,.13); color: var(--azul-accent); }
.status-pendente   { background: rgba(245,158,11,.13); color: #d97706; }

/* ── Cards ── */
.card {
  background: var(--branco);
  border-radius: var(--radius);
  box-shadow: var(--sombra-sm);
  border: 1px solid var(--cinza-borda);
  transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--sombra-md); }

/* ── Forms ── */
.form-group { margin-bottom: 20px; }
.form-group label {
  display: block; margin-bottom: 6px;
  font-weight: 500; font-size: .875rem; color: var(--texto-medio);
}
.form-control {
  width: 100%; padding: 11px 16px;
  border: 1.5px solid var(--cinza-borda);
  border-radius: var(--radius-sm); font-size: .9rem;
  color: var(--texto-escuro); background: var(--branco);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-control:focus {
  border-color: var(--azul-accent);
  box-shadow: 0 0 0 3px rgba(30,90,170,.12);
}
.form-control::placeholder { color: var(--texto-claro); }

select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7d93'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 40px; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: var(--azul-escuro); }
thead th { padding: 14px 16px; color: var(--branco); font-weight: 600; text-align: left; white-space: nowrap; }
tbody tr { border-bottom: 1px solid var(--cinza-borda); transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(30,90,170,.04); }
tbody td { padding: 13px 16px; color: var(--texto-medio); vertical-align: middle; }
tbody td:first-child { font-weight: 500; color: var(--texto-escuro); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(10,22,40,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; visibility: hidden;
  transition: all var(--transition);
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
  background: var(--branco); border-radius: var(--radius-lg);
  width: 100%; max-width: 620px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--sombra-lg);
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 20px; border-bottom: 1px solid var(--cinza-borda);
}
.modal-header h3 { font-size: 1.15rem; font-weight: 700; color: var(--texto-escuro); }
.modal-close { background: var(--cinza-bg); border: none; border-radius: 50%; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--texto-claro); transition: all var(--transition); }
.modal-close:hover { background: #fee2e2; color: #dc2626; }
.modal-body { padding: 24px 28px; }
.modal-footer { padding: 16px 28px 24px; display: flex; gap: 12px; justify-content: flex-end; border-top: 1px solid var(--cinza-borda); }

/* ── Toast ── */
#toast-container { position: fixed; bottom: 28px; right: 28px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  min-width: 280px; padding: 14px 18px;
  border-radius: var(--radius-sm); box-shadow: var(--sombra-md);
  display: flex; align-items: center; gap: 12px;
  font-weight: 500; font-size: .875rem;
  animation: toastIn .3s ease forwards;
}
.toast.success { background: var(--azul-escuro); color: var(--branco); border-left: 4px solid var(--verde); }
.toast.error   { background: #fef2f2; color: #991b1b; border-left: 4px solid #ef4444; }
.toast.info    { background: var(--azul-escuro); color: var(--branco); border-left: 4px solid var(--azul-accent); }
.toast.out     { animation: toastOut .3s ease forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(40px); } }

/* ── Loading spinner ── */
.spinner { width: 20px; height: 20px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: var(--branco); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page loader ── */
#page-loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--azul-escuro);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 20px; transition: opacity .5s ease;
}
#page-loader .logo-loader { font-size: 2rem; font-weight: 900; color: var(--branco); letter-spacing: 2px; }
#page-loader .logo-loader span { color: var(--verde); }
#page-loader .loader-bar { width: 200px; height: 3px; background: rgba(255,255,255,.15); border-radius: 10px; overflow: hidden; }
#page-loader .loader-bar-fill { height: 100%; background: var(--verde); border-radius: 10px; animation: loadBar 1.5s ease forwards; }
@keyframes loadBar { from { width: 0; } to { width: 100%; } }

/* ── WhatsApp flutuante ── */
.whatsapp-float {
  position: fixed; bottom: 28px; left: 28px; z-index: 998;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: var(--branco);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; box-shadow: 0 6px 20px rgba(37,211,102,.45);
  transition: all var(--transition); animation: waPulse 2.5s infinite;
}
.whatsapp-float:hover { transform: scale(1.12); box-shadow: 0 8px 28px rgba(37,211,102,.6); }
@keyframes waPulse {
  0%, 100% { box-shadow: 0 6px 20px rgba(37,211,102,.45); }
  50% { box-shadow: 0 6px 32px rgba(37,211,102,.75), 0 0 0 10px rgba(37,211,102,.1); }
}

/* ── Animações de entrada ── */
.fade-in { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.fade-in.visible { opacity: 1; transform: translateY(0); }

/* ── Checkbox group ── */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-item { display: flex; align-items: center; gap: 6px; }
.checkbox-item input[type="checkbox"] { accent-color: var(--azul-accent); width: 16px; height: 16px; }
.checkbox-item label { font-size: .875rem; color: var(--texto-medio); cursor: pointer; }

/* ── Radio group ── */
.radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.radio-item { display: flex; align-items: center; gap: 6px; }
.radio-item input[type="radio"] { accent-color: var(--azul-accent); width: 16px; height: 16px; }
.radio-item label { font-size: .875rem; color: var(--texto-medio); cursor: pointer; }

/* ── Divider ── */
.divider { height: 1px; background: var(--cinza-borda); margin: 20px 0; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--texto-claro); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: .4; }
.empty-state p { font-size: .95rem; }

/* ============================================
   RESPONSIVO
   ============================================ */
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .modal { max-width: 100%; margin: 0 12px; }
  .btn-lg { padding: 14px 24px; }
  table { font-size: .8rem; }
  thead th, tbody td { padding: 10px 12px; }
}
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  .btn { padding: 11px 20px; font-size: .85rem; }
}
