/* =========================================================================
   UTCS.PK Custom Popup System
   Replaces native browser alert()/confirm() dialogs with an in-page popup
   (emoji + Yes/No buttons for confirms, auto-hiding toast for alerts).
   Injected once via assets/js/custom-popup.js - see that file for the JS API.
   ========================================================================= */

.custom-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 10, 30, 0.65);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.custom-modal-backdrop.show-popup {
    display: flex !important;
}
.custom-popup-card {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 24px;
    padding: 34px 24px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(15, 10, 30, 0.3);
    animation: popupScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes popupScaleIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
.popup-emoji {
    font-size: 3.5rem;
    margin-bottom: 12px;
    animation: emojiBounce 1.2s infinite alternate;
}
@keyframes emojiBounce {
    0% { transform: translateY(0); }
    100% { transform: translateY(-8px); }
}
.popup-title {
    font-weight: 800;
    color: #1f1147;
    margin-bottom: 8px;
}
.popup-text {
    font-size: 0.9rem;
    color: #6b5b95;
    margin-bottom: 24px;
}
.popup-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.btn-popup {
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}
.btn-popup-danger {
    background: linear-gradient(135deg, #ef4444, #f43f5e);
    color: white !important;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}
.btn-popup-danger:hover { transform: translateY(-2px); }
.btn-popup-cancel {
    background: #f1f5f9;
    color: #475569 !important;
}
.btn-popup-cancel:hover { background: #e2e8f0; }
.btn-popup-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white !important;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}
.btn-popup-success:hover { transform: translateY(-2px); }

@media (max-width: 767px) {
    .custom-popup-card {
        padding: 26px 18px;
        border-radius: 20px;
        max-width: 100%;
    }
    .popup-emoji {
        font-size: 2.8rem;
    }
    .popup-title {
        font-size: 1.2rem;
    }
    .btn-popup {
        padding: 10px 16px;
        font-size: 0.82rem;
        flex: 1;
    }
}

/* Toast (replaces alert()) */
#cpToastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 340px;
    width: calc(100% - 32px);
}
.cp-toast {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.97);
    border-left: 5px solid #6366f1;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 10px 30px rgba(15, 10, 30, 0.18);
    font-size: 0.9rem;
    color: #1f1147;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.cp-toast.cp-toast-show {
    opacity: 1;
    transform: translateX(0);
}
.cp-toast-emoji {
    font-size: 1.4rem;
    flex-shrink: 0;
}
.cp-toast-success { border-left-color: #10b981; }
.cp-toast-error, .cp-toast-danger { border-left-color: #ef4444; }
.cp-toast-warning { border-left-color: #f59e0b; }
.cp-toast-info { border-left-color: #6366f1; }

@media (max-width: 480px) {
    #cpToastContainer {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}
