/* ============================================================
   U&V - ALERTS (one look for the whole site)
   File: assets/css/uv-alerts.css   (needs Bootstrap Icons, already loaded everywhere)
   1. .alert            every inline message box (soft card, coloured edge, icon)
   2. .uv-toast         the message that slides in after an action (flash message)
   3. .uv-dlg           the pop-up that replaces the browser's plain alert() / confirm()
   Script: assets/js/uv-alerts.js
   ============================================================ */

/* ---------- 1. inline alert boxes ---------- */
.alert{
  --a:#0284c7; --bg:#f0f9ff; --tx:#0c4a6e; --ic:"\f430";
  position:relative; border:1px solid rgba(15,23,42,.05); border-left:5px solid var(--a); border-radius:14px;
  background:linear-gradient(100deg, var(--bg) 0%, #fff 140%); color:var(--tx);
  padding:.8rem 1.1rem .8rem 3.2rem; box-shadow:0 4px 14px -6px rgba(15,23,42,.18);
  animation:uvAlertIn .38s cubic-bezier(.2,.8,.2,1) both;
}
.alert::before{
  content:var(--ic); font-family:"bootstrap-icons"; font-style:normal; line-height:1;
  position:absolute; left:1.05rem; top:.78rem; font-size:1.3rem; color:var(--a);
}
.alert > .bi:first-child{color:var(--a);}
.alert a{color:inherit; font-weight:600; text-decoration-color:var(--a);}
.alert b, .alert strong{font-weight:700;}
.alert-success  {--a:#16a34a; --bg:#f0fdf4; --tx:#14532d; --ic:"\f26a";}
.alert-danger   {--a:#dc2626; --bg:#fef2f2; --tx:#7f1d1d; --ic:"\f622";}
.alert-warning  {--a:#d97706; --bg:#fffbeb; --tx:#78350f; --ic:"\f33a";}
.alert-info     {--a:#0284c7; --bg:#f0f9ff; --tx:#0c4a6e; --ic:"\f430";}
.alert-primary  {--a:#4f46e5; --bg:#eef2ff; --tx:#312e81; --ic:"\f189";}
.alert-secondary{--a:#64748b; --bg:#f8fafc; --tx:#334155; --ic:"\f430";}
.alert-dark     {--a:#0f172a; --bg:#f1f5f9; --tx:#0f172a; --ic:"\f430";}
/* quiet "tip" boxes: they carry their own small icon, so no big one and a soft edge */
.alert-light{--a:#6366f1; --bg:#f8fafc; --tx:#334155; padding-left:1.1rem; border-left-width:4px; box-shadow:0 2px 8px -4px rgba(15,23,42,.12);}
.alert-light::before{content:none;}
.alert.border{border-width:1px !important; border-left-width:4px !important;}
.alert .btn-close{padding:1rem; opacity:.55; transition:.15s;}
.alert .btn-close:hover{opacity:1; transform:rotate(90deg);}
.alert.fade:not(.show){transition:opacity .25s, transform .25s; transform:translateY(-6px);}
@keyframes uvAlertIn{from{opacity:0; transform:translateY(-10px) scale(.985);} to{opacity:1; transform:none;}}

/* ---------- 2. toast (flash message after an action) ---------- */
.uv-toast-wrap{position:fixed; top:74px; right:22px; z-index:2000; width:min(420px, calc(100vw - 24px)); display:flex; flex-direction:column; gap:10px; pointer-events:none;}
.uv-toast{
  --a:#16a34a; --soft:#dcfce7;
  position:relative; overflow:hidden; pointer-events:auto; display:flex; gap:12px; align-items:flex-start;
  background:#fff; border-radius:16px; padding:14px 40px 16px 14px; border:1px solid rgba(15,23,42,.06);
  box-shadow:0 18px 40px -12px rgba(15,23,42,.35), 0 3px 8px rgba(15,23,42,.08);
  animation:uvToastIn .5s cubic-bezier(.2,.9,.25,1.1) both;
}
.uv-toast.uv-out{animation:uvToastOut .32s ease forwards;}
.uv-toast-success{--a:#16a34a; --soft:#dcfce7;}
.uv-toast-danger {--a:#dc2626; --soft:#fee2e2;}
.uv-toast-warning{--a:#d97706; --soft:#fef3c7;}
.uv-toast-info   {--a:#0284c7; --soft:#e0f2fe;}
.uv-toast-ic{flex:0 0 40px; width:40px; height:40px; border-radius:12px; background:var(--soft); color:var(--a); display:flex; align-items:center; justify-content:center; font-size:21px; animation:uvPop .55s .15s cubic-bezier(.2,1.6,.4,1) both;}
.uv-toast-body{min-width:0; flex:1;}
.uv-toast-title{font-weight:700; font-size:14.2px; color:#0f172a; line-height:1.3;}
.uv-toast-msg{font-size:13.3px; color:#475569; line-height:1.5; margin-top:2px; overflow-wrap:anywhere;}
.uv-toast-msg a{color:var(--a); font-weight:600;}
.uv-toast-x{position:absolute; top:9px; right:9px; width:26px; height:26px; border:0; border-radius:8px; background:transparent; color:#94a3b8; font-size:15px; line-height:1; cursor:pointer; transition:.15s;}
.uv-toast-x:hover{background:#f1f5f9; color:#0f172a;}
.uv-toast-bar{position:absolute; left:0; bottom:0; height:4px; width:100%; background:var(--a); transform-origin:left; animation:uvBar linear forwards; animation-duration:var(--ms,6s);}
.uv-toast:hover .uv-toast-bar, .uv-toast.uv-hold .uv-toast-bar{animation-play-state:paused;}
@keyframes uvToastIn{from{opacity:0; transform:translateX(60px) scale(.96);} to{opacity:1; transform:none;}}
@keyframes uvToastOut{to{opacity:0; transform:translateX(60px) scale(.96);}}
@keyframes uvBar{from{transform:scaleX(1);} to{transform:scaleX(0);}}
@keyframes uvPop{from{transform:scale(0) rotate(-25deg);} to{transform:none;}}
@media (max-width:575.98px){ .uv-toast-wrap{top:64px; right:12px; left:12px; width:auto;} }

/* ---------- 3. dialog (replaces alert() and confirm()) ---------- */
.uv-dlg-back{position:fixed; inset:0; z-index:2100; display:flex; align-items:center; justify-content:center; padding:18px;
  background:rgba(15,23,42,.5); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); animation:uvFade .2s ease both;}
.uv-dlg-back.uv-out{animation:uvFadeOut .18s ease forwards;}
.uv-dlg{
  --a:#4f46e5; --soft:#e0e7ff;
  width:min(420px,100%); background:#fff; border-radius:22px; padding:30px 26px 22px; text-align:center; position:relative;
  box-shadow:0 30px 70px -20px rgba(15,23,42,.55); animation:uvDlgIn .38s cubic-bezier(.2,1.1,.3,1) both;
}
.uv-dlg-back.uv-out .uv-dlg{animation:uvDlgOut .18s ease forwards;}
.uv-dlg-danger {--a:#dc2626; --soft:#fee2e2;}
.uv-dlg-warning{--a:#d97706; --soft:#fef3c7;}
.uv-dlg-success{--a:#16a34a; --soft:#dcfce7;}
.uv-dlg-info   {--a:#0284c7; --soft:#e0f2fe;}
.uv-dlg-ask    {--a:#4f46e5; --soft:#e0e7ff;}
.uv-dlg-ic{width:74px; height:74px; margin:0 auto 16px; border-radius:50%; background:var(--soft); color:var(--a); display:flex; align-items:center; justify-content:center; font-size:34px; position:relative; animation:uvPop .55s .1s cubic-bezier(.2,1.6,.4,1) both;}
.uv-dlg-ic::after{content:""; position:absolute; inset:-7px; border-radius:50%; border:2px solid var(--soft); animation:uvRing 1.8s ease-out infinite;}
.uv-dlg-danger .uv-dlg-ic{animation:uvPop .55s .1s cubic-bezier(.2,1.6,.4,1) both, uvShake .5s .55s ease both;}
.uv-dlg-title{font-size:19px; font-weight:700; color:#0f172a; margin:0 0 6px; letter-spacing:-.2px;}
.uv-dlg-msg{font-size:14.2px; line-height:1.6; color:#475569; margin:0 0 22px; white-space:pre-line; overflow-wrap:anywhere;}
.uv-dlg-btns{display:flex; gap:10px; justify-content:center;}
.uv-dlg-btns button{flex:1; max-width:190px; border:0; border-radius:12px; padding:11px 16px; font-size:14px; font-weight:600; cursor:pointer; transition:transform .12s, box-shadow .15s, background .15s;}
.uv-dlg-btns button:active{transform:scale(.97);}
.uv-dlg-no{background:#f1f5f9; color:#334155;}
.uv-dlg-no:hover{background:#e2e8f0;}
.uv-dlg-yes{background:var(--a); color:#fff; box-shadow:0 8px 18px -8px var(--a);}
.uv-dlg-yes:hover{filter:brightness(1.08); box-shadow:0 10px 22px -8px var(--a);}
.uv-dlg-btns button:focus-visible{outline:3px solid var(--soft); outline-offset:2px;}
.uv-dlg-hint{font-size:11.5px; color:#94a3b8; margin-top:12px;}
body.uv-dlg-open{overflow:hidden;}
@keyframes uvFade{from{opacity:0;} to{opacity:1;}}
@keyframes uvFadeOut{to{opacity:0;}}
@keyframes uvDlgIn{from{opacity:0; transform:translateY(22px) scale(.92);} to{opacity:1; transform:none;}}
@keyframes uvDlgOut{to{opacity:0; transform:translateY(10px) scale(.96);}}
@keyframes uvRing{0%{transform:scale(.9); opacity:.9;} 100%{transform:scale(1.35); opacity:0;}}
@keyframes uvShake{0%,100%{transform:translateX(0);} 20%{transform:translateX(-5px);} 40%{transform:translateX(5px);} 60%{transform:translateX(-3px);} 80%{transform:translateX(3px);}}
@media (max-width:420px){ .uv-dlg{padding:26px 18px 18px;} .uv-dlg-btns{flex-direction:column-reverse;} .uv-dlg-btns button{max-width:none;} }
@media (prefers-reduced-motion:reduce){ .alert,.uv-toast,.uv-dlg,.uv-dlg-back,.uv-dlg-ic,.uv-toast-ic{animation:none !important;} .uv-dlg-ic::after{display:none;} }
