
@media only screen and (max-width: 768px) {
    /* Card container adjustments */
    .card.w-500px,
    .w-500px {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px auto !important;
        padding: 20px 15px !important;
    }

    /* Padding adjustments for mobile */
    .px-50 {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .py-30 {
        padding-top: 15px !important;
        padding-bottom: 15px !important;
    }

    /* Logo adjustments */
    .cmplogo {
        max-width: 120px !important;
        width: 120px !important;
        height: auto !important;
    }

    /* Login card adjustments */
    .loginCard {
        margin: 10px !important;
        bottom: 0 !important;
    }

    /* Form elements responsive sizing */
    .form-control {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }

    /* Button adjustments */
    .btn {
        font-size: 14px !important;
        padding: 10px 15px !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        line-height: 1.4 !important;
        height: auto !important;
        min-height: 40px !important;
    }
    
    /* Specific fix for long button text */
    button[type="button"],
    button[type="submit"] {
        text-transform: none !important;
        white-space: normal !important;
    }

    /* Text adjustments */
    .fs-16 {
        font-size: 14px !important;
    }

    .fs-17 {
        font-size: 15px !important;
    }

    h4 {
        font-size: 18px !important;
    }

    h6 {
        font-size: 14px !important;
    }

    /* Center viewport adjustments */
    .center-vh {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    /* Body overflow for mobile */
    body.loginbg {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 100vh !important;
        padding: 10px !important;
    }

    .min-h-fullscreen {
        min-height: 100vh !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        padding: 20px 10px !important;
    }

    /* Footer hide on mobile */
    #footer {
        display: none !important;
    }
}

/* Google reCAPTCHA responsive styles */
@media only screen and (max-width: 768px) {
    /* reCAPTCHA container */
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: 0 0;
        -webkit-transform: scale(0.85);
        -webkit-transform-origin: 0 0;
        margin: 0 auto !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }
    
    /* Center the actual reCAPTCHA widget */
    .g-recaptcha > div {
        margin: 0 auto !important;
    }
    
    .form-group.text-center.mt-2,
    .form-group.text-center {
        overflow: visible !important;
        display: flex !important;
        justify-content: center !important;
    }
}

/* Extra small devices (phones, less than 576px) */
@media only screen and (max-width: 575px) {
    /* reCAPTCHA even smaller on very small screens */
    .g-recaptcha {
        transform: scale(0.77);
        transform-origin: 0 0;
        -webkit-transform: scale(0.77);
        -webkit-transform-origin: 0 0;
    }

    /* Card further adjustments */
    .card {
        padding: 15px 10px !important;
    }

    /* Logo smaller */
    .cmplogo {
        max-width: 100px !important;
        width: 100px !important;
    }

    /* Form group spacing */
    .form-group {
        margin-bottom: 15px !important;
    }

    /* Button text */
    .btn {
        font-size: 13px !important;
        padding: 8px 12px !important;
    }
}

/* iPhone SE and similar small devices */
@media only screen and (max-width: 375px) {
    /* reCAPTCHA smallest */
    .g-recaptcha {
        transform: scale(0.70);
        transform-origin: 0 0;
        -webkit-transform: scale(0.70);
        -webkit-transform-origin: 0 0;
    }

    .card {
        padding: 10px 8px !important;
        margin: 5px !important;
    }

    .min-h-fullscreen {
        padding: 15px 5px !important;
    }
}

/* Landscape mode adjustments for mobile */
@media only screen and (max-height: 500px) and (orientation: landscape) {
    .min-h-fullscreen {
        min-height: auto !important;
        padding: 10px !important;
    }

    .card {
        margin: 5px auto !important;
    }

    body.loginbg {
        padding: 5px !important;
    }
}

/* Tablet portrait mode */
@media only screen and (min-width: 576px) and (max-width: 768px) {
    .card.w-500px,
    .w-500px {
        width: 90% !important;
        max-width: 500px !important;
    }

    .g-recaptcha {
        transform: scale(0.95);
        transform-origin: 0 0;
        -webkit-transform: scale(0.95);
        -webkit-transform-origin: 0 0;
    }
}

/* Prevent horizontal scroll */
html, body {
    overflow-x: hidden !important;
    max-width: 100% !important;
}

/* Form validation messages responsive */
@media only screen and (max-width: 768px) {
    .text-danger {
        font-size: 12px !important;
    }

    .validation-summary-errors {
        font-size: 13px !important;
    }
}
