/* Profily Custom Login Styles */
body.login {
    background: var(--background-gradient, linear-gradient(135deg, var(--primary), var(--secondary)));
    font-family: var(--font-family, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
}

body.login::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    z-index: -1;
}

#login {
    width: 100%;
    max-width: 400px;
    padding: 0;
}

/* Responsive form width control */
@media (max-width: 480px) {
    #login {
        max-width: 95vw;
        min-width: 300px;
    }
}

@media (min-width: 481px) and (max-width: 768px) {
    #login {
        max-width: 85vw;
        min-width: 350px;
    }
}

@media (min-width: 769px) {
    #login {
        max-width: 400px;
        min-width: 380px;
    }
}

.login h1 {
    text-align: center;
    margin-bottom: 30px;
}

.login h1 a {
    background-image: none;
    width: auto;
    height: auto;
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.login h1 a:before {
    content: '';
    display: inline-block;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 8px;
    position: relative;
}

.login h1 a:after {
    content: 'Profily.org';
    display: inline-block;
}

#loginform {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin: 0;
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

.login form .input, 
.login input[type="text"], 
.login input[type="password"] {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius, 5px);
    padding: 15px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 20px;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.login form .input:focus, 
.login input[type="text"]:focus, 
.login input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
    outline: none;
}

/* Fix for Remember Me checkbox alignment */
.login .forgetmenot {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    white-space: nowrap;
}

.login .forgetmenot label {
    display: inline;
    margin: 0;
    font-size: 14px;
    white-space: nowrap;
}

.login .forgetmenot input[type="checkbox"] {
    margin: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Ensure proper alignment on very small screens */
@media (max-width: 360px) {
    .login .forgetmenot {
        flex-wrap: wrap;
    }
    
    .login .forgetmenot label {
        white-space: normal;
    }
}

.login .button-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--border-radius, 5px);
    color: white;
    font-size: 16px;
    font-weight: 600;
    padding: 15px 30px;
    width: 100%;
    height: auto;
    text-shadow: none;
    box-shadow: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-sizing: border-box;
}

.login .button-primary:hover,
.login .button-primary:focus {
    background: linear-gradient(135deg, var(--secondary), var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.login .button-primary:active {
    transform: translateY(0);
}

/* Labels and text */
.login label {
    color: var(--dark);
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
}

#backtoblog, 
#nav {
    text-align: center;
    margin: 20px 0 0;
    padding: 0;
}

#backtoblog a, 
#nav a {
    color: white !important;
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.3s;
}

#backtoblog a:hover, 
#nav a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Error messages */
.login .message,
.login #login_error {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    padding: 15px;
    backdrop-filter: blur(10px);
    width: 100%;
    box-sizing: border-box;
}

.login #login_error {
    border-left: 4px solid #dc3545;
}

.login .message {
    border-left: 4px solid var(--success);
}

/* Enhanced responsive design */
@media (max-width: 768px) {
    body.login {
        padding: 15px;
    }
    
    #loginform {
        padding: 30px 25px;
    }
    
    .login h1 a {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    body.login {
        padding: 10px;
    }
    
    #loginform {
        padding: 25px 20px;
    }
    
    .login h1 a {
        font-size: 1.8rem;
    }
    
    .login h1 a:before {
        width: 30px;
        height: 30px;
    }
}

/* Custom welcome message */
.profily-welcome-message {
    text-align: center;
    margin-bottom: 30px;
}

.profily-welcome-message p {
    color: white;
    margin: 5px 0;
    font-size: 16px;
}

.profily-welcome-message p:first-child {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 10px;
}

/* Registration page specific styles */
.login-action-register #loginform {
    max-width: 500px;
}

@media (max-width: 768px) {
    .login-action-register #loginform {
        max-width: 90vw;
    }
}

/* Password strength meter */
.login .pw-weak {
    color: #dc3545;
}

.login .pw-strong {
    color: var(--success);
}

/* Lost password page adjustments */
.login-action-lostpassword #loginform,
.login-action-rp #loginform {
    max-width: 500px;
}

@media (max-width: 768px) {
    .login-action-lostpassword #loginform,
    .login-action-rp #loginform {
        max-width: 90vw;
    }
}