/**
 * Uniform Professional Close Buttons
 * Consistent styling for all modal close buttons
 */

/* Remove all existing close button styles first */
.modal .btn-close,
.modal .btn-close-white,
.modal .phone-auth-close,
.modal .login-close,
.modal button[data-bs-dismiss="modal"],
.universal-close-btn,
#depositPopup .btn-close,
#withdrawModal .btn-close,
#kycModal .btn-close,
#historyModal .btn-close,
#couponsModal .btn-close,
#phoneAuthModal .btn-close,
#loginModal .btn-close,
#whatsappSupportModal .btn-close {
    /* Reset everything */
    background-image: none !important;
    opacity: 1 !important;
    filter: none !important;
}

/* Universal close button for ALL modals */
.modal .btn-close,
.modal .btn-close-white,
.modal button[data-bs-dismiss="modal"]:first-of-type,
.phone-auth-close,
.login-close,
.universal-close-btn {
    /* Positioning */
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
    z-index: 1060 !important;

    /* Size - Uniform for all */
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    min-height: 32px !important;
    max-width: 32px !important;
    max-height: 32px !important;

    /* Shape & Background */
    border-radius: 50% !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%) !important;
    backdrop-filter: blur(10px) !important;
    border: 2px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;

    /* Content */
    color: #ffffff !important;
    font-size: 20px !important;
    font-weight: 300 !important;
    line-height: 1 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;

    /* Flexbox for perfect centering */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    /* Reset padding/margin */
    padding: 0 !important;
    margin: 0 !important;

    /* Transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;

    /* Cursor */
    cursor: pointer !important;

    /* Text properties */
    text-align: center !important;
    text-decoration: none !important;
    vertical-align: middle !important;
}

/* Add the × symbol consistently */
.modal .btn-close::before,
.modal .btn-close-white::before,
.modal button[data-bs-dismiss="modal"]:first-of-type::before {
    content: "✕" !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    color: #ffffff !important;
    display: block !important;
    line-height: 1 !important;
}

/* Remove any existing content */
.modal .btn-close::after,
.modal .btn-close-white::after {
    content: none !important;
}

/* Hover state - professional red glow */
.modal .btn-close:hover,
.modal .btn-close-white:hover,
.modal button[data-bs-dismiss="modal"]:first-of-type:hover,
.phone-auth-close:hover,
.login-close:hover,
.universal-close-btn:hover {
    background: linear-gradient(135deg, rgba(255, 59, 48, 0.3) 0%, rgba(255, 69, 58, 0.2) 100%) !important;
    border-color: rgba(255, 59, 48, 0.5) !important;
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3) !important;
    transform: scale(1.05) !important;
}

/* Active/Click state */
.modal .btn-close:active,
.modal .btn-close-white:active,
.modal button[data-bs-dismiss="modal"]:first-of-type:active,
.phone-auth-close:active,
.login-close:active,
.universal-close-btn:active {
    transform: scale(0.95) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Focus state for accessibility */
.modal .btn-close:focus,
.modal .btn-close-white:focus,
.modal button[data-bs-dismiss="modal"]:first-of-type:focus {
    outline: 2px solid rgba(255, 255, 255, 0.5) !important;
    outline-offset: 2px !important;
}

/* Dark modal specific styling */
.modal-content.bg-dark .btn-close,
.modal-content.bg-dark .btn-close-white,
.modal-dark .btn-close,
.deposit-popup .btn-close,
.withdraw-modal .btn-close,
.kyc-modal .btn-close {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%) !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
}

/* Mobile responsive - slightly larger for touch */
@media (max-width: 768px) {
    .modal .btn-close,
    .modal .btn-close-white,
    .modal button[data-bs-dismiss="modal"]:first-of-type,
    .phone-auth-close,
    .login-close,
    .universal-close-btn {
        /* Slightly larger on mobile */
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        max-width: 36px !important;
        max-height: 36px !important;

        /* Adjust position for mobile */
        top: 10px !important;
        right: 10px !important;
    }

    .modal .btn-close::before,
    .modal .btn-close-white::before,
    .modal button[data-bs-dismiss="modal"]:first-of-type::before {
        font-size: 18px !important;
    }
}

/* Special cases - ensure uniformity */
#depositPopup .modal-header .btn-close,
#withdrawModal .modal-header .btn-close,
#kycModal .modal-header .btn-close,
#historyModal .modal-header .btn-close {
    /* Force same positioning even in headers */
    position: absolute !important;
    top: 12px !important;
    right: 12px !important;
}

/* Remove any text content that might appear */
.modal .btn-close {
    text-indent: -9999px !important;
    overflow: hidden !important;
}

/* Ensure the × is always visible */
.modal .btn-close::before {
    text-indent: 0 !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .modal .btn-close,
    .modal .btn-close-white {
        border-width: 2px !important;
        border-color: white !important;
    }
}