﻿/**
 * Csium | login-page.css
 *
 * This stylesheet contains styles exclusively for the Login.cshtml page.
 * It handles the layout of the login card, form elements, buttons,
 * and the loading indicator overlay.
 */

/* ==========================================================================
   1. Page Layout
   ========================================================================== */

/**
 * The main content area that wraps the login card.
 * Uses Flexbox to center the card on the page.
 */
.main-content
{
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 5rem 1rem;
}


/* ==========================================================================
   2. Login Card & Form Structure
   ========================================================================== */

/**
 * The primary container for the login form.
 * Defines the card's size, appearance, and internal layout.
 * `position: relative` is required for the loading overlay to be positioned correctly.
 */
.login-card
{
    position: relative;
    background-color: var(--surface-card);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    max-width: 420px;
    width: 100%;
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: background-color 0.5s ease, color 0.5s ease;
    overflow: hidden; /* Ensures child elements respect the border-radius */
}

    .login-card h2
    {
        font-size: 1.75rem;
        color: var(--csium-blue);
        text-align: center;
        margin-bottom: 1rem;
    }

/**
 * A container for form inputs to ensure consistent spacing.
 */
.form-group
{
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

    /**
 * Styles for the standard HTML input to match the EJS-Textbox style.
 */
    .form-group .form-control
    {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 1rem;
        line-height: 1.5;
        color: var(--bs-body-color);
        background-color: var(--bs-body-bg);
        background-clip: padding-box;
        border: 1px solid var(--border-color);
        border-radius: 6px;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }

        .form-group .form-control:focus
        {
            color: var(--bs-body-color);
            background-color: var(--bs-body-bg);
            border-color: var(--csium-blue);
            outline: 0;
            box-shadow: 0 0 0 0.25rem rgba(40, 134, 196, 0.25);
        }

/**
 * Container for the password input and its toggle icon.
 */
.password-container
{
    position: relative;
    margin-top: 1rem; /* Added margin for spacing */
}

/**
 * Style the password toggle icon.
 */
.password-toggle-icon
{
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.25rem;
    user-select: none;
}

/**
 * The password input needs extra padding to make space for the icon.
 */
#password
{
    padding-right: 3rem;
}


/**
 * New, improved style for the login error message.
 * It's hidden by default and transitions into view when the `.show` class is added.
 */
.login-error
{
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background-color: #fde8e8;
    color: #c53030;
    border: 1px solid #fbc2c2;
    border-left: 5px solid #c53030;
    padding: 0.8rem 1rem;
    border-radius: 6px;
    font-size: 0.95em;
    font-weight: 500;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    visibility: hidden;
}

    /**
     * The `.show` class makes the error visible with a smooth animation.
     */
    .login-error.show
    {
        opacity: 1;
        transform: translateY(0);
        visibility: visible;
    }

    /**
     * An embedded SVG icon for the error message, added via a pseudo-element.
     */
    .login-error::before
    {
        content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23c53030' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'%3E%3C/circle%3E%3Cline x1='12' y1='8' x2='12' y2='12'%3E%3C/line%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'%3E%3C/line%3E%3C/svg%3E");
        flex-shrink: 0; /* Prevents the icon from shrinking */
        line-height: 0;
    }


/* ==========================================================================
   3. Loading Indicator
   ========================================================================== */

/**
 * The full-card overlay that appears during login attempts.
 * It is hidden by default and activated by adding the `.show` class via JavaScript.
 */
#loadingOverlay
{
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(40, 40, 40, 0.7); /* A slightly more theme-friendly dark overlay */
    z-index: 1000;
    /* Use Flexbox to center the content */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* Hide by default, fade in when shown */
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

    /**
     * The ".show" class is added by your existing JavaScript to display the overlay.
     */
    #loadingOverlay.show
    {
        visibility: visible;
        opacity: 1;
    }

/**
 * The actual spinner element. This is a pure CSS animation.
 */
.loader
{
    border: 5px solid #f3f3f3; /* Light grey circle */
    border-top: 5px solid var(--csium-blue); /* Blue for the spinning part */
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
}

/**
 * The "Signing In..." text below the spinner.
 */
.loader-label
{
    color: white;
    margin-top: 15px;
    font-weight: 500;
    font-size: 1.1em;
}

/**
 * The rotation animation for the spinner.
 */
@keyframes spin
{
    0%
    {
        transform: rotate(0deg);
    }

    100%
    {
        transform: rotate(360deg);
    }
}


/* ==========================================================================
   4. Buttons
   ========================================================================== */

/**
 * A shared base style for all Syncfusion buttons within the login card.
 * This rule defines size, font, and flex properties for consistent alignment
 * of content (like text and icons) inside the buttons.
 */
.login-card .e-btn
{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    height: 44px;
    width: 100%;
    border-radius: 6px;
    font-weight: 500;
    border: none; /* Reset border for all buttons by default */
}

/**
 * Styles specific to the primary Email Login button.
 */
#emailLogin.e-btn
{
    background-color: var(--csium-blue);
    color: white;
    margin-top: 15px;
}

    #emailLogin.e-btn:hover
    {
        background-color: var(--csium-mid-blue);
    }

/**
 * A container for third-party OAuth buttons.
 * Stacks buttons vertically with consistent spacing.
 */
.oauth-buttons
{
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

/**
 * Styles specific to the custom Google Login button.
 */
#googleLogin.e-btn
{
    background-color: #FFFFFF;
    color: #444444;
    border: 1px solid #CCCCCC;
}

    #googleLogin.e-btn:hover
    {
        background-color: #f5f5f5;
    }

/**
 * Styles specific to the Apple Login button.
 * Apple requires a black or white button per their HIG.
 */
#appleLogin.e-btn
{
    background-color: #000000;
    color: #FFFFFF;
    border: 1px solid #000000;
}

    #appleLogin.e-btn:hover
    {
        background-color: #333333;
        border-color: #333333;
    }

/**
 * Apple logo SVG icon styling.
 */
.apple-icon
{
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/**
 * A helper class for the content inside a button to ensure the icon
 * and text are aligned correctly.
 */
.btn-icon-text
{
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
}


/* ==========================================================================
   5. Links
   ========================================================================== */

/**
 * Style for the "Cancel and return" link at the bottom of the card.
 */
.cancel-link
{
    display: inline-block;
    margin-top: 0.5rem;
    text-align: center;
    color: var(--csium-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

    .cancel-link:hover
    {
        color: var(--csium-mid-blue);
        text-decoration: underline;
    }
