/* =========================================================
   Centro ORL — Design tokens
   Paleta pensada para Otorrinolaringologia: un teal profundo
   (calma clinica, distinto del azul generico de "hospital"),
   con un acento ambar reservado para urgencias/alertas.
   ========================================================= */
:root {
  --orl-primary: #0f6e7c;
  --orl-primary-dark: #0b4e58;
  --orl-primary-darker: #103a41;
  --orl-accent: #e2872a;
  --orl-danger: #d64550;
  --orl-success: #2fae7d;
  --orl-bg: #f4f7f8;

  --tblr-primary: var(--orl-primary);
  --tblr-primary-rgb: 15, 110, 124;
}

html, body {
  background: var(--orl-bg);
}

/* ---- Sidebar branding ---- */
.navbar-vertical {
  background: linear-gradient(180deg, var(--orl-primary-darker) 0%, var(--orl-primary-dark) 100%);
}
.navbar-vertical .navbar-brand {
  padding: 1rem 0.5rem 0.5rem;
}
.navbar-vertical .brand-text {
  color: #fff;
  font-weight: 700;
  letter-spacing: .02em;
}
.navbar-vertical .nav-subtitle {
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .08em;
  color: rgba(255,255,255,.45);
  padding: 1rem 1rem .35rem;
}
.navbar-vertical .nav-link {
  color: rgba(255,255,255,.75);
  border-radius: .375rem;
  margin: 1px .5rem;
}
.navbar-vertical .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}
.navbar-vertical .nav-link.active {
  color: #fff;
  background: var(--orl-accent);
}
.navbar-vertical .nav-link-icon {
  opacity: .9;
}

/* ---- Topbar ---- */
.topbar {
  border-bottom: 1px solid var(--tblr-border-color, #e6e8eb);
  background: #fff;
}

/* ---- Page header pattern (reemplaza los <hr><h3><hr> del sistema original) ---- */
.page-header-orl {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.page-header-orl h1,
.page-header-orl h2,
.page-header-orl h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1b2730;
}
.page-header-orl .page-eyebrow {
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .08em;
  color: var(--orl-primary);
  font-weight: 700;
  display: block;
  margin-bottom: .15rem;
}

/* ---- Cards ---- */
.card-orl {
  border: 1px solid #e9edf0;
  box-shadow: 0 1px 2px rgba(16, 24, 32, .04);
}

/* ---- Estados de turno / consulta (uso futuro: en espera / en consulta / atendido) ---- */
.badge-estado-espera   { background: #eef1f4; color: #4a5560; }
.badge-estado-consulta { background: #fff2e1; color: #9a5c0c; }
.badge-estado-atendido { background: #e3f7ee; color: #147a53; }
.badge-estado-urgencia { background: #fdeaea; color: #b3242e; }

/* ---- Dashboard shortcut cards (Home) ---- */
.module-card {
  border: 1px solid #e9edf0;
  border-radius: .5rem;
  padding: 1.25rem;
  height: 100%;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  text-decoration: none;
  display: block;
  color: inherit;
  background: #fff;
}
.module-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(16, 24, 32, .08);
  border-color: var(--orl-primary);
  color: inherit;
}
.module-card .module-icon {
  width: 44px;
  height: 44px;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 110, 124, .1);
  color: var(--orl-primary);
  font-size: 1.35rem;
  margin-bottom: .75rem;
}
.module-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: .25rem;
}
.module-card p {
  font-size: .825rem;
  color: #6b7684;
  margin-bottom: 0;
}

/* ---- Login ---- */
.orl-auth-side {
  background: radial-gradient(circle at 20% 20%, var(--orl-primary) 0%, var(--orl-primary-darker) 70%);
  color: #fff;
}

@media (min-width: 768px) {
  html { font-size: 15px; }
}
body { margin-bottom: 0; }

/* =========================================================
   Micro-interacciones — sutiles, sin distraer
   ========================================================= */

/* ---- Entrada de página ---- */
.page-body {
  animation: orlFadeIn .35s cubic-bezier(.25,.8,.25,1);
}
@keyframes orlFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Sidebar: indicador activo animado + iconos ---- */
.navbar-vertical .nav-link {
  position: relative;
  transition: background-color .18s ease, color .18s ease, padding-left .18s ease;
  overflow: hidden;
}
.navbar-vertical .nav-link::before {
  content: "";
  position: absolute;
  left: 0; top: 8%;
  height: 84%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #fff;
  transform: scaleY(0);
  transform-origin: center;
  opacity: 0;
  transition: transform .2s ease, opacity .2s ease;
}
.navbar-vertical .nav-link:hover {
  padding-left: 1.1rem;
}
.navbar-vertical .nav-link.active::before {
  transform: scaleY(1);
  opacity: 1;
}
.navbar-vertical .nav-link-icon {
  transition: transform .18s ease;
  display: inline-flex;
}
.navbar-vertical .nav-link:hover .nav-link-icon {
  transform: scale(1.12);
}
.navbar-vertical .nav-subtitle {
  transition: opacity .18s ease;
}

/* ---- Botones ---- */
.btn {
  transition: transform .12s ease, box-shadow .12s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(16, 24, 32, .10);
}
.btn:active {
  transform: translateY(0) scale(.98);
  box-shadow: none;
}
.btn-primary:hover {
  box-shadow: 0 4px 12px rgba(15, 110, 124, .28);
}

/* ---- Tarjetas ---- */
.card-orl {
  transition: box-shadow .2s ease, border-color .2s ease;
}
.card-orl:hover {
  box-shadow: 0 4px 16px rgba(16, 24, 32, .07);
  border-color: #dde3e7;
}

/* ---- Filas de tabla ---- */
.card-table tbody tr,
table.dataTable tbody tr {
  transition: background-color .12s ease;
}
.card-table tbody tr:hover,
table.dataTable tbody tr:hover {
  background-color: rgba(15, 110, 124, .045);
}

/* ---- Avatar / dropdown de usuario ---- */
.navbar .avatar {
  transition: box-shadow .18s ease, transform .18s ease;
}
.navbar .nav-link:hover .avatar {
  transform: scale(1.05);
  box-shadow: 0 0 0 3px rgba(15, 110, 124, .15);
}
.dropdown-menu {
  animation: orlDropIn .15s ease;
}
@keyframes orlDropIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Modales: entrada suave con leve escala ---- */
.modal.fade .modal-dialog {
  transition: transform .22s cubic-bezier(.25,.8,.25,1), opacity .22s ease;
  transform: translateY(-8px) scale(.98);
  opacity: 0;
}
.modal.show .modal-dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ---- Inputs: foco suave con el color de marca ---- */
.form-control, .form-select {
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus, .form-select:focus {
  border-color: var(--orl-primary);
  box-shadow: 0 0 0 3px rgba(15, 110, 124, .15);
}
.is-invalid, .form-select.is-invalid {
  animation: orlShake .35s ease;
}
.is-invalid:focus, .form-select.is-invalid:focus {
  border-color: var(--orl-danger) !important;
  box-shadow: 0 0 0 3px rgba(214, 69, 80, .18) !important;
}
@keyframes orlShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

/* ---- Toasts (reemplazan los alert() del sistema) ---- */
#orl-toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  max-width: 320px;
}
.orl-toast {
  background: #fff;
  border-left: 4px solid var(--orl-primary);
  border-radius: .375rem;
  box-shadow: 0 8px 24px rgba(16, 24, 32, .16);
  padding: .65rem .9rem;
  font-size: .875rem;
  color: #1b2730;
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .2s ease, transform .2s ease;
}
.orl-toast.show {
  opacity: 1;
  transform: translateX(0);
}
.orl-toast-success { border-left-color: var(--orl-success); }
.orl-toast-danger  { border-left-color: var(--orl-danger); }
.orl-toast-warning { border-left-color: var(--orl-accent); }

/* ---- Entrada escalonada de las tarjetas del dashboard ---- */
.row-cards > [class*="col-"] {
  animation: orlFadeIn .4s cubic-bezier(.25,.8,.25,1) backwards;
}
.row-cards > [class*="col-"]:nth-child(1) { animation-delay: .02s; }
.row-cards > [class*="col-"]:nth-child(2) { animation-delay: .06s; }
.row-cards > [class*="col-"]:nth-child(3) { animation-delay: .10s; }
.row-cards > [class*="col-"]:nth-child(4) { animation-delay: .14s; }
.row-cards > [class*="col-"]:nth-child(5) { animation-delay: .18s; }
.row-cards > [class*="col-"]:nth-child(6) { animation-delay: .22s; }
.row-cards > [class*="col-"]:nth-child(n+7) { animation-delay: .26s; }

/* ---- Accesibilidad: respeta si el usuario prefiere menos movimiento ---- */
@media (prefers-reduced-motion: reduce) {
  .page-body, .dropdown-menu, .modal.fade .modal-dialog,
  .btn, .card-orl, .module-card, .navbar-vertical .nav-link,
  .navbar-vertical .nav-link-icon, .navbar .avatar,
  .orl-toast, .row-cards > [class*="col-"], .is-invalid {
    animation: none !important;
    transition: none !important;
  }
}
