/* Custom Premium Popups for backaldrin-new */

/* Hide Default PHPFlasher UI - We use our custom system instead */
.fl-wrapper, .fl-container {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

:root {
    --custom-white: #FFFFFF;
    --custom-success-green: #22A559;
    --custom-success-green-hover: #1e9450;
    --custom-success-green-bg: #F2FBF5;
    --custom-fail-red: #E53935;
    --custom-fail-red-hover: #D32F2F;
    --custom-fail-red-bg: #FFF2F2;
    --custom-info-blue: #3B82F6;
    --custom-info-blue-hover: #2563EB;
    --custom-info-blue-bg: #EFF6FF;
    --custom-warning-yellow: #F59E0B;
    --custom-warning-yellow-hover: #D97706;
    --custom-warning-yellow-bg: #FFFBEB;
    --custom-text-dark: #111827;
    --custom-text-light: #6B7280;
}

/* Modal Overlay */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000000000; /* Extremely high z-index to stay above everything */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal {
    background: var(--custom-white);
    width: 90%;
    max-width: 400px;
    padding: 40px 32px;
    border-radius: 24px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
    text-align: center;
    transform: scale(0.9);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal-overlay.active .custom-modal {
    transform: scale(1);
}

/* Icons for Modal */
.custom-icon-wrapper {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.custom-icon-wrapper svg,
.custom-icon-wrapper i {
    width: 40px;
    height: 40px;
    font-size: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-icon-success {
    background: var(--custom-success-green-bg);
    color: var(--custom-success-green);
}

.custom-icon-fail {
    background: var(--custom-fail-red-bg);
    color: var(--custom-fail-red);
}

.custom-icon-info {
    background: var(--custom-info-blue-bg);
    color: var(--custom-info-blue);
}

.custom-icon-warning {
    background: var(--custom-warning-yellow-bg);
    color: var(--custom-warning-yellow);
}

.custom-icon-prompt {
    background: var(--custom-info-blue-bg);
    color: var(--custom-info-blue);
}

/* Typography */
.custom-modal-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--custom-text-dark);
    margin-bottom: 12px;
}

.custom-modal-desc {
    font-size: 15px;
    color: var(--custom-text-light);
    line-height: 1.6;
    margin-bottom: 32px;
}

.custom-prompt-wrapper {
    margin-top: 20px;
    width: 100%;
}

.custom-prompt-input {
    width: 100%;
    height: 52px;
    padding: 0 20px;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
    font-size: 15px;
    color: var(--custom-text-dark);
    transition: all 0.2s;
    outline: none;
}

.custom-prompt-input:focus {
    border-color: var(--custom-info-blue);
    box-shadow: 0 0 0 4px var(--custom-info-blue-bg);
}

.custom-modal-actions {
    display: flex;
    gap: 12px;
    width: 100%;
}

.custom-modal-actions .custom-modal-btn {
    flex: 1;
}

/* Modal Buttons */
.custom-modal-btn {
    width: 100%;
    height: 52px;
    color: var(--custom-white);
    border-radius: 12px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-success-btn {
    background: var(--custom-success-green);
}

.custom-success-btn:hover {
    background: var(--custom-success-green-hover);
}

.custom-fail-btn {
    background: var(--custom-fail-red);
}

.custom-fail-btn:hover {
    background: var(--custom-fail-red-hover);
}

.custom-info-btn {
    background: var(--custom-info-blue);
}

.custom-info-btn:hover {
    background: var(--custom-info-blue-hover);
}

.custom-warning-btn {
    background: var(--custom-warning-yellow);
    color: white;
}

.custom-warning-btn:hover {
    background: var(--custom-warning-yellow-hover);
}

.custom-cancel-btn {
    background: #F3F4F6;
    color: var(--custom-text-dark);
}

.custom-cancel-btn:hover {
    background: #E5E7EB;
}

/* --- TOAST STYLES --- */

/* 1. Large Toast (Original Layout) - Right Side */
.custom-qty-toast.type-large {
    position: fixed;
    top: 30px;
    right: 20px;
    background: #FFFFFF;
    border: 1px solid #D6F0DD;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border-radius: 16px;
    width: 340px;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    z-index: 1000000001; /* Must be higher than nav and modal */
    transform-origin: top right;
    transform: translateX(120%) scale(0.9);
    opacity: 0;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.4s ease,
                filter 0.4s ease;
    will-change: transform, opacity;
}

.custom-qty-toast.custom-toast-error.type-large {
    border-color: var(--custom-fail-red);
    background: var(--custom-fail-red-bg);
}

.custom-qty-toast.custom-toast-success.type-large {
    background: var(--custom-success-green-bg);
}

/* 2. Small Pill Toast - Top Center */
.custom-qty-toast.type-small {
    position: fixed;
    top: 130px; 
    pointer-events: none;
    left: 50%;
    transform: translateX(-50%) translateY(-20px) scale(0.95);
    opacity: 0;
    background: #FFFFFF;
    color: var(--custom-text-dark);
    padding: 10px 24px;
    border-radius: 99px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(229, 231, 235, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 1000000001;
    white-space: normal;
    word-break: break-word;
    width: fit-content;
    max-width: 350px;
    min-width: 240px;
    text-align: center;
    pointer-events: none;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.5s ease;
    will-change: transform, opacity;
}

.custom-qty-toast.type-small.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
    pointer-events: auto;
}

.custom-qty-toast.custom-toast-error.type-small {
    border-color: var(--custom-fail-red);
    background: var(--custom-fail-red-bg);
}

.custom-qty-toast.custom-toast-success.type-small {
    background: var(--custom-success-green-bg);
}

/* Info and Warning Toast Variants */
.custom-qty-toast.custom-toast-info.type-large,
.custom-qty-toast.custom-toast-info.type-small {
    border-color: var(--custom-info-blue);
    background: var(--custom-info-blue-bg);
}

.custom-qty-toast.custom-toast-warning.type-large,
.custom-qty-toast.custom-toast-warning.type-small {
    border-color: var(--custom-warning-yellow);
    background: var(--custom-warning-yellow-bg);
}

.custom-toast-info .custom-qty-icon-container,
.custom-toast-info .custom-qty-text,
.custom-toast-info .custom-qty-close-btn {
    color: var(--custom-info-blue);
}

.custom-toast-warning .custom-qty-icon-container,
.custom-toast-warning .custom-qty-text,
.custom-toast-warning .custom-qty-close-btn {
    color: var(--custom-warning-yellow);
}

.custom-toast-info .custom-qty-progress-inner {
    background: var(--custom-info-blue);
}

.custom-toast-warning .custom-qty-progress-inner {
    background: var(--custom-warning-yellow);
}

.custom-qty-toast.active {
    opacity: 1;
    pointer-events: auto;
}

/* Shared Toast Components */
.custom-qty-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(0, 0, 0, 0.05);
}

.custom-qty-progress-inner {
    height: 100%;
    background: #22A559;
    width: 100%;
    transition: none;
}

.custom-toast-error .custom-qty-progress-inner {
    background: var(--custom-fail-red);
}

.custom-qty-icon-container {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex; /* Added for alignment */
    align-items: center; /* Added for alignment */
    justify-content: center; /* Added for alignment */
    color: var(--custom-success-green);
    z-index: 1;
}

.custom-toast-error .custom-qty-icon-container {
    color: var(--custom-fail-red);
}

.custom-qty-toast.type-small .custom-qty-icon-container {
    width: 24px;
    height: 24px;
}

.custom-qty-icon-container i {
    width: 20px;
    height: 20px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.custom-qty-toast.type-small .custom-qty-icon-container i {
    font-size: 16px;
}

.custom-qty-text {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--custom-text-dark);
}

.custom-toast-success .custom-qty-text {
    color: var(--custom-success-green);
}

.custom-toast-error .custom-qty-text {
    color: var(--custom-fail-red);
}

/* Large Toast Specifics */
.type-large .custom-qty-text {
    white-space: normal;
    word-break: break-word;
}

.custom-qty-close-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--custom-success-green);
    background: transparent;
    border: 1px solid #E5E7EB;
    cursor: pointer;
    transition: all 0.2s;
}

.custom-qty-close-btn i { font-size: 12px; }
.custom-qty-close-btn:hover { background: rgba(0, 0, 0, 0.05); border-color: var(--custom-success-green) !important; }

.custom-toast-error .custom-qty-close-btn {
    color: var(--custom-fail-red);
}

.custom-toast-error .custom-qty-close-btn:hover {
    border-color: var(--custom-fail-red) !important;
}

/* Large Toast Sparkles */
.type-large .sparkle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--custom-success-green);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.type-large.active .sparkle {
    animation: custom-sparkle-pop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.sparkle-1 { top: -4px; right: -2px; width: 5px; height: 5px; animation-delay: 0.2s; }
.sparkle-2 { top: 4px; right: -10px; width: 7px; height: 7px; animation-delay: 0.35s; }
.sparkle-3 { bottom: 2px; right: -6px; width: 4px; height: 4px; animation-delay: 0.5s; }

@keyframes custom-sparkle-pop {
    0% { transform: scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: scale(1); opacity: 0; }
}

/* Mobile Forcing (always small pill under 768px) */
@media screen and (max-width: 768px) {
    /* Hide some elements on mobile to keep it ultra-clean */
    .custom-qty-toast.type-large {
        /* Force large toasts to behave like small pill on mobile */
        top: 140px;
        pointer-events: none;
        left: 50%;
        right: auto;
        width: auto;
        min-width: 200px;
        max-width: 90vw;
        border-radius: 99px;
        padding: 10px 24px;
        transform: translateX(-50%) translateY(-150%) scale(0.9);
        transform-origin: center top;
        background: #FFFFFF;
        border: 1px solid #E5E7EB;
    }

    .custom-qty-toast.type-large .custom-qty-close-btn,
    .custom-qty-toast.type-large .custom-qty-progress-bar,
    .custom-qty-toast.type-large .sparkle {
        display: none !important;
    }

    .custom-qty-toast.active.type-large {
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

