/* Auth Pages Styles - Working Responsive Version */

/* FORCE RESPONSIVE - VERY HIGH SPECIFICITY */
body .u-flex.u-w-full,
body .u-flex.u-w-full > div,
body .u-flex.u-w-full div[class*="u-flex-1"] {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
}

/* FORCE CONTAINER RESPONSIVE */
body div[class*="u-px-"] {
    box-sizing: border-box !important;
}

/* FORCE INPUT RESPONSIVE */
body .login-form input[type="email"],
body .login-form input[type="password"],
body input.form-input,
body .form-input {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    min-height: 56px !important;
    padding: 16px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background-color: white !important;
    margin: 0 !important;
    transition: all 0.2s ease !important;
}

/* FORCE INPUT WITH ICONS */
body .login-form input.u-pl-12 {
    padding-left: 48px !important;
    padding-right: 12px !important;
}

body .login-form input.u-pr-12 {
    padding-right: 48px !important;
}

/* FORCE INPUT FOCUS STATES */
body .login-form input:focus,
body .form-input:focus {
    outline: none !important;
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2) !important;
}

/* FORCE ICON CONTAINERS */
body .login-form .u-absolute.u-w-12 {
    width: 48px !important;
    height: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    z-index: 10 !important;
    top: 0 !important;
}

body .login-form .u-absolute.u-left-0 {
    left: 0 !important;
}

body .login-form .u-absolute.u-right-0 {
    right: 0 !important;
}

/* FORCE BUTTON STYLES */
body .login-form .password-toggle {
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    width: 48px !important;
    height: 100% !important;
    position: absolute !important;
    top: 0 !important;
    right: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: color 0.2s ease !important;
}

body .login-form .password-toggle:hover {
    color: #6b7280 !important;
}

/* FORCE SVG ICONS */
body .login-form svg {
    width: 20px !important;
    height: 20px !important;
    color: #9ca3af !important;
    transition: color 0.2s ease !important;
}

body .login-form svg:hover {
    color: #6b7280 !important;
}

/* FLOATING LABELS */
body .login-form .floating-label {
    position: absolute !important;
    top: 16px !important;
    left: 48px !important;
    color: #6b7280 !important;
    font-size: 16px !important;
    pointer-events: none !important;
    transition: all 0.2s ease !important;
    transform-origin: left !important;
}

body .login-form .form-input:focus + .floating-label,
body .login-form .form-input:not(:placeholder-shown) + .floating-label {
    transform: scale(0.75) translateY(-24px) translateX(4px) !important;
    color: #3b82f6 !important;
}

/* SUBMIT BUTTON STYLES */
body .submit-btn {
    background: linear-gradient(to right, #3b82f6, #2563eb) !important;
    color: white !important;
    font-weight: bold !important;
    padding: 20px 32px !important;
    border-radius: 12px !important;
    border: none !important;
    font-size: 20px !important;
    min-height: 64px !important;
    width: 100% !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1) !important;
}

body .submit-btn:hover {
    background: linear-gradient(to right, #2563eb, #1d4ed8) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15) !important;
}

body .submit-btn:active {
    transform: translateY(0) !important;
}

/* REMOVE ALL FIXED WIDTHS */
body * {
    max-width: initial !important;
}

body *[style*="width"] {
    width: auto !important;
}

/* LOGIN FORM CONTAINER */
.login-form {
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* CHECKBOX STYLES */
.form-checkbox {
    width: 16px !important;
    height: 16px !important;
    color: #3b82f6 !important;
    border-color: #d1d5db !important;
    border-radius: 4px !important;
}

.form-checkbox:focus {
    ring: 2px solid #3b82f6 !important;
}

/* Fix for Html.CheckBoxFor generating hidden input */
input[type="checkbox"] + input[type="hidden"] {
    display: none;
}

/* LOGO ICON SIZING */
.logo-icon .u-icon {
    width: 1.5rem !important;
    height: 1.5rem !important;
    max-width: 1.5rem !important;
    max-height: 1.5rem !important;
}

/* RESPONSIVE DESIGN */

/* FORCE MOBILE RESPONSIVE */
@media (max-width: 768px) {
    body .u-flex.u-w-full > div {
        padding-left: 8px !important;
        padding-right: 8px !important;
        max-width: calc(100vw - 16px) !important;
    }
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
    body .login-form .form-input {
        font-size: 16px !important;
        min-height: 52px !important;
        padding: 14px 12px !important;
    }

    body .login-form .form-input.u-pl-12 {
        padding-left: 44px !important;
    }

    body .login-form .form-input.u-pr-12 {
        padding-right: 44px !important;
    }

    body .login-form .u-absolute.u-w-12 {
        width: 44px !important;
    }

    body .login-form .password-toggle {
        width: 44px !important;
    }

    /* Ensure no horizontal scroll */
    .u-space-y-8, .u-px-2, .u-px-4 {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .login-form .u-space-y-8.u-px-2 {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* PREVENT HORIZONTAL SCROLL - AGGRESSIVE FIX */
html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
}

/* Force all containers to respect viewport */
* {
    box-sizing: border-box !important;
}

/* Prevent any element from exceeding viewport */
body * {
    max-width: 100% !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
}

/* Special fixes for common overflow culprits */
div, span, p, h1, h2, h3, h4, h5, h6 {
    max-width: 100% !important;
}

/* Fix specific potential overflow elements */
.u-text-3xl, .u-text-4xl, .u-text-xl {
    word-break: break-word !important;
}

/* Mobile specific fixes */
@media (max-width: 640px) {
    /* Force all containers to fit in mobile viewport */
    body, html {
        overflow-x: hidden !important;
        width: 100vw !important;
        max-width: 100vw !important;
    }

    /* Ensure no padding pushes content out */
    body > *,
    div[class*="u-px-"],
    div[class*="u-mx-"],
    div[class*="u-gap-"] {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Fix any flex containers that might overflow */
    .u-flex {
        flex-wrap: wrap !important;
        overflow-x: hidden !important;
        max-width: 100% !important;
    }

    /* Prevent text from overflowing */
    h1, h2, h3, p, span, div {
        word-break: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
    }

    /* Fix logo and brand area */
    .logo-icon, .u-text-3xl {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Ensure buttons don't overflow */
    button, .submit-btn, a {
        max-width: 100% !important;
        word-break: break-word !important;
    }
}

/* Ultra small screens - emergency measures */
@media (max-width: 320px) {
    body * {
        max-width: calc(100vw - 8px) !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Minimal padding on tiny screens */
    div[class*="u-px-"] {
        padding-left: 4px !important;
        padding-right: 4px !important;
    }
}

/* UTILITY CLASSES */
.u-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.u-icon.u-icon-sm {
    width: 1rem;
    height: 1rem;
}

.u-icon.u-icon-lg {
    width: 1.5rem;
    height: 1.5rem;
}

.u-icon.u-icon-xl {
    width: 2rem;
    height: 2rem;
}