/* Auth Pages Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
    transition: background-color 1s ease;
}

/* Page loading state */
body.page-loading {
    background-color: #e9e9e9;
}

/* Container fade-in - simplified */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    opacity: 1; /* Start visible to avoid flicker */
}

/* Login Container */
.login-container, .signup-container {
    display: flex;
    width: 100%;
    max-width: 1000px;
    min-height: 600px;
    background-color: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    /* Simplified animation */
    animation: simpleContainerFadeIn 0.5s ease forwards;
}

@keyframes simpleContainerFadeIn {
    from { opacity: 0.9; }
    to { opacity: 1; }
}

/* Left Side */
.login-left, .signup-left {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40%;
    background-color: #1AB394;
    color: white;
    padding: 40px;
    position: relative;
    overflow: hidden;
    animation: gradientBG 3s ease forwards;
}

@keyframes gradientBG {
    0% {
        background-color: #0e8c73;
    }
    100% {
        background-color: #1AB394;
    }
}

.login-left::before, .signup-left::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 100px;
    height: 100px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0;
    animation: bubbleAppear 1.5s ease forwards;
    animation-delay: 1.2s;
}

.login-left::after, .signup-left::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 160px;
    height: 160px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    opacity: 0;
    animation: bubbleAppear 1.5s ease forwards;
    animation-delay: 1.5s;
}

@keyframes bubbleAppear {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.login-content, .signup-content {
    z-index: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-container {
    margin-bottom: 30px;
}

.logo {
    width: 60px;
    height: auto;
}

.login-left h1, .signup-left h1 {
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 10px;
}

.login-left p, .signup-left p {
    font-size: 16px;
    opacity: 0.9;
}

.login-footer, .signup-footer {
    z-index: 1;
    display: flex;
    gap: 20px; /* Increased gap for better spacing */
    justify-content: center; /* Center the buttons */
    align-items: center;
}

/* Hide footer buttons in desktop view */
@media (min-width: 769px) {
    .login-footer, .signup-footer {
        display: none;
    }
}

/* Styles for direct form view */
.direct-form-view .signup-left {
    display: none !important;
}

.direct-form-view .signup-right {
    display: block !important;
    opacity: 1 !important;
}

.btn-signin, .btn-signup {
    background-color: transparent;
    color: white;
    border: 2px solid white;
    border-radius: 30px;
    padding: 10px 0; /* Changed padding to ensure consistent width */
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 120px; /* Fixed width for consistent sizing */
    height: 40px; /* Fixed height for consistent sizing */
    text-align: center;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

/* Add outline to buttons in left panel */
.signup-left .btn-signup,
.login-left .btn-signup,
.login-left .btn-signin {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
    border: 2px solid white;
}

.btn-signin:hover, .btn-signup:hover {
    background-color: white;
    color: #1AB394;
}

/* Right Side */
.login-right, .signup-right {
    width: 60%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-container, .signup-form-container {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

.login-right h2, .signup-right h2 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 30px;
    color: #333;
    text-align: center;
}

/* Form Styles */
.login-form, .signup-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #555;
}

.input-group {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.toggle-password {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    cursor: pointer;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 15px 12px 40px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #1AB394;
}

.remember-forgot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    margin-bottom: 25px;
}

.remember-me {
    display: flex;
    align-items: center;
}

.remember-me input {
    margin-right: 8px;
}

.forgot-password {
    color: #1AB394;
    text-decoration: none;
}

.forgot-password:hover {
    text-decoration: underline;
}

.btn-login, .btn-signup {
    width: 100%;
    background-color: #1AB394;
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    margin-bottom: 20px;
}

.btn-login:hover, .btn-signup:hover {
    background-color: #149A82;
}

.signup-link, .login-link {
    text-align: center;
    font-size: 14px;
}

.signup-link a, .login-link a {
    color: #1AB394;
    text-decoration: none;
    font-weight: 600;
}

.signup-link a:hover, .login-link a:hover {
    text-decoration: underline;
}

/* Superadmin specific styles */
.superadmin-container .login-left {
    background-color: #2F4050;
}

.superadmin-container .btn-signin:hover {
    color: #2F4050;
}

.superadmin-container .btn-login {
    background-color: #2F4050;
}

.superadmin-container .btn-login:hover {
    background-color: #263848;
}

.superadmin-container .forgot-password,
.superadmin-container .signup-link a,
.tenant-link a {
    color: #2F4050;
}

.tenant-link {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.tenant-link a {
    color: #777;
    text-decoration: none;
}

.tenant-link a:hover {
    text-decoration: underline;
    color: #1AB394;
}

/* Alert Messages */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Terms checkbox */
.terms {
    display: flex;
    align-items: flex-start;
}

.terms input {
    margin-right: 10px;
    margin-top: 5px;
}

.terms label {
    font-size: 13px;
    line-height: 1.4;
}

.terms a {
    color: #1AB394;
    text-decoration: none;
}

.terms a:hover {
    text-decoration: underline;
}

/* Back button for mobile view */
.mobile-back-button {
    display: none;
    margin-bottom: 20px;
    align-self: flex-start;
}

.btn-back {
    background-color: transparent;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    background-color: #f5f5f5;
}

/* Responsive Styles */
@media (max-width: 768px) {
    body {
        overflow: hidden; /* Prevent body scrolling in mobile view */
        margin: 0;
        padding: 0;
    }

    .container {
        padding: 0; /* Remove padding in mobile view */
        height: 100vh; /* Fallback for browsers that do not support Custom Properties */
        height: calc(var(--vh, 1vh) * 100);
        overflow: hidden;
        margin: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    /* Ensure direct form view works correctly on mobile */
    .direct-form-view .signup-left {
        display: none !important;
    }

    .direct-form-view .signup-right {
        display: block !important;
        opacity: 1 !important;
    }

    .login-container, .signup-container {
        flex-direction: column;
        height: 100vh; /* Fallback for browsers that do not support Custom Properties */
        height: calc(var(--vh, 1vh) * 100);
        max-height: 100vh;
        overflow: hidden;
        border-radius: 0; /* Remove border radius in mobile view */
        box-shadow: none; /* Remove box shadow in mobile view */
    }

    .login-left, .signup-left {
        width: 100%;
        padding: 40px 30px;
        height: 100vh; /* Fallback for browsers that do not support Custom Properties */
        height: calc(var(--vh, 1vh) * 100);
        max-height: 100vh;
        justify-content: center;
        transition: opacity 0.3s ease;
        opacity: 1;
        overflow: hidden;
    }

    .login-right, .signup-right {
        width: 100%;
        padding: 40px 30px;
        height: 100vh; /* Fallback for browsers that do not support Custom Properties */
        height: calc(var(--vh, 1vh) * 100);
        max-height: 100vh;
        display: none; /* Initially hide the right panel in mobile view */
        transition: opacity 0.3s ease;
        opacity: 0;
        overflow-y: auto; /* Allow scrolling if content is too long */
    }

    .login-form-container, .signup-form-container {
        max-width: 100%;
        padding: 0 15px;
        display: flex;
        flex-direction: column;
        height: 100%;
    }

    .login-form, .signup-form {
        margin-bottom: auto;
    }

    .mobile-back-button {
        display: block;
    }

    /* Improve mobile layout for left panels */
    .login-left, .signup-left {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        position: relative;
    }

    /* Center content vertically */
    .login-content, .signup-content,
    .login-footer, .signup-footer {
        position: relative;
        top: -5vh; /* Adjust vertical position slightly */
    }

    .login-content, .signup-content {
        margin-bottom: 40px;
        width: 100%;
        max-width: 300px;
    }

    .login-footer, .signup-footer {
        display: flex;
        justify-content: center;
        gap: 20px; /* Increased gap for better spacing */
        width: 100%;
        max-width: 300px;
        align-items: center; /* Ensure vertical alignment */
    }

    .logo-container {
        text-align: center;
        margin-bottom: 40px;
    }

    .logo {
        width: 80px;
    }

    /* Improve button styles for mobile */
    .btn-signin, .btn-signup {
        padding: 10px 0;
        font-size: 16px;
        width: 120px;
        height: 44px; /* Slightly larger height for mobile */
    }

    /* Animation for signin button in mobile view */
    @keyframes pulse {
        0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.7); }
        70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(255, 255, 255, 0); }
        100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
    }

    @keyframes float-btn {
        0% { transform: translateY(0px); }
        50% { transform: translateY(-5px); }
        100% { transform: translateY(0px); }
    }

    @keyframes glow {
        0% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
        50% { box-shadow: 0 0 20px rgba(255, 255, 255, 0.8); }
        100% { box-shadow: 0 0 5px rgba(255, 255, 255, 0.5); }
    }

    /* Apply animation to buttons in login-left panel */
    .login-left .btn-signin,
    .login-left .btn-signup {
        animation: pulse 2s infinite, glow 3s infinite; /* Removed float-btn animation */
        position: relative;
        overflow: hidden;
        background-color: rgba(255, 255, 255, 0.2);
        border-width: 2px;
        font-weight: 700;
        letter-spacing: 1px;
        text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    /* Add ripple effect */
    .login-left .btn-signin:after,
    .login-left .btn-signup:after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 5px;
        height: 5px;
        background: rgba(255, 255, 255, 0.5);
        opacity: 0;
        border-radius: 100%;
        transform: scale(1, 1) translate(-50%);
        transform-origin: 50% 50%;
    }

    @keyframes ripple {
        0% {
            transform: scale(0, 0);
            opacity: 0.5;
        }
        100% {
            transform: scale(20, 20);
            opacity: 0;
        }
    }

    .login-left .btn-signin:focus:not(:active)::after,
    .login-left .btn-signup:focus:not(:active)::after {
        animation: ripple 1s ease-out;
    }

    /* Ripple effect for click animation */
    .ripple-effect {
        position: absolute;
        border-radius: 50%;
        background-color: rgba(255, 255, 255, 0.7);
        transform: scale(0);
        animation: ripple-click 0.6s linear;
        pointer-events: none;
    }

    @keyframes ripple-click {
        to {
            transform: scale(4);
            opacity: 0;
        }
    }

    /* Add shine effect */
    .login-left .btn-signin,
    .login-left .btn-signup {
        position: relative;
        overflow: hidden;
    }

    .login-left .btn-signin::before,
    .login-left .btn-signup::before {
        content: '';
        position: absolute;
        top: 0;
        left: -100%;
        width: 50%;
        height: 100%;
        background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.3), transparent);
        transform: skewX(-25deg);
        animation: shine 3s infinite;
    }

    @keyframes shine {
        0% { left: -100%; }
        20% { left: 100%; }
        100% { left: 100%; }
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-50px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); }
    40% { transform: scale(1.1); }
    60% { transform: scale(0.9); }
    100% { transform: scale(1); }
}

@keyframes rotateIn {
    from { transform: rotateY(90deg); opacity: 0; }
    to { transform: rotateY(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Page load animations */
.login-content, .signup-content {
    animation: slideIn 0.8s ease forwards;
}

.login-form-container, .signup-form-container {
    animation: none; /* Remove animation to avoid conflicts */
    opacity: 1; /* Start visible */
}

/* Logo animation on page load */
.logo-container img {
    /* Simplify animation to avoid double animation effect */
    animation: none; /* Remove the bounceIn animation */
    opacity: 1;
}

/* Heading animation on page load */
.login-left h1, .signup-left h1 {
    animation: slideUp 0.8s ease forwards;
    opacity: 0;
    animation-delay: 0.5s;
}

/* Paragraph animation on page load */
.login-left p, .signup-left p {
    animation: slideUp 0.8s ease forwards;
    opacity: 0;
    animation-delay: 0.7s;
}

/* Footer buttons animation on page load */
.login-footer, .signup-footer {
    animation: fadeIn 0.8s ease forwards;
    opacity: 0;
    animation-delay: 0.9s;
}

.form-group {
    opacity: 1; /* Start visible */
    animation: none; /* Remove animation to avoid conflicts */
}

/* Buttons in right panel */
.login-right .btn-login,
.signup-right .btn-signup {
    opacity: 1;
    animation: none; /* Remove animation to avoid double animation */
}

.signup-link, .login-link {
    opacity: 0;
    animation: fadeIn 0.5s ease forwards;
    animation-delay: 0.8s;
}

/* Floating bubbles animation */
.login-left::before {
    animation: float 8s ease-in-out infinite;
}

.login-left::after {
    animation: float 10s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    50% { transform: translate(15px, -15px); }
    100% { transform: translate(0, 0); }
}
