/* CSS Variables are now inherited from main.css */

/* Optimize background image loading */
body::before{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("/static/authentication/images/study_group.72c208c32fff.jpg") no-repeat center center;
    background-size: cover;
    background-attachment: fixed;
    z-index: -2;
    /* Optimize rendering */
    will-change: transform;
    transform: translateZ(0);
    /* Lazy load background on mobile */
    content-visibility: auto;
}

body::after{
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(150deg, #0a486ff7, #021521ae);
    z-index: -1;
}

/* Preload critical background image */
@media (min-width: 768px) {
    body::before {
        background-image: url("/static/authentication/images/study_group.72c208c32fff.jpg");
    }
}


/* Auth Form Styles */

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 90vh;
    width: 90vw;
}

/* Auth Form Styles */
.auth-form {
    max-width: 450px;
    width: 100%;
    padding: 2rem;
    background-color: var(--white);
    border-radius: 0 15px 0 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.auth-form h2 {
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--dark-grey);
    font-weight: 600;
    font-size: 1.75rem;
}

.auth-form .form-control {
    border: 1.5px solid #e9ecef;
    padding: 0.75rem;
    border-radius: 0 8px 0 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background-color: var(--light-grey);
}

.auth-form .form-control:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 0.2rem rgba(44, 40, 167, 0.1);
    background-color: var(--white);
}

.auth-form .form-label {
    font-weight: 500;
    color: var(--dark-grey);
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

.auth-form .btn-primary {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1.25rem;
    background-color: var(--primary-green);
    border-color: var(--primary-green);
    border-radius: 0 8px 0 8px;
    font-weight: 500;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.auth-form .btn-primary:hover {
    background-color: var(--hover-green);
    border-color: var(--hover-green);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(40, 167, 69, 0.15);
}

.auth-form .form-check {
    margin: 0.75rem 0;
}

.auth-form .form-check-label {
    color: var(--dark-grey);
    font-weight: 400;
    font-size: 0.9rem;
}

.auth-form .form-check-input:checked {
    background-color: var(--primary-green);
    border-color: var(--primary-green);
}

.auth-form a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.auth-form a:hover {
    color: var(--hover-green);
    text-decoration: underline;
}

.auth-form .invalid-feedback {
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.auth-form .alert {
    margin-bottom: 1.25rem;
    border-radius: 0 8px 0 8px;
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

/* Alert Styles */
.alert {
    border: none;
    border-radius: 8px;
    padding: 1rem 1.25rem;
}

.alert-success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--primary-green);
}

.alert-danger {
    background-color: rgba(220, 53, 69, 0.1);
    color: #dc3545;
}

/* ============================================================================
   Responsive Design for Login Page
   ============================================================================ */

/* Tablet and below (max-width: 992px) */
@media (max-width: 992px) {
    .container {
        width: 95vw;
        padding: 1rem;
    }
    
    .auth-form {
        max-width: 400px;
        padding: 1.75rem;
    }
    
    .auth-form h2 {
        font-size: 1.5rem;
    }
}

/* Mobile Landscape and Small Tablets (max-width: 768px) */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    
    body::before {
        background-attachment: scroll; /* Better performance on mobile */
        background-size: cover;
    }
    
    .container {
        width: 100vw;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height for mobile */
        padding: 1rem;
        justify-content: flex-start;
        padding-top: 2rem;
    }
    
    .auth-form {
        max-width: 100%;
        width: 100%;
        padding: 1.5rem;
        margin: 0;
        border-radius: 12px;
    }
    
    .auth-form h2 {
        font-size: 1.375rem;
        margin-bottom: 1.25rem;
    }
    
    .auth-form .form-control {
        padding: 0.875rem;
        font-size: 1rem; /* Prevents iOS zoom */
    }
    
    .auth-form .form-label {
        font-size: 0.875rem;
    }
    
    .auth-form .btn-primary {
        padding: 0.875rem;
        font-size: 1rem;
    }
    
    /* Logo adjustments */
    .auth-form img {
        width: 80px !important;
        height: 64px !important;
        margin-bottom: 2rem !important;
    }
}

/* Mobile Portrait (max-width: 576px) */
@media (max-width: 576px) {
    .container {
        padding: 0.75rem;
        padding-top: 1.5rem;
    }
    
    .auth-form {
        padding: 1.25rem;
        border-radius: 8px;
    }
    
    .auth-form h2 {
        font-size: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .auth-form .form-control {
        padding: 0.75rem;
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    .auth-form .form-label {
        font-size: 0.8125rem;
        margin-bottom: 0.375rem;
    }
    
    .auth-form .btn-primary {
        padding: 0.75rem;
        font-size: 0.9375rem;
        margin-top: 1rem;
    }
    
    .auth-form .form-check {
        margin: 0.625rem 0;
    }
    
    .auth-form .form-check-label {
        font-size: 0.875rem;
    }
    
    .auth-form .alert {
        padding: 0.625rem 0.875rem;
        font-size: 0.875rem;
        margin-bottom: 1rem;
    }
    
    .auth-form .invalid-feedback {
        font-size: 0.75rem;
    }
    
    /* Logo smaller on mobile */
    .auth-form img {
        width: 70px !important;
        height: 56px !important;
        margin-bottom: 1.5rem !important;
    }
    
    /* Back link */
    .auth-form > div:first-child {
        margin-bottom: 0.75rem;
    }
    
    .auth-form > div:first-child a {
        font-size: 0.8125rem;
    }
    
    /* Sign up link */
    .text-center.mt-3 p {
        font-size: 0.875rem;
    }
}

/* Extra Small Mobile (max-width: 400px) */
@media (max-width: 400px) {
    .container {
        padding: 0.5rem;
        padding-top: 1rem;
    }
    
    .auth-form {
        padding: 1rem;
    }
    
    .auth-form h2 {
        font-size: 1.125rem;
    }
    
    .auth-form .form-control {
        padding: 0.625rem;
    }
    
    .auth-form .btn-primary {
        padding: 0.625rem;
        font-size: 0.875rem;
    }
    
    .auth-form img {
        width: 60px !important;
        height: 48px !important;
    }
}

/* Landscape mobile devices */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        height: auto;
        min-height: 100vh;
        padding: 1rem;
    }
    
    .auth-form {
        max-width: 500px;
        padding: 1.5rem;
    }
    
    .auth-form img {
        width: 70px !important;
        height: 56px !important;
        margin-bottom: 1rem !important;
    }
    
    .auth-form h2 {
        margin-bottom: 1rem;
        font-size: 1.25rem;
    }
    
    .auth-form .form-group {
        margin-bottom: 1rem;
    }
}

/* Prevent horizontal scroll */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    * {
        max-width: 100%;
    }
}

/* Safe area insets for notched devices */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .container {
            padding-left: max(0.75rem, env(safe-area-inset-left));
            padding-right: max(0.75rem, env(safe-area-inset-right));
            padding-bottom: max(1rem, env(safe-area-inset-bottom));
        }
        
        .auth-form {
            padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
        }
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .auth-form {
        border: 2px solid var(--primary-green);
    }
    
    .auth-form .form-control {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    body::before {
        background-attachment: scroll;
    }
    
    .auth-form .form-control,
    .auth-form .btn-primary {
        transition: none;
    }
}