/**
 * Calzi ERP - Unified Glassmorphic Success Notification System
 * Applies modern frosted-glass UI to all SweetAlert2 success dialogs & toasts,
 * Alertify success notifications, Bootstrap .alert-success banners, and glassy toasts.
 */

@keyframes calziGlassModalIn {
    0% {
        opacity: 0;
        transform: translateY(14px) scale(0.92);
    }
    65% {
        opacity: 1;
        transform: translateY(-2px) scale(1.01);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes calziGlassToastIn {
    0% {
        opacity: 0;
        transform: translate3d(24px, -6px, 0) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

@keyframes calziGlassPulseGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.22), inset 0 1px 2px rgba(255, 255, 255, 0.85);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0), inset 0 1px 2px rgba(255, 255, 255, 0.85);
    }
}

/* ==========================================================================
   1. SweetAlert2 Glassy Backdrop (Modal Only - Never on Toasts)
   ========================================================================== */
html body .swal2-container.calzi-glass-backdrop,
html body .swal2-container:has(.swal2-icon.swal2-success) {
    z-index: 20000 !important;
}

html body .swal2-container.calzi-glass-backdrop:not(:has(.swal2-toast)).swal2-backdrop-show,
html body .swal2-container:not(:has(.swal2-toast)):has(.swal2-icon.swal2-success).swal2-backdrop-show {
    background: rgba(15, 23, 42, 0.26) !important;
    backdrop-filter: blur(6px) saturate(125%) !important;
    -webkit-backdrop-filter: blur(6px) saturate(125%) !important;
}

html body.swal2-toast-shown .swal2-container,
html body .swal2-container:has(.swal2-toast) {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    width: auto !important;
    height: auto !important;
    bottom: auto !important;
    pointer-events: none !important;
}

html body .swal2-container .swal2-popup.swal2-toast {
    pointer-events: auto !important;
}

/* ==========================================================================
   2. SweetAlert2 Centered Success Modal Card (Glassmorphic)
   ========================================================================== */
html body .swal2-container .swal2-popup.calzi-glass-success:not(.swal2-toast),
html body .swal2-container .swal2-popup:not(.swal2-toast):has(.swal2-icon.swal2-success) {
    position: relative !important;
    overflow: hidden !important;
    background: linear-gradient(
        145deg,
        rgba(255, 255, 255, 0.86) 0%,
        rgba(240, 253, 244, 0.78) 52%,
        rgba(255, 255, 255, 0.84) 100%
    ) !important;
    backdrop-filter: blur(24px) saturate(185%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(185%) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.92) !important;
    border-radius: 24px !important;
    box-shadow:
        0 26px 60px -14px rgba(15, 23, 42, 0.22),
        0 14px 34px -8px rgba(16, 185, 129, 0.22),
        0 0 0 1px rgba(16, 185, 129, 0.18),
        inset 0 1.5px 0 rgba(255, 255, 255, 0.95),
        inset 0 -1px 0 rgba(16, 185, 129, 0.12) !important;
    padding: 2.15rem 2rem 1.85rem !important;
    color: #0f172a !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success.swal2-show:not(.swal2-toast):not(.swal2-hide),
html body .swal2-container .swal2-popup.swal2-show:not(.swal2-toast):not(.swal2-hide):has(.swal2-icon.swal2-success) {
    animation: calziGlassModalIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success:not(.swal2-toast)::before,
html body .swal2-container .swal2-popup:not(.swal2-toast):has(.swal2-icon.swal2-success)::before {
    content: '';
    position: absolute;
    top: 0;
    left: 14%;
    right: 14%;
    height: 3px;
    border-radius: 0 0 999px 999px;
    background: linear-gradient(90deg, transparent 0%, rgba(16, 185, 129, 0.72) 35%, rgba(52, 211, 153, 0.95) 50%, rgba(16, 185, 129, 0.72) 65%, transparent 100%);
    pointer-events: none;
}

/* Remove opaque white circular masks that create boxy artifacts on glass */
html body .swal2-container .swal2-popup .swal2-icon.swal2-success .swal2-success-circular-line-left,
html body .swal2-container .swal2-popup .swal2-icon.swal2-success .swal2-success-circular-line-right,
html body .swal2-container .swal2-popup .swal2-icon.swal2-success .swal2-success-fix {
    background-color: transparent !important;
    background: transparent !important;
}

/* Frosted emerald aura behind checkmark icon */
html body .swal2-container .swal2-popup.calzi-glass-success .swal2-icon.swal2-success,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-icon.swal2-success {
    background: radial-gradient(circle at 32% 30%, rgba(167, 243, 208, 0.55) 0%, rgba(16, 185, 129, 0.14) 72%, rgba(255, 255, 255, 0.25) 100%) !important;
    border-color: rgba(16, 185, 129, 0.32) !important;
    box-shadow: 0 12px 26px -6px rgba(16, 185, 129, 0.28), inset 0 1px 2px rgba(255, 255, 255, 0.85) !important;
    animation: calziGlassPulseGlow 2.4s ease-in-out infinite !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-icon.swal2-success .swal2-success-ring,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, 0.28) !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-icon.swal2-success [class^="swal2-success-line"],
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-icon.swal2-success [class^="swal2-success-line"] {
    background-color: #059669 !important;
    border-radius: 999px !important;
}

/* Typography (supports both SweetAlert2 v10 .swal2-content and v11 .swal2-html-container) */
html body .swal2-container .swal2-popup.calzi-glass-success .swal2-title,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-title {
    font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    letter-spacing: -0.025em !important;
    margin-bottom: 0.35rem !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-html-container,
html body .swal2-container .swal2-popup.calzi-glass-success .swal2-content,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-html-container,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-content {
    font-family: 'Inter', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-size: 0.96rem !important;
    font-weight: 500 !important;
    color: #475569 !important;
    line-height: 1.58 !important;
}

/* Confirm Button (Glass Emerald Pill — cleanly replaces hardcoded legacy #3085d6 blue) */
html body .swal2-container .swal2-popup.calzi-glass-success .swal2-actions,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-actions {
    gap: 10px !important;
    margin-top: 1.45rem !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-confirm,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-confirm {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
    background-color: #059669 !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.38) !important;
    border-radius: 12px !important;
    padding: 0.7rem 2.1rem !important;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
    font-size: 0.92rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.01em !important;
    box-shadow:
        0 10px 24px -6px rgba(16, 185, 129, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.38) !important;
    transition: transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.18s ease !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-confirm:hover,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-confirm:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
    transform: translateY(-1.5px) !important;
    box-shadow:
        0 14px 28px -6px rgba(5, 150, 105, 0.58),
        inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-confirm:focus,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-confirm:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.28), 0 10px 24px -6px rgba(16, 185, 129, 0.45) !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-cancel,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-cancel {
    background: rgba(255, 255, 255, 0.72) !important;
    color: #334155 !important;
    border: 1px solid rgba(203, 213, 225, 0.85) !important;
    border-radius: 12px !important;
    padding: 0.7rem 1.5rem !important;
    font-weight: 600 !important;
    backdrop-filter: blur(8px) !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-close,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-close {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    margin: 10px 10px 0 0 !important;
    background: rgba(255, 255, 255, 0.65) !important;
    border: 1px solid rgba(226, 232, 240, 0.75) !important;
    color: #475569 !important;
    font-size: 1.35rem !important;
    transition: all 0.18s ease !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-close:hover,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-close:hover {
    background: rgba(236, 253, 245, 0.95) !important;
    color: #059669 !important;
}

/* Auto-closing non-button alert dialogs (all icons) */
html body .swal2-container .swal2-popup.calzi-auto-alert:not(.swal2-toast) {
    border-radius: 22px !important;
    padding-bottom: 1.9rem !important;
    cursor: pointer;
}

html body .swal2-container .swal2-popup.calzi-auto-alert .swal2-timer-progress-bar-container {
    height: 4px !important;
}

html body .swal2-container .swal2-popup.calzi-auto-alert .swal2-timer-progress-bar {
    height: 4px !important;
    background: linear-gradient(90deg, rgba(234, 88, 12, 0.45), #f97316, #ea580c) !important;
}

/* Timer Progress Bar */
html body .swal2-container .swal2-popup.calzi-glass-success .swal2-timer-progress-bar-container,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-timer-progress-bar-container {
    height: 4px !important;
}

html body .swal2-container .swal2-popup.calzi-glass-success .swal2-timer-progress-bar,
html body .swal2-container .swal2-popup:has(.swal2-icon.swal2-success) .swal2-timer-progress-bar {
    height: 4px !important;
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.45), #10b981, #34d399) !important;
}

/* ==========================================================================
   3. SweetAlert2 Success Toast Card (Glassmorphic Floating Pill)
   ========================================================================== */
html body .swal2-container .swal2-popup.swal2-toast.calzi-glass-success,
html body .swal2-container .swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) {
    overflow: hidden !important;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(236, 253, 245, 0.84) 100%
    ) !important;
    backdrop-filter: blur(20px) saturate(185%) !important;
    -webkit-backdrop-filter: blur(20px) saturate(185%) !important;
    border: 1px solid rgba(255, 255, 255, 0.94) !important;
    border-left: 4px solid #10b981 !important;
    border-radius: 16px !important;
    box-shadow:
        0 18px 38px -10px rgba(15, 23, 42, 0.18),
        0 8px 20px -6px rgba(16, 185, 129, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
    padding: 0.85rem 1.2rem !important;
}

html body .swal2-container .swal2-popup.swal2-toast.calzi-glass-success.swal2-show:not(.swal2-hide),
html body .swal2-container .swal2-popup.swal2-toast.swal2-show:not(.swal2-hide):has(.swal2-icon.swal2-success) {
    animation: calziGlassToastIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
}

html body .swal2-container .swal2-popup.swal2-toast.calzi-glass-success .swal2-title,
html body .swal2-container .swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) .swal2-title {
    font-size: 0.96rem !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    margin: 0 0 0 0.65rem !important;
}

html body .swal2-container .swal2-popup.swal2-toast.calzi-glass-success .swal2-html-container,
html body .swal2-container .swal2-popup.swal2-toast.calzi-glass-success .swal2-content,
html body .swal2-container .swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) .swal2-html-container,
html body .swal2-container .swal2-popup.swal2-toast:has(.swal2-icon.swal2-success) .swal2-content {
    font-size: 0.85rem !important;
    color: #475569 !important;
}

/* ==========================================================================
   4. Inline Bootstrap Success Banners (.alert.alert-success) & AlertifyJS
   ========================================================================== */
html body .alert.alert-success:not(.alert-unstyled) {
    position: relative;
    background: linear-gradient(
        135deg,
        rgba(236, 253, 245, 0.88) 0%,
        rgba(255, 255, 255, 0.82) 100%
    ) !important;
    backdrop-filter: blur(16px) saturate(170%) !important;
    -webkit-backdrop-filter: blur(16px) saturate(170%) !important;
    border: 1px solid rgba(16, 185, 129, 0.28) !important;
    border-left: 4px solid #10b981 !important;
    border-radius: 14px !important;
    color: #065f46 !important;
    box-shadow:
        0 10px 26px -8px rgba(16, 185, 129, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
    padding: 0.95rem 1.25rem !important;
}

html body .alert.alert-success strong {
    color: #047857 !important;
    font-weight: 700;
}

html body .alertify-notifier .ajs-message.ajs-success {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.9) 0%,
        rgba(236, 253, 245, 0.84) 100%
    ) !important;
    backdrop-filter: blur(18px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.94) !important;
    border-left: 4px solid #10b981 !important;
    border-radius: 14px !important;
    color: #0f172a !important;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif !important;
    font-weight: 700 !important;
    font-size: 0.92rem !important;
    box-shadow:
        0 16px 36px -8px rgba(15, 23, 42, 0.16),
        0 6px 16px -4px rgba(16, 185, 129, 0.18) !important;
    padding: 12px 18px !important;
}

/* Glassy Bootstrap Toast variant */
html body .toast.calzi-glass-toast-bs {
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.88) 0%,
        rgba(236, 253, 245, 0.82) 100%
    ) !important;
    backdrop-filter: blur(18px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(18px) saturate(180%) !important;
    border: 1px solid rgba(255, 255, 255, 0.92) !important;
    border-left: 4px solid #10b981 !important;
    border-radius: 16px !important;
    box-shadow:
        0 18px 40px -10px rgba(15, 23, 42, 0.18),
        0 8px 20px -6px rgba(16, 185, 129, 0.18) !important;
    overflow: hidden;
}

html body .toast.calzi-glass-toast-bs .toast-header {
    background: rgba(236, 253, 245, 0.65) !important;
    color: #065f46 !important;
    border-bottom: 1px solid rgba(16, 185, 129, 0.14) !important;
    font-weight: 700;
}

html body .toast.calzi-glass-toast-bs .toast-body {
    color: #334155 !important;
    font-weight: 500;
}

/* Mobile polish */
@media (max-width: 575.98px) {
    html body .swal2-container .swal2-popup.calzi-glass-success:not(.swal2-toast),
    html body .swal2-container .swal2-popup:not(.swal2-toast):has(.swal2-icon.swal2-success) {
        border-radius: 20px !important;
        padding: 1.75rem 1.35rem 1.5rem !important;
        width: calc(100% - 2rem) !important;
    }
}

/* Never show overlays in print / thermal bills */
@media print {
    html body .swal2-container,
    html body .alertify-notifier,
    html body .toast.calzi-glass-toast-bs {
        display: none !important;
    }
}
