/* ============================================================
   tombola.ui — diálogos de confirmación (.tbc-*) y avisos (.tb-toast*).
   Autónomo y compartido por el panel (site.css) y el sitio público (public.css),
   que usan tokens distintos: por eso cada color va con cadena de respaldo
   (--token-admin -> --token-publico -> literal).
   ============================================================ */

:root {
  --tbc-surface: var(--surface, var(--pub-surface, #ffffff));
  --tbc-ink: var(--ink, var(--pub-ink, #1F1B2E));
  --tbc-muted: var(--muted, var(--pub-muted, #6F6860));
  --tbc-line: var(--line, var(--pub-line, #EBE6DF));
  --tbc-primary: var(--plum, var(--pub-primary, #5B2A86));
  --tbc-primary-text: var(--plum-ink, var(--pub-primary, #5B2A86));
  --tbc-primary-ink: #ffffff;
  --tbc-danger: var(--danger-fill, var(--danger, #B4322E));   /* relleno */
  --tbc-danger-text: var(--danger, #B4322E);
  --tbc-success: var(--success, #186647);
}

/* ---------- Confirmación ---------- */
.tbc-backdrop {
  position: fixed; inset: 0; z-index: 1200; display: flex;
  align-items: flex-start; justify-content: center; padding: 6vh 1rem;
  background: rgba(31, 27, 46, .55); animation: tbc-fade .16s ease both;
}
.tbc-modal {
  background: var(--tbc-surface); color: var(--tbc-ink);
  width: 100%; max-width: 460px; border-radius: 16px; overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(31, 27, 46, .5);
  font-family: inherit; animation: tbc-pop .18s cubic-bezier(.2, .7, .2, 1) both;
  display: flex; flex-direction: column; max-height: 88vh;
}
@keyframes tbc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tbc-pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
.tbc-head { padding: 1.1rem 1.35rem .25rem; }
.tbc-head h3 { margin: 0; font-size: 1.2rem; font-weight: 700;
  font-family: "Playfair Display", Georgia, serif; color: var(--tbc-ink); }
.tbc-body { padding: .5rem 1.35rem 1.1rem; overflow-y: auto; }
.tbc-msg { margin: 0; color: var(--tbc-ink); line-height: 1.55; }
.tbc-reason { display: flex; flex-direction: column; gap: .3rem; margin-top: .9rem;
  font-size: .85rem; font-weight: 600; color: var(--tbc-muted); }
.tbc-reason textarea {
  font: inherit; font-weight: 400; color: var(--tbc-ink); background: var(--field, #fff); padding: .5rem .7rem;
  border: 1px solid var(--tbc-line); border-radius: 8px; resize: vertical; min-height: 3rem;
}
.tbc-reason textarea:focus { outline: none; border-color: var(--tbc-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tbc-primary) 18%, transparent); }
.tbc-err { margin: .5rem 0 0; color: var(--tbc-danger-text); font-size: .85rem; }
.tbc-foot { padding: .9rem 1.35rem 1.15rem; display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; }
.tbc-btn {
  font: inherit; font-weight: 600; cursor: pointer; padding: .55rem 1.15rem;
  border-radius: 8px; border: 1px solid var(--tbc-line); background: var(--tbc-surface); color: var(--tbc-ink);
}
.tbc-btn:hover { background: color-mix(in srgb, var(--tbc-primary) 8%, var(--tbc-surface)); }
.tbc-btn-primary { background: var(--tbc-primary); border-color: var(--tbc-primary); color: var(--tbc-primary-ink); }
.tbc-btn-primary:hover { background: color-mix(in srgb, var(--tbc-primary) 85%, black); }
.tbc-btn-primary.tbc-danger { background: var(--tbc-danger); border-color: var(--tbc-danger); }
.tbc-btn-primary.tbc-danger:hover { background: color-mix(in srgb, var(--tbc-danger) 85%, black); }
.tbc-btn:focus-visible { outline: 2px solid var(--tbc-primary-text); outline-offset: 2px; }
.tbc-btn-primary.tbc-danger:focus-visible { outline-color: var(--tbc-danger); }

/* ---------- Toasts ---------- */
.tb-toasts {
  position: fixed; z-index: 1300; right: 1rem; bottom: 1rem;
  display: flex; flex-direction: column; gap: .5rem; max-width: min(92vw, 24rem);
}
.tb-toast {
  display: flex; align-items: flex-start; gap: .6rem;
  background: var(--tbc-surface); color: var(--tbc-ink);
  border: 1px solid var(--tbc-line);
  border-radius: 12px; padding: .7rem .8rem; box-shadow: 0 12px 30px -14px rgba(31, 27, 46, .45);
  animation: tbc-toast-in .22s cubic-bezier(.2, .7, .2, 1) both;
}
.tb-toast.is-leaving { animation: tbc-toast-out .18s ease forwards; }
@keyframes tbc-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes tbc-toast-out { to { opacity: 0; transform: translateY(8px); } }
/* El tipo lo comunica el icono de color; el borde queda neutro. */
.tb-toast-ico {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; margin-top: .05rem;
  display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: #fff; background: var(--tbc-primary);
}
.tb-toast-success .tb-toast-ico { background: var(--tbc-success); }
.tb-toast-error .tb-toast-ico { background: var(--tbc-danger); }
.tb-toast-msg { flex: 1 1 auto; font-size: .9rem; line-height: 1.4; }
.tb-toast-x {
  flex: 0 0 auto; background: none; border: 0; color: var(--tbc-muted); cursor: pointer;
  font-size: 1.15rem; line-height: 1; width: 28px; height: 28px; margin: -.3rem -.3rem -.3rem 0;
  display: grid; place-items: center; border-radius: 50%;
}
.tb-toast-x:focus-visible { outline: 2px solid var(--tbc-primary-text); outline-offset: 0; }
@media (pointer: coarse) { .tb-toast-x { width: 36px; height: 36px; } }
.tb-toast-x:hover { color: var(--tbc-ink); }

@media (max-width: 640px) {
  .tb-toasts { left: 1rem; right: 1rem; bottom: calc(72px + env(safe-area-inset-bottom)); max-width: none; }
}
/* Movimiento reducido: sin desplazamiento ni escala; el aparecer queda como fundido corto. */
@media (prefers-reduced-motion: reduce) {
  .tbc-modal, .tb-toast { animation: tbc-fade .12s ease both; }
  .tb-toast.is-leaving { animation: tbc-fade .12s ease reverse forwards; }
}

/* ---------- Aviso de error (tbAlert) ---------- */
.tbc-alert .tbc-head { display: flex; align-items: center; gap: .7rem; padding-top: 1.25rem; }
.tbc-alert-ico {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; color: #fff; background: var(--tbc-primary);
}
.tbc-alert-error .tbc-alert-ico { background: var(--tbc-danger); }
.tbc-alert .tbc-msg { font-size: .98rem; }

/* Angular carga al final de la página: sin esto, antes de que arranque se alcanzan a ver las
   plantillas ({{ vm.x }}). Angular quita ng-cloak al compilar cada vista; la regla va aquí (en el
   <head> de panel y sitio público) porque la que inyecta angular.js llega demasiado tarde. */
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak { display: none !important; }
