/* ============================================================
   CDC – Central Digital do Condutor
   style.css – Base Global
   ============================================================ */

/* ---------- RESET & BASE ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a6eff;
  --primary-dark: #1054cc;
  --primary-light: #e8f0fe;
  --secondary: #0dcf82;
  --secondary-dark: #09a866;
  --accent: #f5a623;
  --danger: #e74c3c;
  --danger-light: #fdecea;
  --warning: #f39c12;
  --warning-light: #fef9ec;
  --success: #27ae60;
  --success-light: #eafaf1;
  --info: #2980b9;
  --info-light: #eaf4fb;
  --purple: #8e44ad;
  --purple-light: #f3eaf7;

  --bg: #f4f6fb;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;

  --text: #1e293b;
  --text-light: #64748b;
  --text-muted: #94a3b8;
  --text-white: #ffffff;

  --border: #e2e8f0;
  --border-dark: #cbd5e1;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-md: 0 4px 24px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.16);

  --transition: .2s ease;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --sidebar-w: 260px;
  --topbar-h: 64px;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

button { cursor: pointer; font-family: var(--font); }

/* ---------- TYPOGRAPHY ---------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

/* ---------- CONTAINER ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn--secondary {
  background: var(--secondary);
  color: #fff;
  border-color: var(--secondary);
}
.btn--secondary:hover { background: var(--secondary-dark); border-color: var(--secondary-dark); color: #fff; }

.btn--outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--primary);
}
.btn--outline:hover { background: var(--primary); color: #fff; }

.btn--ghost {
  background: transparent;
  color: var(--text-light);
  border-color: transparent;
}
.btn--ghost:hover { background: var(--bg); color: var(--text); }

.btn--danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn--danger:hover { background: #c0392b; border-color: #c0392b; color: #fff; }

.btn--sm { padding: 6px 14px; font-size: 13px; }
.btn--lg { padding: 14px 28px; font-size: 16px; }
.btn--full { width: 100%; justify-content: center; }

.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.input-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon > i:first-child {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
  font-size: 14px;
}
.input-icon input,
.input-icon select {
  width: 100%;
  padding: 10px 12px 10px 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}
.input-icon input:focus,
.input-icon select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,110,255,.15);
}
.input-icon input.error { border-color: var(--danger); }

.toggle-pass {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  padding: 4px;
}
.toggle-pass:hover { color: var(--primary); }

.form-row { display: flex; gap: 16px; }
.form-row--2 > * { flex: 1; min-width: 0; }
.form-row--between { justify-content: space-between; align-items: center; }

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text-light);
  margin-bottom: 12px;
}
.checkbox-label input { accent-color: var(--primary); }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 12px;
}

/* ---------- BADGES / TAGS ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.badge--success { background: var(--success-light); color: var(--success); }
.badge--danger  { background: var(--danger-light); color: var(--danger); }
.badge--warning { background: var(--warning-light); color: var(--warning); }
.badge--info    { background: var(--info-light); color: var(--info); }
.badge--purple  { background: var(--purple-light); color: var(--purple); }
.badge--muted   { background: var(--bg); color: var(--text-muted); }

/* ---------- TABLES ---------- */
.table-wrapper { overflow-x: auto; border-radius: var(--radius); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-card);
}
.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
}
.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 12px 16px; color: var(--text); vertical-align: middle; }
.data-table tbody tr:last-child { border-bottom: none; }

/* ---------- CARDS ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  transform: scale(.95);
  transition: transform var(--transition);
}
.modal-overlay.active .modal { transform: scale(1); }

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal__header h3 { font-size: 18px; }
.modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}
.modal__close:hover { color: var(--danger); }

.modal__body { padding: 24px; overflow-y: auto; flex: 1; }
.modal__footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* ---------- TOAST ---------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  min-width: 260px;
  max-width: 380px;
  background: #fff;
  border-left: 4px solid var(--primary);
  animation: slideInRight .3s ease, fadeOut .3s ease 2.7s forwards;
  pointer-events: all;
}
.toast--success { border-color: var(--success); }
.toast--error   { border-color: var(--danger); }
.toast--warning { border-color: var(--warning); }
.toast--info    { border-color: var(--info); }
.toast i { font-size: 18px; }
.toast--success i { color: var(--success); }
.toast--error   i { color: var(--danger); }
.toast--warning i { color: var(--warning); }
.toast--info    i { color: var(--info); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateX(100%); }
}

/* ---------- SECTION HEADERS ---------- */
.section-header {
  text-align: center;
  margin-bottom: 48px;
}
.section-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 14px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.section-title { font-size: clamp(1.6rem, 3vw, 2.4rem); margin-bottom: 12px; }
.section-desc { font-size: 1rem; color: var(--text-light); max-width: 560px; margin: 0 auto; }

/* ---------- SECTION HEADER BAR (dashboard) ---------- */
.section-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}
.section-header-bar h2 { font-size: 1.4rem; }

/* ---------- LOADING SPINNER ---------- */
.spinner {
  width: 40px; height: 40px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- SEARCH / FILTER ---------- */
.search-input, .filter-select {
  padding: 8px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg-card);
  color: var(--text);
  transition: border-color var(--transition);
}
.search-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--primary);
}

.header-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- PAGINATION ---------- */
.table-pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 36px;
  height: 36px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}
.page-btn:hover, .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: .5; }
.empty-state p { font-size: 15px; }

/* ---------- LINK ---------- */
.link-sm { font-size: 13px; color: var(--primary); }
.link-sm:hover { text-decoration: underline; }
.link-more { font-size: 13px; color: var(--primary); font-weight: 600; display: inline-block; margin-top: 8px; }

/* ---------- PLAN BADGE ---------- */
.plan-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  background: var(--primary-light);
  color: var(--primary);
}
.plan-badge--pro { background: #fef3c7; color: #d97706; }
.plan-badge--basic { background: var(--success-light); color: var(--success); }

/* ---------- NOTIF DOT ---------- */
.notif-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  background: var(--danger);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  padding: 0 4px;
  margin-left: auto;
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- RESPONSIVE UTILITIES ---------- */
@media (max-width: 768px) {
  .form-row { flex-direction: column; }
  .section-header-bar { flex-direction: column; align-items: flex-start; }
}
