﻿* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    caret-color: transparent;
}

body, html {
    height: 100%;
    overflow: hidden;
}

.upperContainer {
    height: 50vh;
    width: 100%;
    background-color: #434343;
    position: relative;
    z-index: 1;
}

.lowerContainer {
    height: 50vh;
    width: 100%;
    background-color: #d12243;
    position: relative;
    z-index: 1;
}

.contentMiddle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    padding: clamp(10px, 3vw, 20px);
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    text-align: center;
}

.login-form {
    width: 100%;
    max-width: 100%;
    padding: clamp(20px, 5vw, 40px);
    background: white;
    border-radius: clamp(12px, 2vw, 20px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    border: 3px solid #f5f5f5;
    position: relative;
}

.login-header {
    text-align: center;
    margin-bottom: clamp(20px, 4vw, 35px);
}

    .login-header h2 {
        color: #434343;
        font-size: clamp(20px, 5vw, 32px);
        font-weight: 700;
        margin-bottom: clamp(5px, 1.5vw, 10px);
        text-transform: uppercase;
        letter-spacing: clamp(0.5px, 0.1vw, 1px);
        line-height: 1.2;
    }

    .login-header p {
        color: #666666;
        font-size: clamp(14px, 3vw, 16px);
        font-weight: 400;
    }

.form-group {
    margin-bottom: clamp(15px, 4vw, 25px);
    position: relative;
}

    .form-group label {
        display: block;
        margin-bottom: clamp(5px, 1.5vw, 10px);
        color: #434343;
        font-weight: 600;
        font-size: clamp(12px, 2.5vw, 14px);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

.email-input-container {
    position: relative;
    display: flex;
    align-items: stretch;
    border: 2px solid #e0e0e0;
    border-radius: clamp(8px, 2vw, 12px);
    background: white;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 50px;
}

    .email-input-container:focus-within {
        border-color: #d12243;
        box-shadow: 0 0 0 3px rgba(209, 34, 67, 0.1);
    }

.email-input {
    flex: 1;
    padding: clamp(12px, 3vw, 15px) clamp(14px, 3.5vw, 18px);
    border: none;
    outline: none;
    font-size: clamp(14px, 3vw, 16px);
    background: transparent;
    color: #434343;
    min-width: 0; /* Prevents overflow in flexbox */
}

    .email-input::placeholder {
        color: #999999;
    }

.email-suffix {
    padding: clamp(12px, 3vw, 15px) clamp(10px, 2.5vw, 18px);
    color: white;
    font-size: clamp(12px, 2.5vw, 16px);
    font-weight: 600;
    background: linear-gradient(135deg, #d12243, #b91e3a);
    border-left: none;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.form-input {
    width: 100%;
    padding: clamp(12px, 3vw, 15px) clamp(14px, 3.5vw, 18px);
    border: 2px solid #e0e0e0;
    border-radius: clamp(8px, 2vw, 12px);
    font-size: clamp(14px, 3vw, 16px);
    color: #434343;
    background: white;
    transition: all 0.3s ease;
    min-height: 50px;
}

    .form-input:focus {
        border-color: #d12243;
        box-shadow: 0 0 0 3px rgba(209, 34, 67, 0.1);
        outline: none;
    }

    .form-input::placeholder {
        color: #999999;
    }

.login-button {
    width: 100%;
    padding: clamp(14px, 3.5vw, 16px);
    background: linear-gradient(135deg, #d12243, #b91e3a);
    color: white;
    border: none;
    border-radius: clamp(8px, 2vw, 12px);
    font-size: clamp(14px, 3vw, 16px);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: clamp(0.5px, 0.1vw, 1px);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 50px;
}

    .login-button::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.5s;
    }

    .login-button:hover::before {
        left: 100%;
    }

    .login-button:hover {
        background: linear-gradient(135deg, #b91e3a, #a01a33);
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(209, 34, 67, 0.3);
    }

    .login-button:active {
        transform: translateY(0);
    }

    .login-button:disabled {
        background: #999999;
        cursor: not-allowed;
        transform: none;
        box-shadow: none;
    }

        .login-button:disabled::before {
            display: none;
        }

.error-message {
    color: #d12243;
    font-size: clamp(11px, 2.5vw, 13px);
    font-weight: 500;
    margin-top: clamp(6px, 1.5vw, 8px);
    display: none;
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    background: rgba(209, 34, 67, 0.05);
    border-radius: clamp(4px, 1vw, 6px);
    border-left: 3px solid #d12243;
    word-break: break-word;
}

.forgot-password {
    text-align: center;
    margin-top: clamp(15px, 4vw, 25px);
    padding-top: clamp(15px, 3vw, 20px);
    border-top: 1px solid #f0f0f0;
}

    .forgot-password a {
        color: #434343;
        text-decoration: none;
        font-size: clamp(12px, 2.5vw, 14px);
        font-weight: 500;
        transition: color 0.3s ease;
    }

        .forgot-password a:hover {
            color: #d12243;
            text-decoration: underline;
        }

/* Loading spinner */
.spinner {
    width: clamp(16px, 3vw, 18px);
    height: clamp(16px, 3vw, 18px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: none;
    margin-right: clamp(8px, 2vw, 10px);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Additional enhancements */
.login-form::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #d12243, #434343, #d12243, #434343);
    border-radius: clamp(14px, 2.5vw, 22px);
    z-index: -1;
    animation: borderGlow 3s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes borderGlow {
    0%, 100% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.6;
    }
}

/* Focus states for better accessibility */
.email-input:focus,
.form-input:focus {
    caret-color: #d12243;
}

.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.ibu-logo {
    height: 70px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
}

    .ibu-logo:hover {
        transform: scale(1.05);
    }

.logo-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(209, 34, 67, 0.05), rgba(67, 67, 67, 0.05));
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.logo-container:hover::before {
    opacity: 1;
}

/* Success transition animations - FIXED ANCHORING */
.success-transition .upperContainer {
    transform: translateY(-50vh);
    transition: transform 1.2s ease-out;
}

.success-transition .lowerContainer {
    transform: translateY(50vh);
    transition: transform 1.2s ease-out;
}

/* Fade out the login form instead of keeping it visible */
.success-transition .contentMiddle {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease;
    z-index: 15;
}

/* Success states for login form - UPDATED */
.login-form.success {
    border-color: #4CAF50;
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.3);
    transition: all 0.5s ease;
}

    .login-form.success::before {
        background: linear-gradient(45deg, #4CAF50, #45a049, #4CAF50, #45a049);
        opacity: 0.6;
        animation: successGlow 1s ease-in-out forwards;
    }

/* Remove the green border glow during transition */
.success-transition .login-form.success::before {
    opacity: 0;
    transition: opacity 0.6s ease;
}

.success-transition .login-form.success {
    border-color: transparent;
    box-shadow: none;
    transition: all 0.6s ease;
}

.login-button.success {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px rgba(76, 175, 80, 0.4);
}

    .login-button.success .spinner {
        border-top-color: #ffffff;
        animation: successSpin 0.8s linear;
    }

/* Success animations - IMPROVED */
@keyframes successGlow {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 0;
    }
    /* Fade out completely */
}

@keyframes successSpin {
    0% {
        transform: rotate(0deg);
        border-top-color: #ffffff;
    }

    50% {
        border-top-color: #4CAF50;
    }

    100% {
        transform: rotate(360deg);
        border-top-color: #ffffff;
    }
}

/* Fade out effect for the entire page */
.page-fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

/* Loading success icon animation */
.success-checkmark {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4CAF50;
    color: white;
    text-align: center;
    line-height: 20px;
    font-size: 12px;
    margin-right: 8px;
    transform: scale(0);
    animation: checkmarkPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    100% {
        transform: scale(1);
    }
}

/* Comprehensive responsive breakpoints */
/* Extra large devices (large laptops and desktops, 1200px and up) */
@media (min-width: 1200px) {
    .contentMiddle {
        max-width: 500px;
    }
}

/* Large devices (laptops/desktops, 992px and up) */
@media (max-width: 1199.98px) {
    .contentMiddle {
        max-width: 450px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (max-width: 991.98px) {
    .contentMiddle {
        max-width: 400px;
        padding: 15px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 767.98px) {
    .contentMiddle {
        width: 95%;
        max-width: 350px;
        padding: 10px;
    }

    .login-form {
        border: 2px solid #f5f5f5;
    }

    /* Enhanced responsive adjustments for success animation */
    .success-transition .upperContainer,
    .success-transition .lowerContainer {
        transition-duration: 1s; /* Slightly faster on mobile */
    }

    .success-transition .contentMiddle {
        transition-duration: 0.5s; /* Faster fade on mobile */
    }
}

/* Extra small devices (portrait phones, less than 576px) */
@media (max-width: 575.98px) {
    body, html {
        overflow-y: auto; /* Allow scrolling on very small screens */
    }

    .contentMiddle {
        width: 95%;
        max-width: 320px;
        padding: 8px;
        position: fixed; /* Ensure it stays centered even with scrolling */
    }

    .login-form {
        padding: 25px 20px;
        border: 1px solid #f5f5f5;
    }

    .email-input-container {
        flex-direction: column; /* Stack email input and suffix vertically on very small screens */
        align-items: stretch;
    }

    .email-suffix {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.3);
        border-radius: 0 0 8px 8px;
        text-align: center;
    }

    .email-input {
        border-radius: 8px 8px 0 0;
    }

    /* Responsive logo adjustments */
    .ibu-logo {
        height: 50px;
        max-width: 150px;
    }

    .logo-container {
        margin-bottom: 15px;
    }

        .logo-container::before {
            width: 70px;
            height: 70px;
        }
}

/* Ultra small devices (very small phones, less than 360px) */
@media (max-width: 359.98px) {
    .contentMiddle {
        width: 98%;
        max-width: 280px;
    }

    .login-form {
        padding: 20px 15px;
    }

    .login-header h2 {
        font-size: 18px;
    }

    .login-header p {
        font-size: 13px;
    }

    .ibu-logo {
        height: 45px;
        max-width: 120px;
    }
}

/* Landscape orientation adjustments */
@media (max-height: 600px) and (orientation: landscape) {
    body, html {
        overflow-y: auto;
    }

    .contentMiddle {
        position: absolute;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .login-form {
        padding: 20px;
    }

    .login-header {
        margin-bottom: 15px;
    }

    .form-group {
        margin-bottom: 15px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .login-button:hover {
        transform: none; /* Remove hover transforms on touch devices */
        background: linear-gradient(135deg, #d12243, #b91e3a); /* Keep original background */
    }

    .login-button:active {
        transform: scale(0.98); /* Add touch feedback */
    }
    /* Increase touch targets */
    .form-input, .email-input-container, .login-button {
        min-height: 52px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .email-input-container, .form-input {
        border-width: 3px;
    }

    .login-form {
        border-width: 4px;
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .login-button::before,
    .login-form::before {
        animation: none;
    }

    * {
        transition-duration: 0.1s !important;
    }
}


/* Success message styling */
.success-message {
    color: #4CAF50;
    font-size: clamp(11px, 2.5vw, 13px);
    font-weight: 500;
    margin-top: clamp(6px, 1.5vw, 8px);
    display: none;
    padding: clamp(6px, 1.5vw, 8px) clamp(8px, 2vw, 12px);
    background: rgba(76, 175, 80, 0.05);
    border-radius: clamp(4px, 1vw, 6px);
    border-left: 3px solid #4CAF50;
    word-break: break-word;
}

/* Recovery steps styling */
.recovery-steps ul {
    list-style-type: decimal;
}

    .recovery-steps ul li {
        margin-bottom: 5px;
    }

/* Form transition effects */
#mainLoginForm, #forgotPasswordForm {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

    #mainLoginForm.fade-out, #forgotPasswordForm.fade-out {
        opacity: 0;
        transform: translateY(-10px);
    }

    #mainLoginForm.fade-in, #forgotPasswordForm.fade-in {
        opacity: 1;
        transform: translateY(0);
    }


.password-input-container {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-field {
    flex: 1;
    padding-right: 45px;
}

#togglePassword {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #666666;
    font-size: clamp(16px, 3vw, 18px);
    transition: color 0.3s ease;
    z-index: 2;
}

    #togglePassword:hover {
        color: #d12243;
    }