/* ================================================================
   Pars premium toast overrides — restyles Toastr's default solid
   red/green/blue bricks into a frosted-glass tinted surface that
   feels closer to Apple / Stripe transactional toasts.

   Loads AFTER the Toastr CDN stylesheet so the same selectors win
   on cascade. Targets the markup Toastr emits at runtime — no call
   sites change. `toastr.error('Invalid credentials')` becomes a
   soft tinted card without touching the JS.
   ================================================================ */

/* Container — keep Toastr's positioning logic, just nudge stack
   gap so toasts don't kiss when several queue up. */
#toast-container {
    z-index: 10000;
}
#toast-container > div {
    box-shadow: none !important;
    opacity: 1;
}
#toast-container > .toast {
    width: 360px;
    max-width: calc(100vw - 32px);
    margin-bottom: 12px;
}

/* Base toast — frosted-glass surface, hairline border, soft layered
   shadow. State-specific rules below tint the surface and recolor
   the border + icon. */
#toast-container > .toast {
    position: relative;
    padding: 14px 40px 14px 46px;
    border-radius: 14px;
    background-color: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 8px 24px rgba(15, 23, 42, 0.06),
        0 24px 48px rgba(15, 23, 42, 0.04);
    /* Toastr ships a state-colored SVG as the toast's own
       background-image — kill it; we render our own icon via ::before. */
    background-image: none !important;
    color: #0f172a;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.45;
    letter-spacing: -0.005em;
    animation: pars-toast-in 320ms cubic-bezier(.2, .8, .2, 1) both;
}

/* Icon — 18px, absolutely positioned so it hugs the first line of
   text regardless of message length. */
#toast-container > .toast::before {
    content: "";
    position: absolute;
    top: 16px;
    left: 18px;
    width: 18px;
    height: 18px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

/* Title + message stack. Title is optional (Toastr only renders it
   when you call toastr.error('msg', 'title')). */
#toast-container > .toast .toast-title {
    margin: 0 0 2px;
    font-size: 14px;
    font-weight: 600;
    color: inherit;
}
#toast-container > .toast .toast-message {
    font-size: 14px;
    color: inherit;
    word-wrap: break-word;
}
#toast-container > .toast .toast-message a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Close button — Toastr's default "×" is bright white and giant.
   Make it a quiet 22px chip that only colors in on hover/focus. */
#toast-container > .toast .toast-close-button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    padding: 0;
    line-height: 22px;
    font-size: 14px;
    font-weight: 400;
    color: #64748b;
    text-shadow: none;
    background: transparent;
    border: none;
    border-radius: 999px;
    opacity: 0.6;
    transition: opacity 0.15s ease, background 0.15s ease;
}
#toast-container > .toast .toast-close-button:hover,
#toast-container > .toast .toast-close-button:focus {
    opacity: 1;
    background: rgba(15, 23, 42, 0.06);
    outline: none;
}

/* Progress bar — slim 2px state-colored line hugged to the bottom
   edge so it reads as a quiet countdown, not a chunky stripe.
   Disabled by default in toastr.options, but the styling is here
   for any caller that opts in. */
#toast-container > .toast > .toast-progress {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    opacity: 0.5;
    background-color: currentColor;
}

/* === State variants =============================================
   Each state gets a tinted surface (subtle, ~14% over white), a
   border in the state's accent color, and a matching outline-style
   icon. Icons are inlined as data URIs so we never hit a CDN. */

/* Error — calm red, dark-red text. */
#toast-container > .toast-error {
    background-color: rgba(254, 242, 242, 0.86);
    border-color: rgba(220, 38, 38, 0.18);
    color: #7f1d1d;
}
#toast-container > .toast-error::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' y1='8' x2='12' y2='12'/><line x1='12' y1='16' x2='12.01' y2='16'/></svg>");
}

/* Success — emerald. */
#toast-container > .toast-success {
    background-color: rgba(236, 253, 245, 0.86);
    border-color: rgba(5, 150, 105, 0.18);
    color: #064e3b;
}
#toast-container > .toast-success::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23059669' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M22 11.08V12a10 10 0 1 1-5.93-9.14'/><polyline points='22 4 12 14.01 9 11.01'/></svg>");
}

/* Info — Pars brand blue. */
#toast-container > .toast-info {
    background-color: rgba(239, 246, 255, 0.86);
    border-color: rgba(10, 88, 202, 0.18);
    color: #0c2d6b;
}
#toast-container > .toast-info::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%230A58CA' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='10'/><line x1='12' y1='16' x2='12' y2='12'/><line x1='12' y1='8' x2='12.01' y2='8'/></svg>");
}

/* Warning — amber. */
#toast-container > .toast-warning {
    background-color: rgba(255, 251, 235, 0.86);
    border-color: rgba(217, 119, 6, 0.18);
    color: #78350f;
}
#toast-container > .toast-warning::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z'/><line x1='12' y1='9' x2='12' y2='13'/><line x1='12' y1='17' x2='12.01' y2='17'/></svg>");
}

/* Hover — Toastr's default ramps opacity to 1 (we already render
   at full opacity), and adds a click cursor. Lift via shadow + a
   subtle brightness instead. */
#toast-container > .toast:hover {
    opacity: 1 !important;
    box-shadow:
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 12px 30px rgba(15, 23, 42, 0.10),
        0 28px 56px rgba(15, 23, 42, 0.06);
    cursor: pointer;
}

/* Entrance — fade + 8px slide from the upper-right corner. Pairs
   with `toastr.options.showMethod = 'show'` (set in script.blade.php)
   so jQuery doesn't double-animate opacity. */
@keyframes pars-toast-in {
    from {
        opacity: 0;
        transform: translate3d(8px, -8px, 0) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Reduced motion — drop the slide; keep just a soft fade. */
@media (prefers-reduced-motion: reduce) {
    #toast-container > .toast {
        animation: pars-toast-fade-in 180ms ease-out both;
    }
    @keyframes pars-toast-fade-in {
        from { opacity: 0; }
        to   { opacity: 1; }
    }
}

/* Mobile — full-bleed minus 16px gutter, slightly tighter padding. */
@media (max-width: 640px) {
    #toast-container.toast-top-right,
    #toast-container.toast-top-center,
    #toast-container.toast-top-left,
    #toast-container.toast-top-full-width,
    #toast-container.toast-bottom-right,
    #toast-container.toast-bottom-center,
    #toast-container.toast-bottom-left,
    #toast-container.toast-bottom-full-width {
        right: 0 !important;
        left: 0 !important;
        width: 100%;
        padding: 0 16px;
    }
    #toast-container > .toast {
        width: 100% !important;
        padding: 13px 36px 13px 42px;
    }
    #toast-container > .toast::before {
        left: 16px;
    }
}

/* Dark mode — flip the surface to a dark frosted panel; state tints
   stay tinted (just deeper). The site is light-theme today, but this
   keeps the component portable if dark gets added later. */
@media (prefers-color-scheme: dark) {
    #toast-container > .toast {
        background-color: rgba(15, 23, 42, 0.78);
        border-color: rgba(255, 255, 255, 0.08);
        color: #e2e8f0;
    }
    #toast-container > .toast-error {
        background-color: rgba(127, 29, 29, 0.55);
        border-color: rgba(248, 113, 113, 0.32);
        color: #fee2e2;
    }
    #toast-container > .toast-success {
        background-color: rgba(6, 78, 59, 0.55);
        border-color: rgba(52, 211, 153, 0.32);
        color: #d1fae5;
    }
    #toast-container > .toast-info {
        background-color: rgba(12, 45, 107, 0.55);
        border-color: rgba(96, 165, 250, 0.32);
        color: #dbeafe;
    }
    #toast-container > .toast-warning {
        background-color: rgba(120, 53, 15, 0.55);
        border-color: rgba(251, 191, 36, 0.32);
        color: #fef3c7;
    }
    #toast-container > .toast .toast-close-button { color: #94a3b8; }
}
