/**
 * Electra HMIS Custom Dialog & Alert System
 * Creative, Modern, Clean, Animated & Accessible
 * Exclusively Geist Font | Full Dark Mode Parity
 */

@font-face {
    font-family: 'Geist';
    src: url('../fonts/Geist-Variable.woff2') format('woff2');
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

/* Backdrop Overlay with Silky Frosted Blur */
.custom-dialog-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 999999999 !important;
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.26s cubic-bezier(0.16, 1, 0.3, 1) !important;
    font-family: 'Geist', sans-serif !important;
}

.custom-dialog-backdrop.custom-dialog-open {
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* Dialog Floating Card with Spring Entrance */
.custom-dialog-card {
    position: relative !important;
    width: 100% !important;
    max-width: 440px !important;
    background: #ffffff !important;
    border: 1px solid rgba(226, 232, 240, 0.9) !important;
    border-radius: 20px !important;
    box-shadow: 0 30px 70px -15px rgba(15, 23, 42, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.9) inset !important;
    padding: 32px 28px 26px 28px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
    transform: scale(0.88) translateY(18px);
    opacity: 0;
    transition: transform 0.32s cubic-bezier(0.34, 1.45, 0.64, 1), opacity 0.25s ease !important;
    font-family: 'Geist', sans-serif !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
}

.custom-dialog-backdrop.custom-dialog-open .custom-dialog-card {
    transform: scale(1) translateY(0) !important;
    opacity: 1 !important;
}

.custom-dialog-backdrop.custom-dialog-closing .custom-dialog-card {
    transform: scale(0.92) translateY(10px) !important;
    opacity: 0 !important;
    transition: transform 0.18s ease-in, opacity 0.15s ease-in !important;
}

/* Luminous Accent Top Bar */
.custom-dialog-top-beam {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 3.5px !important;
    background: linear-gradient(90deg, transparent 5%, #00a8a8 50%, transparent 95%) !important;
    opacity: 0.9 !important;
}

.custom-dialog-card[data-type="warning"] .custom-dialog-top-beam {
    background: linear-gradient(90deg, transparent 5%, #f59e0b 50%, transparent 95%) !important;
}

.custom-dialog-card[data-type="error"] .custom-dialog-top-beam {
    background: linear-gradient(90deg, transparent 5%, #ef4444 50%, transparent 95%) !important;
}

.custom-dialog-card[data-type="success"] .custom-dialog-top-beam {
    background: linear-gradient(90deg, transparent 5%, #10b981 50%, transparent 95%) !important;
}

.custom-dialog-card[data-type="info"] .custom-dialog-top-beam {
    background: linear-gradient(90deg, transparent 5%, #0284c7 50%, transparent 95%) !important;
}

/* Strict Geist font enforcement */
.custom-dialog-card,
.custom-dialog-card * {
    font-family: 'Geist', sans-serif !important;
}

/* Top Close Button (Hidden as per user preference) */
.custom-dialog-close-btn,
.sa-close-button {
    display: none !important;
}

/* Status Badge Container with Ambient Glow */
.custom-dialog-icon-wrap {
    margin-bottom: 18px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: relative !important;
}

/* Ethereal Glowing Aura */
.custom-dialog-aura {
    position: absolute !important;
    width: 90px !important;
    height: 90px !important;
    border-radius: 50% !important;
    background: radial-gradient(circle, rgba(0, 168, 168, 0.25) 0%, rgba(0, 168, 168, 0.06) 60%, transparent 80%) !important;
    filter: blur(10px) !important;
    z-index: 0 !important;
    pointer-events: none !important;
    animation: cdAuraBreathe 3s ease-in-out infinite alternate !important;
}

.custom-dialog-icon-wrap[data-type="warning"] .custom-dialog-aura {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.32) 0%, rgba(245, 158, 11, 0.08) 60%, transparent 80%) !important;
}

.custom-dialog-icon-wrap[data-type="error"] .custom-dialog-aura {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.32) 0%, rgba(239, 68, 68, 0.08) 60%, transparent 80%) !important;
}

.custom-dialog-icon-wrap[data-type="success"] .custom-dialog-aura {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.32) 0%, rgba(16, 185, 129, 0.08) 60%, transparent 80%) !important;
}

.custom-dialog-icon-wrap[data-type="info"] .custom-dialog-aura {
    background: radial-gradient(circle, rgba(2, 132, 199, 0.32) 0%, rgba(2, 132, 199, 0.08) 60%, transparent 80%) !important;
}

/* SVG Badge with Spring Pop Entrance */
.custom-dialog-icon-svg {
    width: 68px !important;
    height: 68px !important;
    display: block !important;
    position: relative !important;
    z-index: 1 !important;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.1)) !important;
    transform-origin: 32px 32px !important;
    animation: cdBadgeSpring 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

/* Continuous Gentle Outer Dashed Ring Rotation */
.cd-ring-dashed {
    transform-origin: 32px 32px !important;
    animation: cdRotateDashed 24s linear infinite !important;
}

/* Continuous Soft Breathing Ring Pulse */
.cd-ring-outer {
    transform-origin: 32px 32px !important;
    animation: cdPulseRing 3.2s ease-in-out infinite alternate !important;
}

/* Glyph Entrance Bounce */
.cd-glyph {
    transform-origin: 32px 32px !important;
    animation: cdGlyphBounce 0.45s 0.14s cubic-bezier(0.34, 1.56, 0.64, 1) both !important;
}

/* Title with Staggered Slide-Up */
.custom-dialog-title {
    font-size: 22px !important;
    font-weight: 800 !important;
    letter-spacing: -0.025em !important;
    color: #0f172a !important;
    margin: 0 0 8px 0 !important;
    line-height: 1.25 !important;
    word-break: break-word !important;
    animation: cdFadeSlideUp 0.35s 0.06s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

/* Message / Body Text with Staggered Slide-Up */
.custom-dialog-message {
    font-size: 13.5px !important;
    font-weight: 400 !important;
    color: #64748b !important;
    line-height: 1.55 !important;
    margin: 0 0 24px 0 !important;
    word-break: break-word !important;
    max-width: 380px !important;
    animation: cdFadeSlideUp 0.35s 0.12s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

.custom-dialog-message p {
    margin: 0 0 6px 0 !important;
}

.custom-dialog-message p:last-child {
    margin-bottom: 0 !important;
}

/* Input / Prompt Container */
.custom-dialog-input-wrap {
    width: 100% !important;
    margin-bottom: 22px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    animation: cdFadeSlideUp 0.35s 0.14s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

.custom-dialog-input {
    width: 100% !important;
    height: 42px !important;
    padding: 0 14px !important;
    background: #f8fafc !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    color: #0f172a !important;
    outline: none !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease !important;
    box-sizing: border-box !important;
}

.custom-dialog-input:focus {
    background: #ffffff !important;
    border-color: #00a8a8 !important;
    box-shadow: 0 0 0 3px rgba(0, 168, 168, 0.18) !important;
}

.custom-dialog-input.has-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18) !important;
    animation: customDialogShake 0.35s ease-in-out !important;
}

.custom-dialog-input-error {
    color: #ef4444 !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    margin-top: 6px !important;
    text-align: left !important;
    display: none;
    align-items: center !important;
    gap: 4px !important;
}

.custom-dialog-input-error.visible {
    display: flex !important;
}

/* Action Buttons Container with Staggered Slide-Up */
.custom-dialog-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 12px !important;
    width: 100% !important;
    margin-top: 4px !important;
    animation: cdFadeSlideUp 0.35s 0.18s cubic-bezier(0.16, 1, 0.3, 1) both !important;
}

/* Buttons Base with Diagonal Sheen Hover Effect */
.custom-dialog-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px !important;
    min-width: 110px !important;
    height: 42px !important;
    padding: 0 22px !important;
    border-radius: 10px !important;
    font-size: 13.5px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    outline: none !important;
    border: none !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    user-select: none !important;
    text-decoration: none !important;
    box-sizing: border-box !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Light Sheen Beam on Hover */
.custom-dialog-btn::after {
    content: '' !important;
    position: absolute !important;
    top: -50% !important;
    left: -70% !important;
    width: 50% !important;
    height: 200% !important;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent) !important;
    transform: rotate(25deg) !important;
    transition: left 0.65s cubic-bezier(0.16, 1, 0.3, 1) !important;
    pointer-events: none !important;
}

.custom-dialog-btn:hover::after {
    left: 130% !important;
}

.custom-dialog-btn:hover {
    transform: translateY(-2px) !important;
}

.custom-dialog-btn:active {
    transform: translateY(1px) scale(0.98) !important;
}

.custom-dialog-btn:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* Cancel Button (Refined Ghost Outline with Shadow) */
.custom-dialog-btn-cancel {
    background: #f8fafc !important;
    color: #475569 !important;
    border: 1.5px solid #e2e8f0 !important;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04) !important;
}

.custom-dialog-btn-cancel:hover {
    background: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
}

/* Confirm Button (Vibrant Teal Multi-Stop Gradient) */
.custom-dialog-btn-confirm {
    background: linear-gradient(135deg, #00a8a8 0%, #0d9488 50%, #0f766e 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px -2px rgba(0, 168, 168, 0.4) !important;
}

.custom-dialog-btn-confirm:hover {
    box-shadow: 0 9px 24px -2px rgba(0, 168, 168, 0.55) !important;
}

/* Confirm Button (Danger Crimson Multi-Stop Gradient) */
.custom-dialog-btn-danger {
    background: linear-gradient(135deg, #f43f5e 0%, #e11d48 50%, #be123c 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 18px -2px rgba(225, 29, 72, 0.4) !important;
}

.custom-dialog-btn-danger:hover {
    box-shadow: 0 9px 24px -2px rgba(225, 29, 72, 0.55) !important;
}

/* Button Loading Spinner */
.custom-dialog-btn .cp-spinner {
    width: 14px !important;
    height: 14px !important;
    border: 2px solid rgba(255, 255, 255, 0.35) !important;
    border-top-color: #ffffff !important;
    border-radius: 50% !important;
    animation: customDialogSpin 0.7s linear infinite !important;
}

/* ==========================================================================
   Keyframe Animations
   ========================================================================== */

/* Badge Spring Pop */
@keyframes cdBadgeSpring {
    0% {
        transform: scale(0.35) rotate(-18deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.12) rotate(4deg);
        opacity: 1;
    }
    85% {
        transform: scale(0.97) rotate(-1deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Dashed Ring Rotation */
@keyframes cdRotateDashed {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Outer Ring Subtle Breathing */
@keyframes cdPulseRing {
    0%, 100% {
        transform: scale(1);
        stroke-opacity: 0.75;
    }
    50% {
        transform: scale(1.035);
        stroke-opacity: 1;
    }
}

/* Aura Glow Breathing */
@keyframes cdAuraBreathe {
    0%, 100% {
        transform: scale(0.9);
        opacity: 0.55;
    }
    50% {
        transform: scale(1.18);
        opacity: 0.9;
    }
}

/* Glyph Entrance Bounce */
@keyframes cdGlyphBounce {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.25);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Staggered Slide-Up */
@keyframes cdFadeSlideUp {
    0% {
        transform: translateY(10px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Input Error Shake Animation */
@keyframes customDialogShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes customDialogSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Dark Mode Parity
   ========================================================================== */
.dark .custom-dialog-backdrop {
    background: rgba(15, 23, 42, 0.72) !important;
}

.dark .custom-dialog-card {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06) inset !important;
}

.dark .custom-dialog-close-btn {
    color: #64748b !important;
}

.dark .custom-dialog-close-btn:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}

.dark .custom-dialog-title {
    color: #f8fafc !important;
}

.dark .custom-dialog-message {
    color: #94a3b8 !important;
}

.dark .custom-dialog-input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

.dark .custom-dialog-input:focus {
    border-color: #2dd4bf !important;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.2) !important;
}

.dark .custom-dialog-btn-cancel {
    background: #334155 !important;
    color: #cbd5e1 !important;
    border-color: #475569 !important;
    box-shadow: none !important;
}

.dark .custom-dialog-btn-cancel:hover {
    background: #475569 !important;
    color: #ffffff !important;
    border-color: #64748b !important;
}
