/* Authentication Pages Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
    /* Global background pattern */
    background-color: #f8f9fa;
    background-image:
        radial-gradient(#e9ecef 1px, transparent 1px),
        radial-gradient(#e9ecef 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Card Styles */
.login-card {
    max-width: 500px;
    width: 100%;
    max-height: 95vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.05);
    transition: var(--transition-base);
}

.registration-card {
    max-width: 800px;
    max-height: 95vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.05);
}

.login-logo {
    max-width: 160px;
    height: auto;
    margin-bottom: 1rem;
    transition: var(--transition-base);
}

.login-logo:hover {
    transform: scale(1.02);
}

/* Form Elements */
.form-control {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    border: 1px solid #dee2e6;
    transition: var(--transition-base);
    font-family: var(--font-body);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.1);
    outline: none;
}

.form-control.is-invalid {
    border-color: #dc3545;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875em;
    color: #dc3545;
}

.form-control.is-invalid ~ .invalid-feedback {
    display: block;
}

.form-text {
    font-size: 0.875em;
    color: #6c757d;
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
    display: block;
}

/* Password Field Styles */
.password-field {
    position: relative;
    margin-bottom: 0;
}

.password-field .form-control {
    padding-right: 3rem;
}

.password-field .form-control.is-invalid {
    background-position: right calc(2.375em + 0.1875rem) center;
}

.password-field .invalid-feedback {
    position: static;
    margin-top: 0.25rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 0.25rem;
    z-index: 5;
    opacity: 0.7;
    transition: var(--transition-base);
}

.password-toggle:hover {
    color: var(--secondary-color);
    opacity: 1;
}

/* Form Group Spacing - Reduced for better screen utilization */
.form-group, .mb-3, .mb-4 {
    margin-bottom: 1.5rem !important;
    position: relative;
}

/* Input Field Container */
.input-container {
    margin-bottom: 0.5rem;
}

/* Auth Link Styles */
.auth-link {
    color: var(--primary-color);
    text-decoration: none;
    position: relative;
    font-weight: 500;
    transition: var(--transition-base);
}

.auth-link::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--primary-color);
    transform: scaleX(0);
    transform-origin: bottom right;
    transition: transform 0.3s ease;
}

.auth-link:hover {
    color: var(--secondary-color);
}

.auth-link:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
    background-color: var(--secondary-color);
}

/* Card Header */
.auth-card-header {
    padding: 2rem 2rem 1.5rem;
    text-align: center;
    background-color: rgba(var(--primary-rgb), 0.03);
    border-bottom: 1px solid rgba(0,0,0,0.03);
    border-radius: 20px 20px 0 0;
}

.auth-card-header h1 {
    margin: 0.5rem 0 0.25rem;
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 2rem;
}

.auth-card-header .subtitle {
    color: #6c757d;
    margin-bottom: 0;
    font-family: var(--font-body);
}

/* Form Layout */
.auth-form-container {
    padding: 2rem;
}

/* Validation Messages */
.validation-message {
    margin-top: 0.25rem;
    font-size: 0.875em;
}

/* Field Groups */
.field-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
}

.field-group .form-text {
    order: 2;
}

.field-group .invalid-feedback {
    order: 3;
}

/* Responsive Adjustments for Better Screen Utilization */
@media (max-height: 800px) {
    /* For shorter screens (typical laptops) */
    .login-container {
        padding: 0.75rem;
        align-items: flex-start;
        padding-top: 2vh;
    }
    
    .login-logo {
        max-width: 140px;
        margin-bottom: 0.75rem;
    }
    
    .auth-card-header {
        padding: 1.5rem 2rem;
    }
    
    .auth-card-header h1 {
        font-size: 1.75rem;
        margin: 0.25rem 0;
    }
    
    .auth-form-container {
        padding: 1.5rem 2rem;
    }
    
    .form-group, .mb-3, .mb-4 {
        margin-bottom: 1.25rem !important;
    }
    
    .field-group {
        margin-bottom: 1rem;
    }
    
    .form-text {
        font-size: 0.8rem;
        line-height: 1.3;
        margin-top: 0.2rem;
        margin-bottom: 0.2rem;
    }
}

@media (max-height: 700px) {
    /* For very short screens */
    .login-container {
        padding: 0.5rem;
        padding-top: 1vh;
    }
    
    .login-card, .registration-card {
        max-height: 98vh;
    }
    
    .login-logo {
        max-width: 120px;
        margin-bottom: 0.5rem;
    }
    
    .auth-card-header {
        padding: 1rem 1.5rem;
    }
    
    .auth-card-header h1 {
        font-size: 1.5rem;
        margin: 0.25rem 0;
    }
    
    .auth-card-header .subtitle {
        font-size: 0.9rem;
    }
    
    .auth-form-container {
        padding: 1rem 1.5rem;
    }
    
    .form-group, .mb-3, .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .field-group {
        margin-bottom: 0.75rem;
    }
    
    .form-control {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
    }
    
    .btn {
        padding: 0.65rem 1.25rem;
    }
    
    .form-text {
        font-size: 0.75rem;
        line-height: 1.2;
    }
}

@media (max-width: 576px) {
    .login-card {
        margin: 0.5rem;
        max-height: 98vh;
    }

    .auth-form-container {
        padding: 1.5rem 1rem;
    }
    
    .auth-card-header {
        padding: 1.5rem 1rem;
    }

    .language-switcher {
        top: 0.5rem;
        right: 0.5rem;
    }
}

/* Improved height handling for registration form */
@media (max-height: 900px) {
    .registration-card .auth-card-header {
        padding: 1rem 2rem;
    }
    
    .registration-card .auth-form-container {
        padding: 1.25rem 2rem;
    }
    
    .registration-card .form-group, 
    .registration-card .mb-3, 
    .registration-card .mb-4 {
        margin-bottom: 1rem !important;
    }
    
    .registration-card .row {
        margin-bottom: 0;
    }
    
    .registration-card .col-md-6 {
        margin-bottom: 0.75rem;
    }
}

@media (max-height: 800px) {
    .registration-card .login-logo {
        max-width: 130px;
        margin-bottom: 0.5rem;
    }
    
    .registration-card .auth-card-header h1 {
        font-size: 1.6rem;
    }
    
    .registration-card .auth-card-header .subtitle {
        font-size: 0.9rem;
    }
}

/* Ensure scrollability when content exceeds card height */
.login-card, .registration-card {
    display: flex;
    flex-direction: column;
}

.card-body {
    flex: 1;
    overflow-y: auto;
}

/* Smooth scrolling for card content */
.login-card::-webkit-scrollbar, 
.registration-card::-webkit-scrollbar {
    width: 6px;
}

.login-card::-webkit-scrollbar-track, 
.registration-card::-webkit-scrollbar-track {
    background: transparent;
}

.login-card::-webkit-scrollbar-thumb, 
.registration-card::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

.login-card::-webkit-scrollbar-thumb:hover, 
.registration-card::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--primary-rgb), 0.3);
}