/* Modern Login Styles */
.modern-login-body {
    background: linear-gradient(135deg, #0e0141 0%, #050505 100%);
    min-height: 100vh;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

.modern-login-container {
    min-height: 100vh;
    /* Use modern viewport units for better mobile behavior */
    min-height: 100svh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

/* Animated Background Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 100px;
    height: 100px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 80px;
    height: 80px;
    bottom: 20%;
    left: 20%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* Modern Card */
.modern-login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 100%;
    padding: 0;
    overflow: hidden;
}

/* Mobile tweak: on initial load position card slightly above center */
@media (max-width: 575.98px) {
    .modern-login-container {
        /* Respect safe areas on devices with notches */
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
    .modern-login-card {
        /* Lift the card a bit to avoid appearing too close to the bottom */
        transform: translateY(calc(-1 * min(48px, 6vh)));
    }
}

/* Header */
.modern-login-header {
    background: linear-gradient(135deg, #100b5a 0%, #013c8a 100%);
    padding: 40px 30px;
    text-align: center;
    position: relative;
}

.modern-login-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.1"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.login-logo {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
}

.login-logo i {
    font-size: 24px;
    color: white;
}

.login-title {
    color: white;
    font-size: 24px;
    font-weight: 600;
    margin: 0;
    position: relative;
    z-index: 1;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    margin: 8px 0 0;
    position: relative;
    z-index: 1;
}

/* Form */
.modern-login-form {
    padding: 40px 30px;
}

.form-group-modern {
    margin-bottom: 25px;
    position: relative;
}

.form-control-modern {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid #e8ecf4;
    border-radius: 12px;
    font-size: 16px;
    background: #f8f9fe;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-control-modern:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-label-modern {
    position: absolute;
    left: 20px;
    top: 15px;
    color: #8b9dc3;
    font-size: 16px;
    pointer-events: none;
    transition: all 0.3s ease;
    background: white;
    z-index: 1;
    padding: 0 4px;
}

/* Always move label up when input has focus, value, or is autofilled */
.form-control-modern:focus + .form-label-modern,
.form-control-modern:not(:placeholder-shown) + .form-label-modern,
.form-control-modern.has-value + .form-label-modern {
    top: -8px;
    left: 16px;
    font-size: 12px;
    color: #667eea;
    background: white;
    padding: 0 8px;
}

/* Force label positioning for autofilled inputs */
.form-control-modern:-webkit-autofill + .form-label-modern,
.form-control-modern:-webkit-autofill:hover + .form-label-modern,
.form-control-modern:-webkit-autofill:focus + .form-label-modern,
.form-control-modern:-webkit-autofill:active + .form-label-modern {
    top: -8px !important;
    left: 16px !important;
    font-size: 12px !important;
    color: #667eea !important;
    background: white !important;
    padding: 0 8px !important;
    z-index: 10 !important;
}

/* Firefox autofill support */
.form-control-modern:-moz-autofill + .form-label-modern {
    top: -8px !important;
    left: 16px !important;
    font-size: 12px !important;
    color: #667eea !important;
    background: white !important;
    padding: 0 8px !important;
}

.form-group-modern.focused .form-label-modern {
    color: #667eea;
}

/* Fix autofill background and styling */
.form-control-modern:-webkit-autofill,
.form-control-modern:-webkit-autofill:hover,
.form-control-modern:-webkit-autofill:focus,
.form-control-modern:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px white inset !important;
    -webkit-text-fill-color: #333 !important;
    background-color: white !important;
    border-color: #667eea !important;
    color: #333 !important;
}

/* Ensure autofilled inputs are treated as having value */
.form-control-modern:-webkit-autofill {
    background-clip: text !important;
}

/* Remove password toggle styles - commented out */
/*
.password-toggle {
    position: absolute;
    right: 15px;
    top: 15px;
    color: #8b9dc3;
    cursor: pointer;
    font-size: 18px;
    z-index: 2;
    transition: color 0.3s ease;
}

.password-toggle:hover {
    color: #667eea;
}
*/

/* Remember Me */
.remember-me-modern {
    margin-bottom: 30px;
}

.checkbox-modern {
    position: relative;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-modern input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 20px;
    width: 20px;
    margin: 0;
    z-index: 2;
}

.checkbox-modern .checkmark {
    position: relative;
    display: block;
    width: 20px;
    height: 20px;
    margin-right: 12px;
    background: #e8ecf4;
    border-radius: 6px;
    transition: all 0.3s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-modern:hover .checkmark {
    background: #dde4f3;
    transform: scale(1.05);
}

.checkbox-modern input:checked ~ .checkmark {
    background: #000d47;
}

.checkbox-modern input:checked ~ .checkmark:hover {
    background: #010847;
}

.checkbox-modern .checkmark::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 12px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: none;
}

.checkbox-modern input:checked ~ .checkmark::after {
    opacity: 1;
    display: block;
}

.remember-text {
    color: #64748b;
    font-size: 14px;
    cursor: pointer;
}

/* Login Button */
.btn-login-modern {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #100b5a 0%, #013c8a 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-login-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.6s;
}

.btn-login-modern:hover::before {
    left: 100%;
}

.btn-login-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.3);
}

.btn-login-modern:active {
    transform: translateY(0);
}

/* Loading State */
.btn-login-modern.loading {
    pointer-events: none;
}

.btn-login-modern .loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.btn-login-modern.loading .loading-spinner {
    display: inline-block;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .modern-login-container {
        padding: 15px;
    }
    
    .modern-login-card {
        max-width: 100%;
        margin: 0 10px;
    }
    
    .modern-login-header {
        padding: 30px 20px;
    }
    
    .modern-login-form {
        padding: 30px 20px;
    }
    
    .login-title {
        font-size: 22px;
    }
    
    .shape {
        display: none; /* Hide floating shapes on mobile for better performance */
    }
}

@media (max-width: 480px) {
    .modern-login-card {
        margin: 0 5px;
        border-radius: 16px;
    }
    
    .modern-login-header {
        padding: 25px 15px;
        border-radius: 16px 16px 0 0;
    }
    
    .modern-login-form {
        padding: 25px 15px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .login-subtitle {
        font-size: 13px;
    }
    
    .form-control-modern {
        padding: 12px 15px;
        font-size: 14px;
    }
    
    .form-label-modern {
        left: 15px;
        top: 12px;
        font-size: 14px;
    }
    
    .form-control-modern:focus + .form-label-modern,
    .form-control-modern:not(:placeholder-shown) + .form-label-modern {
        left: 12px;
        font-size: 11px;
    }
}

/* Animation for form elements */
.form-group-modern {
    animation: slideUp 0.6s ease-out;
    animation-fill-mode: both;
}

.form-group-modern:nth-child(1) { animation-delay: 0.1s; }
.form-group-modern:nth-child(2) { animation-delay: 0.2s; }
.form-group-modern:nth-child(3) { animation-delay: 0.3s; }
.btn-login-modern { 
    animation: slideUp 0.6s ease-out;
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card animation */
.modern-login-card {
    animation: cardSlideIn 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}