/* ============================================================
   GABARITOU 2.0 — Componentes
   Botões, Inputs, Cards, Badges, Tabelas, Modais, Alerts
   ============================================================ */

/* ─── BOTÕES ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--clr-green);
  color: #fff;
}
.btn-primary:hover {
  background: var(--clr-green-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,200,150,.35);
}

.btn-secondary {
  background: transparent;
  border-color: var(--clr-green);
  color: var(--clr-green);
}
.btn-secondary:hover {
  background: var(--clr-green-light);
}

.btn-ghost {
  background: transparent;
  color: var(--txt-secondary);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--txt-primary);
}

.btn-danger {
  background: transparent;
  border-color: var(--clr-red);
  color: var(--clr-red);
}
.btn-danger:hover {
  background: var(--clr-red-light);
}

.btn-sm { padding: 7px 14px; font-size: var(--fs-xs); border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 28px; font-size: var(--fs-md); }
.btn-full { width: 100%; justify-content: center; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ─── INPUTS ─────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-label {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--txt-primary);
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--txt-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.form-input::placeholder { color: var(--txt-muted); }
.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,200,150,.15);
}

.input-wrapper { position: relative; }
.input-wrapper .form-input { padding-right: 42px; }
.input-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--txt-muted);
  cursor: pointer;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  padding: 0;
}
.input-icon:hover { color: var(--txt-primary); }

.form-select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-input);
  color: var(--txt-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 38px;
}
.form-select:focus { outline: none; border-color: var(--border-focus); }

.form-hint { font-size: var(--fs-xs); color: var(--txt-muted); }
.form-error { font-size: var(--fs-xs); color: var(--clr-red); }

/* ─── DIVIDER ─────────────────────────────────────────────── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--txt-muted);
  font-size: var(--fs-xs);
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ─── CARDS ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: background var(--transition), border-color var(--transition);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title {
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--txt-primary);
}

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green  { background: rgba(0,200,150,.12); color: var(--clr-green); }
.stat-icon.blue   { background: rgba(79,124,247,.12); color: var(--clr-blue); }
.stat-icon.purple { background: rgba(155,89,182,.12); color: var(--clr-purple); }
.stat-icon.orange { background: rgba(255,140,66,.12); color: var(--clr-orange); }

.stat-info { flex: 1; }
.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--txt-primary);
  line-height: 1;
}
.stat-label {
  font-size: var(--fs-sm);
  color: var(--txt-muted);
  margin-top: 4px;
}

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
}
.badge-green  { background: var(--clr-green-light);  color: var(--clr-green-dark); }
.badge-blue   { background: var(--clr-blue-light);   color: var(--clr-blue); }
.badge-red    { background: var(--clr-red-light);    color: var(--clr-red); }
.badge-gray   { background: var(--bg-hover);         color: var(--txt-muted); }

/* ─── TABELA ─────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; }

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}
.table th {
  padding: 10px 14px;
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--txt-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-page);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--txt-primary);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg-hover); }

/* Ações inline */
.table-actions { display: flex; gap: 8px; align-items: center; }
.icon-btn {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-hover);
  color: var(--txt-secondary);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--border); color: var(--txt-primary); }
.icon-btn.danger:hover { background: var(--clr-red-light); color: var(--clr-red); }
.icon-btn svg { width: 15px; height: 15px; }

/* ─── TOGGLE (acessibilidade / tema) ─────────────────────── */
.toggle {
  position: relative;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
  box-shadow: var(--shadow-sm);
}
.toggle input:checked + .toggle-slider { background: var(--clr-green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ─── MODAL ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: 28px;
  width: 90%;
  max-width: 480px;
  transform: translateY(16px);
  transition: transform var(--transition);
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}

/* ─── SLIDER ─────────────────────────────────────────────── */
.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--clr-green);
  box-shadow: var(--shadow-sm);
}

/* ─── ALERT TOAST ─────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 260px;
  animation: slideIn .25s ease;
  font-size: var(--fs-sm);
  color: var(--txt-primary);
}
.toast.success { border-left: 4px solid var(--clr-green); }
.toast.error   { border-left: 4px solid var(--clr-red); }
.toast.info    { border-left: 4px solid var(--clr-blue); }
@keyframes slideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
