/* OTP Login Popup Styles - Converted from SCSS to standard CSS for Odoo 18 compliance */

/* Overlay background */
.otp-login-popup-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.5) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important; /* Higher z-index to ensure visibility */
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px); /* For Safari */
    opacity: 1 !important; /* Force opacity */
    visibility: visible !important; /* Force visibility */
}

/* Popup container - desktop version */
.otp-login-popup {
    background-color: white !important;
    border-radius: 8px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
    width: 100% !important;
    max-width: 400px !important;
    overflow: hidden !important;
    opacity: 1 !important; /* Force visibility */
    transform: scale(1) !important; /* Force normal scale */
    transition: opacity 0.3s ease, transform 0.3s ease !important;
    z-index: 10000 !important; /* Ensure it's above everything */
    display: block !important; /* Force display */
    visibility: visible !important; /* Force visibility */
}

.otp-login-popup.fade-in {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.otp-login-popup.fade-out {
    opacity: 0 !important;
    transform: scale(0.95) !important;
}

/* Non-closable popup styles */
.otp-login-popup.non-closable {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3) !important;
    border: 2px solid #7C7BAD !important;
}

/* Mobile bottom sheet version */
.otp-login-popup.mobile-sheet {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    max-width: 100% !important;
    width: 100% !important; /* Ensure full width */
    border-radius: 16px 16px 0 0 !important;
    transform: translateY(0) !important; /* Force visible */
    transition: transform 0.3s ease !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important; /* For smooth scrolling on iOS */
    z-index: 10000 !important; /* Much higher to ensure visibility */
    background-color: white !important; /* Ensure background is visible */
    box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.3) !important; /* Stronger shadow for visibility */
    display: block !important; /* Force display */
    opacity: 1 !important; /* Force opacity */
    visibility: visible !important; /* Force visibility */
}

.otp-login-popup.mobile-sheet.slide-up {
    transform: translateY(0) !important;
}

.otp-login-popup.mobile-sheet.slide-down {
    transform: translateY(100%) !important;
}

/* Header with title and close button */
.otp-login-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.otp-login-popup-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.otp-login-popup-header .btn-close {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    color: #666;
}

.otp-login-popup-header .btn-close:hover {
    color: #333;
}

.otp-login-popup-header .non-closable-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
}

.otp-login-popup-header .non-closable-indicator i {
    color: #7C7BAD;
    font-size: 16px;
}

/* Content area with forms */
.otp-login-popup-content {
    padding: 20px;
}

.otp-login-popup-content .form-group {
    margin-bottom: 20px;
}

.otp-login-popup-content .form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.otp-login-popup-content .form-group .form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.otp-login-popup-content .form-group .form-control:focus {
    border-color: #7C7BAD;
    box-shadow: 0 0 0 0.2rem rgba(124, 123, 173, 0.25);
}

.otp-login-popup-content .form-group .form-text {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.otp-login-popup-content .btn-primary {
    background-color: #7C7BAD;
    border-color: #7C7BAD;
    width: 100%;
    padding: 10px;
    font-size: 16px;
    font-weight: 500;
}

.otp-login-popup-content .btn-primary:hover, 
.otp-login-popup-content .btn-primary:focus {
    background-color: #6c6b9d;
    border-color: #6c6b9d;
}

.otp-login-popup-content .btn-primary:disabled {
    background-color: #a5a4c9;
    border-color: #a5a4c9;
}

.otp-login-popup-content .alert {
    margin-bottom: 20px;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 14px;
}

.otp-login-popup-content .form-check {
    display: flex;
    align-items: center;
}

.otp-login-popup-content .form-check .form-check-input {
    margin-right: 8px;
}

/* Action buttons at the bottom */
.otp-login-popup-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 16px;
}

.otp-login-popup-actions .btn-link {
    color: #7C7BAD;
    text-decoration: none;
    padding: 0;
    font-size: 14px;
}

.otp-login-popup-actions .btn-link:hover {
    text-decoration: underline;
}

.otp-login-popup-actions .btn-link:disabled {
    color: #a5a4c9;
    opacity: 0.7;
}

/* International telephone input integration */
.iti {
    width: 100%;
    display: block !important;
    position: relative !important;
}

.iti__flag-container {
    z-index: 10 !important;
    position: absolute !important;
    top: 0 !important;
    bottom: 0 !important;
    left: 0 !important;
    padding: 1px !important;
}

.iti__selected-flag {
    padding: 0 6px 0 8px !important;
    display: flex !important;
    align-items: center !important;
    height: 100% !important;
    position: relative !important;
}

.iti__country-list {
    z-index: 999 !important;
    max-height: 200px;
    overflow-y: auto;
    position: absolute !important;
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Adjust input padding to accommodate the country code dropdown */
#phone {
    padding-left: 90px !important;
}

/* Mobile-specific adjustments */
@media (max-width: 767.98px) {
    .otp-login-popup-overlay {
        align-items: flex-end !important; /* Align to bottom for mobile */
        justify-content: center !important;
    }

    .otp-login-popup-content {
        padding: 20px 16px;
    }

    .iti__country-list {
        width: 260px;
    }

    /* Add a handle for the bottom sheet */
    .otp-login-popup.mobile-sheet .otp-login-popup-header::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background-color: #ddd;
        border-radius: 2px;
        margin: 0 auto 10px;
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
    }

    .otp-login-popup.mobile-sheet .otp-login-popup-header {
        padding-top: 24px;
        position: sticky;
        top: 0;
        background-color: white;
        z-index: 1;
        border-bottom: 1px solid #eee;
    }

    /* Improve form controls for touch */
    .form-control {
        font-size: 16px !important; /* Prevent zoom on iOS */
        height: 44px;
    }

    /* Improve buttons for touch */
    .btn {
        padding: 12px !important;
        font-size: 16px !important;
        height: auto !important;
        min-height: 44px;
    }

    /* Fix for iOS Safari viewport height issues */
    .otp-login-popup.mobile-sheet {
        height: auto !important;
        max-height: 85vh !important; /* Slightly smaller to ensure it fits */
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        position: fixed !important;
        transform: translateY(0) !important; /* Force visible */
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 10000 !important;
    }

    /* Force visibility for mobile */
    .otp-login-popup.mobile-sheet.slide-up {
        transform: translateY(0) !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        z-index: 10000 !important;
    }

    /* Ensure the overlay is visible on mobile */
    .otp-login-popup-overlay {
        z-index: 9999 !important;
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Ensure the popup is visible on all mobile browsers */
    body.mobile-otp-popup-open {
        overflow: hidden; /* Prevent scrolling behind the popup */
        position: fixed;
        width: 100%;
        height: 100%;
    }
}
