/* Camada de fluidez visual - Noelma Nutri
   Arquivo isolado para não alterar regras de negócio, banco ou rotas. */
:root {
  --noelma-motion-duration: 420ms;
  --noelma-motion-ease: cubic-bezier(.22, 1, .36, 1);
  --noelma-shadow-soft: 0 1rem 2.2rem rgba(80, 17, 37, .08);
  --noelma-shadow-lift: 0 1.3rem 2.8rem rgba(80, 17, 37, .13);
}

html.noelma-motion-ready {
  scroll-behavior: smooth;
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.card,
.metric-card,
.mini-card,
.hero-card,
.appointment-card,
.admin-panel-card,
.evolution-card,
.evolution-item,
.patient-plan-card,
.finance-type-tile,
.finance-alert-item,
.empty-state,
.slot-row-compact,
.consultation-plan-link-form,
.clean-tab-content,
.app-sidebar-link,
.admin-shortcut-card,
.patient-quick-action,
.btn,
.nav-pills .nav-link {
  transition:
    transform var(--noelma-motion-duration) var(--noelma-motion-ease),
    box-shadow var(--noelma-motion-duration) var(--noelma-motion-ease),
    border-color var(--noelma-motion-duration) var(--noelma-motion-ease),
    background-color var(--noelma-motion-duration) var(--noelma-motion-ease),
    color var(--noelma-motion-duration) var(--noelma-motion-ease),
    opacity var(--noelma-motion-duration) var(--noelma-motion-ease);
}

.card:hover,
.metric-card:hover,
.mini-card:hover,
.admin-panel-card:hover,
.evolution-card:hover,
.evolution-item:hover,
.patient-plan-card:hover,
.finance-type-tile:hover,
.finance-alert-item:hover,
.consultation-plan-link-form:hover,
.empty-state:hover {
  transform: translateY(-2px);
  box-shadow: var(--noelma-shadow-soft);
}

.btn:not(.dropdown-toggle):not(.btn-link):not(:disabled):hover,
.admin-shortcut-card:hover,
.patient-quick-action:hover,
.app-sidebar-link:hover {
  transform: translateY(-1px);
}

.btn:active,
.admin-shortcut-card:active,
.patient-quick-action:active,
.app-sidebar-link:active {
  transform: translateY(0) scale(.99);
}

.btn,
.form-control,
.form-select,
.nav-pills .nav-link,
.app-sidebar-link,
.admin-shortcut-card,
.patient-quick-action {
  will-change: transform;
}

.form-control,
.form-select,
.form-check-input {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.form-control:focus,
.form-select:focus {
  border-color: rgba(129, 140, 65, .58);
  box-shadow: 0 0 0 .22rem rgba(129, 140, 65, .15);
}

.table tbody tr {
  transition: background-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.table tbody tr:hover {
  background-color: rgba(248, 237, 242, .42);
}

.clean-tabs,
.nav-pills {
  position: relative;
}

.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  box-shadow: 0 .5rem 1.1rem rgba(98, 20, 45, .12);
}


.dropdown-menu {
  border-color: rgba(98, 20, 45, .1);
  box-shadow: 0 1rem 2.5rem rgba(80, 17, 37, .12);
}

.noelma-form-processing {
  position: relative;
  pointer-events: none;
}

.noelma-form-processing::after {
  content: '';
  display: inline-block;
  width: .9rem;
  height: .9rem;
  margin-left: .45rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  vertical-align: -.12rem;
  animation: noelma-spin .7s linear infinite;
}

.noelma-skeleton-pulse {
  animation: noelma-soft-pulse 1.4s ease-in-out infinite;
}

.noelma-just-updated {
  animation: noelma-updated-glow 1.2s ease-out 1;
}

@keyframes noelma-spin {
  to { transform: rotate(360deg); }
}

@keyframes noelma-soft-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .68; }
}

@keyframes noelma-updated-glow {
  0% { box-shadow: 0 0 0 0 rgba(129, 140, 65, .26); }
  100% { box-shadow: 0 0 0 18px rgba(129, 140, 65, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }

  .card:hover,
  .metric-card:hover,
  .mini-card:hover,
  .admin-panel-card:hover,
  .evolution-card:hover,
  .evolution-item:hover,
  .patient-plan-card:hover,
  .finance-type-tile:hover,
  .finance-alert-item:hover,
  .consultation-plan-link-form:hover,
  .empty-state:hover,
  .btn:hover,
  .admin-shortcut-card:hover,
  .patient-quick-action:hover,
  .app-sidebar-link:hover {
    transform: none !important;
  }
}

@media print {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
    box-shadow: none !important;
  }
}


/* Hotfix: não aplicar microinterações em elementos com menus/modais abertos. */
body.modal-open .card:hover,
body.modal-open .metric-card:hover,
body.modal-open .mini-card:hover,
body.modal-open .admin-panel-card:hover,
body.modal-open .evolution-card:hover,
body.modal-open .evolution-item:hover,
body.modal-open .patient-plan-card:hover,
body.modal-open .finance-type-tile:hover,
body.modal-open .finance-alert-item:hover,
body.modal-open .consultation-plan-link-form:hover,
body.modal-open .empty-state:hover,
.card.has-open-dropdown:hover,
.card-body.has-open-dropdown:hover,
.patient-action-panel.has-open-dropdown,
.patient-profile-hero.has-open-dropdown,
.clean-profile-hero.has-open-dropdown {
  transform: none !important;
}

.meal-edit-modal,
.meal-edit-modal *,
.dropdown-menu,
.dropdown-menu * {
  will-change: auto !important;
}
