/* Odonto365 - Custom Styles */

:root {
  /* Paleta oficial Odonto365 */
  --navy: #0a3a5d; /* azul escuro â€“ cor principal da marca */
  --teal: #29d3ac; /* verde-Ã¡gua â€“ acento primÃ¡rio */
  --ice: #d5eaf3; /* azul claro â€“ fundos e destaques suaves */
  --gray-text: #67727b; /* cinza azulado â€“ texto secundÃ¡rio */
  --blue-mid: #5b78c0; /* azul mÃ©dio â€“ links e elementos interativos */
  --coral: #ff8360; /* coral â€“ CTAs e aÃ§Ãµes importantes */

  --primary: var(--navy);
  --primary-dark: #072849;
  --secondary: var(--teal);
  --accent: var(--ice);
  --sidebar-width: 250px;
  --sidebar-bg: var(--navy);
  --sidebar-text: #c8d8ea;
  --sidebar-active: var(--blue-mid);
}

body {
  font-family:
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
  background: #f4f6fb;
  color: #2d3748;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .brand-name {
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.sidebar-brand .brand-tagline {
  color: var(--sidebar-text);
  font-size: 0.72rem;
  opacity: 0.7;
}

.sidebar-nav {
  padding: 1rem 0;
  flex: 1;
  overflow-y: auto;
}

.nav-section-label {
  padding: 0.5rem 1.25rem;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(200, 216, 234, 0.45);
  font-weight: 600;
  margin-top: 0.5rem;
}

.sidebar-nav .nav-link {
  color: var(--sidebar-text);
  padding: 0.65rem 1.25rem;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  transition: all 0.2s;
  position: relative;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(91, 120, 192, 0.35);
}

.sidebar-nav .nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--secondary);
  border-radius: 0 2px 2px 0;
}

.sidebar-nav .nav-link i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  color: rgba(200, 216, 234, 0.5);
}

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1a202c;
}

.page-content {
  padding: 1.5rem;
  flex: 1;
}

.main-footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #67727b;
}

.main-footer a {
  color: #67727b;
  text-decoration: none;
}

.main-footer a:hover {
  color: #0a3a5d;
}

/* ===== CARDS ===== */
.stat-card {
  border: none;
  border-radius: 12px;
  padding: 1.25rem;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  transition:
    transform 0.2s,
    box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.1;
  color: #1a202c;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: #718096;
  font-weight: 500;
}

/* ===== TABLES ===== */
.table-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.table-card .table {
  margin-bottom: 0;
}

.table-card .table thead th {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  color: #4a5568;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.85rem 1rem;
}

.table-card .table tbody td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid #f0f4f8;
  vertical-align: middle;
  font-size: 0.875rem;
}

.table-card .table tbody tr:last-child td {
  border-bottom: none;
}

.table-card .table tbody tr:hover {
  background: #f8fafc;
}

/* ===== BADGES ===== */
.badge-status {
  padding: 0.3em 0.7em;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
}

/* ===== FORMS ===== */
.form-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.07);
  padding: 1.5rem;
}

.form-section-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: #718096;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 120, 192, 0.12);
}

/* ── Validation states ───────────────────────────────────────────────── */
.form-control.is-invalid,
.form-select.is-invalid,
.form-check-input.is-invalid {
  border-color: var(--coral);
}
.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(255, 131, 96, 0.2);
}
.form-control.is-valid,
.form-select.is-valid,
.form-check-input.is-valid {
  border-color: var(--teal);
}
.form-control.is-valid:focus,
.form-select.is-valid:focus {
  box-shadow: 0 0 0 3px rgba(41, 211, 172, 0.2);
}
.invalid-feedback {
  font-size: 0.78rem;
  color: var(--coral);
}
.valid-feedback {
  font-size: 0.78rem;
  color: var(--teal);
}
.invalid-feedback.d-block,
.is-invalid ~ .invalid-feedback {
  display: block !important;
  animation: feedbackSlideIn 200ms ease-out;
}
@keyframes feedbackSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fieldShake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-5px); }
  40%      { transform: translateX(5px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.field-shake {
  animation: fieldShake 320ms ease-in-out;
}
@media (prefers-reduced-motion: reduce) {
  .invalid-feedback,
  .field-shake { animation: none !important; }
}

/* ===== BUTTONS =====
 *
 * HIERARQUIA (usar SOMENTE estas variantes no app):
 *
 * btn btn-primary           → Salvar, Criar, Confirmar (ação principal)
 * btn btn-outline-secondary → Cancelar, Voltar (ação secundária/neutra)
 * btn btn-outline-danger    → Excluir em listas/linhas de tabela
 * btn btn-danger            → Confirmar exclusão (página confirm_delete)
 * btn btn-link              → Ações terciárias discretas
 *
 * Exceções semânticas (financeiro):
 * btn btn-success           → + Receita, Marcar pago (verde = entrada)
 * btn btn-danger btn-sm     → - Despesa (vermelho = saída)  ← somente financeiro
 *
 * POSICIONAMENTO:
 * Formulários   → <div class="d-flex gap-2 justify-content-end mt-3">
 *                   ordem: [Cancelar btn-outline-secondary] [Salvar btn-primary]
 * Listas        → botão Novo no topo-direito: btn btn-primary btn-sm
 * Confirm-delete→ <div class="d-flex gap-2 justify-content-center">
 *                   ordem: [Cancelar] [Excluir btn-danger]
 * Voltar        → sempre topo-esquerdo: btn btn-outline-secondary btn-sm
 *
 * TAMANHO: btn-sm em contextos de card/tabela; sem modificador em formulários standalone
 * ÍCONES: sempre à esquerda com me-1 — ex: <i class="bi bi-check-lg me-1"></i>
 * SEM style= inline em botões — use as classes acima.
 * ===================================================================== */

/* ── Shared base ─────────────────────────────────────────────────────── */
.btn {
  position: relative;
  overflow: hidden;
  font-weight: 500;
  letter-spacing: 0.015em;
  transition:
    transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 180ms ease-out,
    background 180ms ease-out,
    border-color 180ms ease-out,
    color 180ms ease-out;
  will-change: transform;
}

/* Ripple overlay no active */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.18);
  opacity: 0;
  transition: opacity 250ms ease-out;
  pointer-events: none;
}
.btn:active::after {
  opacity: 1;
  transition-duration: 40ms;
}

/* Ícones: micro-movimento no hover */
.btn .bi {
  display: inline-block;
  transition: transform 180ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.btn:hover .bi {
  transform: scale(1.2);
}
.btn:active .bi {
  transform: scale(0.95);
}

/* ── Primary ─────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(145deg, #1a4f7a 0%, var(--navy) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow:
    0 2px 6px rgba(10, 58, 93, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(145deg, #1e5c8c 0%, #0d3d61 100%);
  border-color: transparent;
  color: #fff;
  transform: translateY(-2px);
  box-shadow:
    0 6px 18px rgba(10, 58, 93, 0.38),
    0 1px 4px rgba(10, 58, 93, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 4px rgba(10, 58, 93, 0.25),
    inset 0 2px 4px rgba(0, 0, 0, 0.12);
}
.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(41, 211, 172, 0.45),
    0 4px 12px rgba(10, 58, 93, 0.28);
}

/* ── Outline Secondary ───────────────────────────────────────────────── */
.btn-outline-secondary {
  color: var(--gray-text);
  border-color: #d1d9e0;
  background: transparent;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
  background: var(--accent);
  border-color: #b0bec5;
  color: #2d3748;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
}
.btn-outline-secondary:active {
  transform: translateY(0);
  background: #c5d9e6;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
}
.btn-outline-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(41, 211, 172, 0.35);
}

/* ── Outline Danger (rows/tables) ────────────────────────────────────── */
.btn-outline-danger {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.btn-outline-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220, 53, 69, 0.22);
}
.btn-outline-danger:active {
  transform: translateY(0);
}
.btn-outline-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.3);
}

/* ── Danger (confirm delete) ─────────────────────────────────────────── */
.btn-danger {
  background: linear-gradient(145deg, #e84455 0%, #c82333 100%);
  border-color: transparent;
  box-shadow:
    0 2px 6px rgba(220, 53, 69, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-danger:hover,
.btn-danger:focus {
  background: linear-gradient(145deg, #f04457 0%, #b01c2b 100%);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow:
    0 6px 18px rgba(220, 53, 69, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-danger:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(220, 53, 69, 0.3);
}
.btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.4);
}

/* ── Success (financeiro: receita / pago) ────────────────────────────── */
.btn-success {
  background: linear-gradient(145deg, #28c96a 0%, #1a9e50 100%);
  border-color: transparent;
  box-shadow:
    0 2px 6px rgba(25, 135, 84, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn-success:hover,
.btn-success:focus {
  background: linear-gradient(145deg, #2ed673 0%, #178a44 100%);
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow:
    0 6px 16px rgba(25, 135, 84, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.btn-success:active {
  transform: translateY(1px);
  box-shadow: 0 1px 4px rgba(25, 135, 84, 0.25);
}

/* ── Loading state (JS adiciona .btn-loading no submit) ──────────────── */
.btn-loading {
  pointer-events: none;
  opacity: 0.82;
}
.btn-loading .bi {
  display: none;
}
.btn-loading::before {
  content: '';
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  animation: btn-spin 0.55s linear infinite;
  margin-right: 0.4rem;
  vertical-align: -0.1em;
}
.btn-outline-secondary.btn-loading::before,
.btn-outline-danger.btn-loading::before,
.btn-mini-action.btn-loading::before,
.btn-ghost-cancel.btn-loading::before {
  border-color: rgba(0, 0, 0, 0.15);
  border-top-color: var(--gray-text);
}
@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn,
  .btn .bi {
    transition: none !important;
    transform: none !important;
    animation: none !important;
  }
  .btn-loading::before {
    animation: none;
    content: '…';
    border: none;
    font-size: 0.8em;
  }
}

/* ===== AVATAR ===== */
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.avatar-lg {
  width: 80px;
  height: 80px;
  font-size: 1.75rem;
}

/* ===== LANDING PAGE ===== */
.landing-hero {
  background: linear-gradient(135deg, #0a3a5d 0%, #5b78c0 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.feature-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(91, 120, 192, 0.1);
  color: var(--primary);
  margin-bottom: 1rem;
}

.pricing-card {
  border: 2px solid var(--primary);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(91, 120, 192, 0.2);
}

.pricing-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 2.5rem 2rem;
  text-align: center;
}

.pricing-price {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
}

.pricing-period {
  font-size: 1rem;
  opacity: 0.85;
}

/* ===== SUBSCRIPTION BANNER ===== */
.trial-banner {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
  color: #fff;
  padding: 0.5rem 1rem;
  text-align: center;
  font-size: 0.85rem;
}

/* ===== PRINT ===== */
@media print {
  .sidebar,
  .topbar,
  .no-print {
    display: none !important;
  }
  .main-content {
    margin-left: 0 !important;
  }
  .page-content {
    padding: 0 !important;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .topbar {
    padding: 0.6rem 1rem;
  }
  .topbar-title {
    font-size: 0.95rem;
  }
  .page-content {
    padding: 1rem;
  }
  .trial-banner {
    font-size: 0.78rem;
    padding: 0.5rem 1rem;
    flex-wrap: wrap;
    gap: 4px;
  }
}

/* ===== AGENDA CALENDAR ===== */
.time-slot {
  border-left: 3px solid transparent;
  padding: 0.4rem 0.75rem;
  border-radius: 0 8px 8px 0;
  margin-bottom: 0.25rem;
  font-size: 0.82rem;
}

.appointment-item {
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
  margin-bottom: 0.4rem;
  border-left: 4px solid;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s;
}

.appointment-item:hover {
  transform: translateX(3px);
}

/* ===== TOAST / ALERTS ===== */
.alert {
  border: none;
  border-radius: 10px;
  font-size: 0.875rem;
}

/* ===== TOM SELECT â€“ ajuste visual ===== */
.ts-wrapper.form-control {
  padding: 0;
  height: auto;
}
.ts-wrapper .ts-control {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  background: #fff;
  box-shadow: none;
  min-height: 38px;
}
.ts-wrapper.focus .ts-control {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(91, 120, 192, 0.12);
}
.ts-dropdown {
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  font-size: 0.875rem;
  z-index: 9999;
}
.ts-dropdown .option {
  padding: 0.55rem 0.85rem;
  color: #2d3748;
}
.ts-dropdown .option:hover,
.ts-dropdown .option.active {
  background: #e8f4fb;
  color: var(--primary);
}
.ts-dropdown .no-results {
  padding: 0.65rem 0.85rem;
  color: #718096;
  font-size: 0.82rem;
}
.ts-control input::placeholder {
  color: #adb5bd;
  font-size: 0.85rem;
}
.dropdown-item {
  font-size: 0.875rem;
  padding: 10px 16px;
}
.dropdown-item:hover,
.dropdown-item:focus {
  background: #ddeef8;
  color: #1a3c6e;
}
