/* Login Container */
.login-container {
    background-color: var(--background-secandary);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 430px;
    margin: 2rem auto;
    animation: fadeIn 0.6s ease-out forwards;
}

/* Logo */
.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.logo {
    height: 2.5rem;
}

/* Typography */
.login-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 2rem;
}

/* Form Styles */
.login-form {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem; /* 14px */
    font-weight: 500; /* Medium weight, common in Google forms */
    margin-bottom: 0.5rem; /* 8px */
    color: var(--text-color); /* Or a specific color like #3c4043 */
}

/* RTL label alignment */
[dir="rtl"] .form-group label {
    text-align: right;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem; /* 14px 16px - Adjust for desired height */
    font-size: 1rem; /* 16px */
    color: var(--text-color); /* Or #202124 */
    background-color: var(--white); /* Or #fff */
    border: 1px solid var(--border-color); /* Or #dadce0 for a light grey border */
    border-radius: var(--border-radius); /* Or 4px for slightly rounded corners */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out; /* Smooth transition */
    box-sizing: border-box; /* Include padding and border in the element's total width and height */
}

/* RTL text alignment for inputs */
[dir="rtl"] .form-group input {
    text-align: right;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color); /* Or #1a73e8 for Google's blue */
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2); /* Subtle blue glow, adjust color if primary-color is different */
}

/* Placeholder styling (optional, but common in modern inputs) */
.form-group input::placeholder {
    color: #80868b; /* Google placeholder color */
    opacity: 1; /* Firefox */
}

.form-group input:-ms-input-placeholder { /* Internet Explorer 10-11 */
   color: #80868b;
}

.form-group input::-ms-input-placeholder { /* Microsoft Edge */
   color: #80868b;
}

/* Password input with toggle */
.password-input-container {
    position: relative;
}

/* LTR password toggle positioning */
.password-toggle {
    position: absolute;
    right: 0.75rem;
    left: auto;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-secandary);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
}

/* RTL password toggle positioning */
[dir="rtl"] .password-toggle {
    right: auto;
    left: 0.75rem;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.eye-icon {
    font-size: 1.25rem;
}

/* Form Options */
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* RTL form options direction */
[dir="rtl"] .form-options {
    flex-direction: row-reverse;
}

.remember-me {
    display: flex;
    align-items: center;
}

/* LTR checkbox styling */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 1.75rem;
    padding-right: 0;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secandary);
    user-select: none;
    min-height: 1.5rem;
}

/* RTL checkbox styling */
[dir="rtl"] .checkbox-container {
    padding-left: 0;
    padding-right: 1.75rem;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* LTR checkmark positioning */
.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    right: auto;
    height: 1.25rem;
    width: 1.25rem;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    transition: var(--transition);
}

/* RTL checkmark positioning */
[dir="rtl"] .checkmark {
    left: auto;
    right: 0;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--primary-color);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

/* LTR checkmark tick position */
.checkbox-container .checkmark:after {
    left: 0.4rem;
    top: 0.2rem;
    width: 0.3rem;
    height: 0.6rem;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

/* RTL checkmark tick position */
[dir="rtl"] .checkbox-container .checkmark:after {
    left: auto;
    right: 0.4rem;
}

.forgot-password {
    font-size: 0.875rem;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.forgot-password:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

/* Login Button */
.login-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--white);
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    -webkit-tap-highlight-color: transparent;
}

.login-button:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.login-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Active state for mobile touch feedback */
.login-button:active {
    transform: translateY(1px);
    background-color: var(--primary-dark);
    transition: background-color 0.1s;
}

/* LTR button text margin */
.button-text {
    margin-right: 0.5rem;
    margin-left: 0;
}

/* RTL button text margin */
[dir="rtl"] .button-text {
    margin-right: 0;
    margin-left: 0.5rem;
}

.button-icon {
    font-size: 1.25rem;
    transition: transform 0.2s ease;
}

/* LTR button icon animation */
.login-button:hover .button-icon {
    transform: translateX(3px);
}

/* RTL button icon animation */
[dir="rtl"] .login-button:hover .button-icon {
    transform: translateX(-3px);
}

/* Signup Link */
.signup-link {
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secandary);
    margin-bottom: 1.5rem;
}

.signup-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    display: inline-block;
    -webkit-tap-highlight-color: transparent;
}

.signup-link a:hover {
    text-decoration: underline;
}

/* Social Login */
.login-footer {
    margin-top: 1rem;
}

.social-login {
    text-align: center;
}

.social-login-text {
    color: var(--text-secandary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    position: relative;
}

.social-login-text::before,
.social-login-text::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 35%;
    height: 1px;
    background-color: var(--border-color);
}

.social-login-text::before {
    left: 0;
}

.social-login-text::after {
    right: 0;
}

.social-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.social-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--white);
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    min-width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.social-btn i {
    margin-right: 0.5rem;
}

[dir="rtl"] .social-btn i {
    margin-right: 0;
    margin-left: 0.5rem;
}

.social-btn:hover {
    background-color: var(--bg-light);
    border-color: var(--text-secandary);
}

/* Messages */
.messages {
    margin-bottom: 1.5rem;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}

/* RTL message text alignment */
[dir="rtl"] .message {
    text-align: right;
}

.message.error {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.message.success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.message.info {
    background-color: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PIN Input Styles */
.pin-input-container {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

/* RTL PIN container direction */
[dir="rtl"] .pin-input-container {
    flex-direction: row-reverse;
}

.pin-digit {
    width: 3rem;
    height: 3.5rem;
    font-size: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--white);
    color: var(--text-color);
    transition: var(--transition);
}

.pin-digit:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Responsive adjustments - Enhanced for better mobile experience */
@media (max-width: 480px) {
    .login-container {
        margin: 0.75rem auto;
        padding: 1.5rem;
        border-radius: calc(var(--border-radius) - 2px);
        width: calc(100% - 2rem);
    }
    
    .login-title {
        font-size: 1.5rem;
    }
    
    .login-subtitle {
        font-size: 0.875rem;
        margin-bottom: 1.5rem;
    }
    
    /* Larger touch targets on mobile */
    .form-group input {
        padding: 0.85rem 1rem;
        font-size: 16px; /* Prevents iOS zoom on focus */
    }
    
    .password-toggle {
        width: 44px; /* iOS minimum touch target size */
        height: 44px;
    }
    
    .form-options {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.85rem;
        margin-bottom: 1.25rem;
        width: 100%;
    }
    
    /* RTL form options in mobile */
    [dir="rtl"] .form-options {
        flex-direction: column;
        align-items: flex-end;
    }
    
    .forgot-password {
        align-self: flex-start;
        padding: 0.5rem 0;
        width: auto;
        margin-left: 1.75rem;
    }
    
    /* RTL forgot password in mobile */
    [dir="rtl"] .forgot-password {
        align-self: flex-end;
        margin-left: 0;
        margin-right: 1.75rem;
    }
    
    /* Enhance checkbox touch target */
    .checkbox-container {
        min-height: 2rem;
        display: flex;
        align-items: center;
    }
    
    .checkmark {
        width: 1.4rem;
        height: 1.4rem;
    }
    
    /* Larger button on mobile */
    .login-button {
        padding: 1rem 1.5rem;
        font-size: 16px;
    }
    
    /* Make PIN input more mobile-friendly */
    .pin-input-container {
        gap: 0.25rem;
    }
    
    .pin-digit {
        width: 2.5rem;
        height: 3rem;
        font-size: 1.25rem;
    }
    
    /* Better spacing for social buttons */
    .social-buttons {
        gap: 0.75rem;
    }
    
    .social-btn {
        flex: 1 0 calc(50% - 0.75rem);
        padding: 0.75rem 1rem;
        min-height: 2.75rem;
    }
    
    /* Ensure form elements are properly spaced */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    /* Better mobile spacing for logo */
    .logo-container {
        margin-bottom: 1.5rem;
    }
    
    .logo {
        height: 2.25rem;
    }
}

/* Extra small devices */
@media (max-width: 320px) {
    .login-container {
        padding: 1.25rem;
    }
    
    .login-title {
        font-size: 1.35rem;
    }
    
    .social-buttons {
        flex-direction: column;
    }
    
    .social-btn {
        width: 100%;
    }
}

/* Fix for devices with notches */
@supports(padding: max(0px)) {
    .login-container {
        padding-left: max(1.5rem, env(safe-area-inset-left));
        padding-right: max(1.5rem, env(safe-area-inset-right));
    }
}

/* Light tap effect for mobile */
@media (hover: none) {
    .login-button:active,
    .social-btn:active,
    .forgot-password:active,
    .signup-link a:active {
        opacity: 0.75;
    }
    
    .checkbox-container:active .checkmark {
        transform: scale(0.95);
    }
}

/* Make the social buttons act like anchors while keeping their styling */
.social-btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    text-decoration: none;
    color: var(--text-color);
    transition: var(--transition);
}

.social-btn.google {
    background-color: #fff;
    color: #4285F4;
    border: 1px solid #ddd;
}

.social-btn.google:hover {
    background-color: #f8f8f8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.social-btn.facebook {
    background-color: hsl(226, 88%, 56%);
    color: #fff;
    border: 1px solid hsl(234, 72%, 43%);
}

.social-btn.facebook:hover {
    background-color: hsl(239, 70%, 53%);
}

.social-btn i {
    margin-right: 8px;
}