/* =========================================
   1. LAYOUT STRUCTURE (Mobile App Style)
   ========================================= */

/* Ensure the background covers everything */
body:has(.o_database_list),
body:has(.oe_website_login_container) {
    background: transparent !important;
}

/* Background animation */
@keyframes gradientFlow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.wave-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(135deg, #2a2764, #4a45b1, #6b64e6) !important;
    background-size: 400% 400% !important;
    animation: gradientFlow 15s ease infinite !important;
}

.wave {
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transform-origin: center;
}

.wave-1 {
    animation: waveMove 20s linear infinite;
    animation-delay: 0s;
}

.wave-2 {
    animation: waveMove 25s linear infinite reverse;
    animation-delay: -5s;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.05), transparent);
}

.wave-3 {
    animation: waveMove 30s linear infinite;
    animation-delay: -10s;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

.wave-4 {
    animation: waveMove 35s linear infinite reverse;
    animation-delay: -15s;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.03), transparent);
}

@keyframes waveMove {
    0% { transform: translateX(-50%) skewX(-5deg); }
    100% { transform: translateX(50%) skewX(-5deg); }
}

/* Gradient Particles */
.gradient-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8), 0 0 20px rgba(255, 255, 255, 0.4);
    animation: particleFloat 15s linear infinite;
}

.particle::before {
    content: '🆀';
}

.particle:nth-child(1) { top: 20%; left: 10%; font-size: 16px; animation-delay: 0s; }
.particle:nth-child(2) { top: 60%; left: 80%; font-size: 28px; animation-delay: -3s; }
.particle:nth-child(3) { top: 80%; left: 20%; font-size: 20px; animation-delay: -6s; }
.particle:nth-child(4) { top: 30%; left: 70%; font-size: 32px; animation-delay: -9s; }
.particle:nth-child(5) { top: 10%; left: 60%; font-size: 14px; animation-delay: -12s; }
.particle:nth-child(6) { top: 70%; left: 40%; font-size: 24px; animation-delay: -15s; }
.particle:nth-child(7) { top: 40%; left: 15%; font-size: 18px; animation-delay: -2s; }
.particle:nth-child(8) { top: 75%; left: 65%; font-size: 22px; animation-delay: -5s; }
.particle:nth-child(9) { top: 15%; left: 85%; font-size: 26px; animation-delay: -8s; }
.particle:nth-child(10) { top: 50%; left: 30%; font-size: 16px; animation-delay: -11s; }

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) translateX(0) rotate(0deg) scale(0.5); opacity: 0; }
    10%, 90% { opacity: 0.8; }
    30%, 70% { opacity: 0.4; }
    50% { transform: translateY(-150px) translateX(80px) rotate(180deg) scale(1.5); opacity: 1; }
}


/* MAIN LOGIN CONTAINER - MOBILE APP STYLE */

.o_database_list {
    border: none !important;
}

.o_database_list,
.oe_website_login_container {
    max-width: 750px !important; /* Match navbar width */
    width: 95% !important;
    margin: 5vh auto 5vh auto !important; /* Center horizontally, push down from top */
    position: relative !important;
    z-index: 10 !important;
    
    /* White Card Appearance */
    background-color: #ffffff !important;
    border-radius: 40px !important;
    box-shadow: 10px 20px 60px rgba(0, 0, 0, 0.1) !important;
    padding: 60px 40px !important;
    display: flex;
    flex-direction: column;
    align-items: center; /* Center children horizontally */
    box-sizing: border-box !important;
}

/* Ensure inner wrappers don't add extra padding */
.o_database_list .card-body {
    padding: 0 !important;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* The actual form should stay compact inside the wide white card */
form.oe_login_form,
.oe_website_login_container .o_user_switch,
.o_database_list .o_user_switch {
    width: 100% !important;
    max-width: 500px !important; /* Overrides Odoo's 300px limit */
    margin: 0 auto !important;
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    box-sizing: border-box !important;
}

/* =========================================
   2. MOBILE RESPONSIVENESS (BOTTOM SHEET)
   ========================================= */
@media (max-width: 576px) {
    .o_database_list,
    .oe_website_login_container {
        margin: 15vh 0 0 0 !important;
        min-height: 85vh !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 40px 40px 0 0 !important;
        padding: 50px 20px !important;
        justify-content: flex-start;
    }
}


/* =========================================
   3. HEADER TEXT
   ========================================= */
.login-header-text h2 {
    font-size: 2rem;
    color: #ffffff;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
}

.login-header-text p {
    text-align: center;
    color: #ffffff;
}

.login-header-text .text-muted {
    color: #ffffff !important;
}

/* =========================================
   4. INPUTS & BUTTONS
   ========================================= */
.oe_login_form .form-control {
    border: 1px solid #e0e0e0 !important;
    border-radius: 12px !important;
    padding: 14px 16px !important;
    background-color: #f8f9fa !important;
    transition: all 0.3s ease-in-out !important;
    font-size: 1rem !important;
    margin-bottom: 5px;
}

.oe_login_form .form-control:focus {
    border-color: #6b64e6 !important;
    background-color: #fff !important;
    box-shadow: 0 0 0 3px rgba(107, 100, 230, 0.1) !important;
}

.oe_login_form .form-label {
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.oe_login_form .btn-primary {
    background: linear-gradient(135deg, #6b64e6, #8e84f5, #b4a8ff) !important;
    border: none !important;
    color: #ffffff !important;
    border-radius: 14px !important;
    padding: 14px !important;
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    margin-top: 20px;
    transition: all 0.3s ease !important;
    box-shadow: 0 10px 20px rgba(107, 100, 230, 0.3) !important;
    width: 100%;
}

.field-login .o_user_switch_btn .btn-link,
.field-login .o_user_switch_btn p {
    color: #ffffff !important;
}



.oe_login_form .btn-primary:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 12px 25px rgba(107, 100, 230, 0.4) !important;
}

.o_caps_lock_warning .o_show_password {
    color: #ffffff !important;
    border-radius: 12px !important;
    border: 0 !important;
    background-color: transparent !important;
}

/* =========================================
   5. HIDE UNWANTED ELEMENTS
   ========================================= */
/* Hide Logo Container usually in standard login */
.o_database_list .card-body > div.text-center:first-child { display: none !important; }

/* Hide Passkeys / Social Login */
.o_login_auth { display: none !important; }

/* Hide various footer blocks ONLY when the login container is present */
body:has(.o_database_list) footer,
body:has(.o_database_list) .o_footer_copyright,
body:has(.oe_website_login_container) footer,
body:has(.oe_website_login_container) .o_footer_copyright,
.o_database_list .card-body > .text-center.small,
.o_database_list + .text-center { 
    display: none !important; 
}

/* Hide Odoo brand promotion globally in all environments */
.o_brand_promotion {
    display: none !important;
}

.o_caps_lock_warning .btn-link {
    display: none !important;
}


/* Specific signup/superuser links */
a[href*="signup"],
a[href*="/web/signup"],
a[href*="superuser"],
a[href*="login=super"],
button[value="/web/become"] {
    display: none !important;
}

/* =========================================
   6. CUSTOM VALIDATION ERROR TOOLTIPS
   ========================================= */
.custom-error-tooltip {
    position: absolute;
    bottom: -40px;
    left: 0;
    background: #ff4757;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.3);
    animation: slideUpFade 0.3s ease-out;
    z-index: 100;
}

.custom-error-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 15px;
    width: 10px;
    height: 10px;
    background: #ff4757;
    transform: rotate(45deg);
}

.custom-error-tooltip svg {
    width: 16px;
    height: 16px;
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes waveShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* =========================================
   7. SERVER-SIDE AUTHENTICATION ERRORS
   ========================================= */
.alert-danger {
    background: rgba(255, 71, 87, 0.1) !important;
    border: 1px solid rgba(255, 71, 87, 0.3) !important;
    color: #ff4757 !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    box-shadow: 0 4px 15px rgba(255, 71, 87, 0.05) !important;
    animation: slideUpFade 0.4s ease-out !important;
    margin-bottom: 20px !important;
}

.alert-danger::before {
    content: '⚠️';
    font-size: 16px;
}