﻿/* ============================================================
   Attendance Student | Authentication layout
   Clean standalone stylesheet - RTL / responsive / SweetAlert2
   ============================================================ */

:root {
    --auth-primary: #2563eb;
    --auth-primary-dark: #1d4ed8;
    --auth-text: #0f172a;
    --auth-muted: #64748b;
    --auth-border: #e2e8f0;
}

html {
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: clip;
}

body.auth-body {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
    direction: rtl;
    color: var(--auth-text);
    overflow-x: clip;
    background: radial-gradient(circle at 15% 15%, rgba(37, 99, 235, .07), transparent 35%), radial-gradient(circle at 85% 85%, rgba(20, 184, 166, .05), transparent 35%), #f8fafc;
}

.auth-body,
.auth-body *,
.auth-body *::before,
.auth-body *::after {
    box-sizing: border-box;
}

.auth-page {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.auth-main {
    flex: 1 0 auto;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-container {
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
}

/* Application branding */
.auth-brand {
    text-align: center;
    margin-bottom: 18px;
}

.auth-brand-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 17px;
    background: linear-gradient(145deg, var(--auth-primary), var(--auth-primary-dark));
    box-shadow: 0 10px 24px rgba(37, 99, 235, .18);
}

    .auth-brand-icon svg {
        width: 31px;
        height: 31px;
        color: #fff;
        stroke: currentColor;
    }

.auth-brand-title {
    margin: 0;
    font-size: 23px;
    font-weight: 800;
    line-height: 1.6;
}

.auth-brand-description {
    margin: 5px 0 0;
    font-size: 14px;
    line-height: 1.8;
    color: var(--auth-muted);
}

/* Existing Login.cshtml wrapper and card */
.auth-card {
    width: 100%;
}

    .auth-card > .bg-white {
        width: 100%;
        padding: 25px 26px !important;
        background: #fff;
        border: 1px solid var(--auth-border);
        border-radius: 18px !important;
        box-shadow: 0 12px 40px rgba(15, 23, 42, .055);
    }

    .auth-card h2 {
        margin-bottom: 7px;
        font-size: 20px;
        font-weight: 800;
        line-height: 1.7;
        color: var(--auth-text);
    }

    .auth-card p {
        font-size: 14px;
        line-height: 1.9;
        color: var(--auth-muted);
    }

    .auth-card hr {
        margin: 13px 0 17px;
        border-color: #f1f5f9;
    }

/* The English keyboard notice */
.auth-keyboard-notice {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    margin: 0 0 15px;
    padding: 10px 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-right: 4px solid var(--auth-primary);
    border-radius: 11px;
    color: #1e40af;
}

.auth-keyboard-notice-icon {
    flex: 0 0 25px;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-primary);
}

.auth-keyboard-notice-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: right;
}

    .auth-keyboard-notice-content strong {
        font-size: 13px;
        font-weight: 800;
        line-height: 1.6;
    }

    .auth-keyboard-notice-content span {
        font-size: 12px;
        line-height: 1.7;
        color: #475569;
    }

/* Inputs and form */
.auth-card input[type="text"],
.auth-card input[type="password"] {
    width: 100%;
    height: 45px;
    padding: 9px 13px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--auth-text);
    direction: ltr;
    text-align: left;
    font-size: 15px;
    outline: none;
    transition: background-color .2s, border-color .2s, box-shadow .2s;
}

    .auth-card input[type="text"]:focus,
    .auth-card input[type="password"]:focus {
        background: #fff;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
    }

.auth-card input::placeholder {
    color: #94a3b8;
}

.auth-card input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-card label {
    font-size: 14px;
    font-weight: 600;
}

.auth-card button[type="submit"] {
    min-height: 44px;
    padding: 9px 18px;
    border: 0;
    border-radius: 10px;
    background: var(--auth-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color .2s;
}

    .auth-card button[type="submit"]:hover {
        background: var(--auth-primary-dark);
    }

    .auth-card button[type="submit"]:disabled {
        opacity: .65;
        cursor: wait;
    }

/* Kept for future activation of OTP button */
.auth-card a[href*="Otp"] {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

    .auth-card a[href*="Otp"]:hover {
        background: #e2e8f0;
    }

/* Login notifications and attempts */
.auth-card.auth-ajax-mode [data-valmsg-for],
.auth-card.auth-ajax-mode [data-valmsg-summary] {
    display: none !important;
}

.auth-login-attempts {
    margin: 0 0 13px;
    padding: 10px 12px;
    border: 1px solid #fecdd3;
    border-radius: 10px;
    background: #fff1f2;
    color: #9f1239;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.8;
    text-align: right;
}

.auth-security-note {
    margin-top: 12px;
    color: #94a3b8;
    font-size: 13px;
    line-height: 1.7;
    text-align: center;
}

.auth-footer {
    flex: 0 0 auto;
    padding: 9px 12px;
    color: #94a3b8;
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

/* SweetAlert2: loading and shared popup */
.swal2-popup.auth-login-swal {
    width: min(430px, calc(100vw - 28px)) !important;
    max-width: 430px !important;
    padding: 26px 22px !important;
    border: 1px solid var(--auth-border) !important;
    border-radius: 16px !important;
    background: #fff !important;
    direction: rtl !important;
    font-family: inherit;
    box-shadow: 0 20px 55px rgba(15, 23, 42, .13) !important;
}

    .swal2-popup.auth-login-swal .swal2-title {
        margin: 0 !important;
        padding: 0 !important;
        color: var(--auth-text) !important;
        font-size: 20px !important;
        font-weight: 800 !important;
        line-height: 1.8 !important;
    }

    .swal2-popup.auth-login-swal .swal2-html-container {
        margin: 12px 0 0 !important;
        padding: 0 !important;
        color: var(--auth-muted) !important;
        font-size: 15px !important;
        line-height: 2 !important;
        text-align: center !important;
    }

.auth-login-loading-text {
    text-align: center;
}

.auth-login-loading-caption {
    margin-top: 10px;
    color: #94a3b8;
    font-size: 13px;
}

/* SweetAlert2: failed login */
.swal2-popup.auth-login-error-popup .swal2-icon {
    width: 66px !important;
    height: 66px !important;
    margin: 8px auto 16px !important;
    border-width: 3px !important;
}

.swal2-popup.auth-login-error-popup .swal2-actions {
    display: flex !important;
    justify-content: center !important;
    width: 100% !important;
    margin: 22px 0 0 !important;
    padding: 0 !important;
}

.swal2-popup.auth-login-error-popup button.swal2-confirm.auth-login-error-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 180px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 20px !important;
    border: 1px solid #fecdd3 !important;
    border-radius: 9px !important;
    background: #ffe4e6 !important;
    color: #9f1239 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.5 !important;
    cursor: pointer !important;
    box-shadow: none !important;
}

    .swal2-popup.auth-login-error-popup button.swal2-confirm.auth-login-error-button:hover {
        background: #fecdd3 !important;
    }

    .swal2-popup.auth-login-error-popup button.swal2-confirm.auth-login-error-button:focus-visible {
        outline: 2px solid #e11d48 !important;
        outline-offset: 2px !important;
    }

/* SweetAlert2: successful login toast */
.swal2-popup.auth-login-toast {
    padding: 12px 16px !important;
    border: 1px solid #99f6e4 !important;
    border-radius: 12px !important;
    background: #f0fdfa !important;
    direction: rtl !important;
    box-shadow: 0 8px 25px rgba(15, 23, 42, .08) !important;
}

    .swal2-popup.auth-login-toast .swal2-title {
        color: #115e59 !important;
        font-size: 14px !important;
        font-weight: 700 !important;
    }

/* Desktop: truly fit the visible viewport at 1360 x 768.
   No clipping: heights are reduced via spacing, not by hiding the form. */
@media (min-width: 768px) and (min-height: 700px) {
    html,
    body.auth-body {
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    .auth-page {
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        overflow: hidden;
    }

    .auth-main {
        flex: 1 1 auto;
        min-height: 0;
        padding: 8px 16px;
    }

    .auth-brand {
        margin-bottom: 10px;
    }

    .auth-brand-icon {
        width: 50px;
        height: 50px;
        margin-bottom: 7px;
        border-radius: 14px;
    }

        .auth-brand-icon svg {
            width: 27px;
            height: 27px;
        }

    .auth-brand-title {
        font-size: 20px;
        line-height: 1.45;
    }

    .auth-brand-description {
        margin-top: 3px;
        font-size: 12px;
        line-height: 1.6;
    }

    .auth-card > .bg-white {
        padding: 18px 23px !important;
    }

    .auth-card h2 {
        margin-bottom: 4px;
        font-size: 19px;
        line-height: 1.6;
    }

    .auth-card p {
        font-size: 13px;
        line-height: 1.7;
    }

    .auth-card hr {
        margin: 9px 0 12px;
    }

    .auth-keyboard-notice {
        margin-bottom: 11px;
        padding: 8px 11px;
    }

    .auth-keyboard-notice-content strong {
        font-size: 13px;
        line-height: 1.5;
    }

    .auth-keyboard-notice-content span {
        font-size: 12px;
        line-height: 1.6;
    }

    #loginForm > * + * {
        margin-top: 10px !important;
    }

    .auth-card input[type="text"],
    .auth-card input[type="password"] {
        height: 42px;
    }

    .auth-card button[type="submit"] {
        min-height: 42px;
    }

    .auth-security-note {
        margin-top: 9px;
        font-size: 12px;
    }

    .auth-footer {
        padding: 7px 12px;
    }
}

/* Short desktop and mobile: scrolling remains available so nothing is cut off. */
@media (min-width: 768px) and (max-height: 699px) {
    .auth-main {
        padding: 16px;
    }
}

@media (max-width: 767px) {
    .auth-main {
        padding: 22px 12px;
    }

    .auth-card > .bg-white {
        padding: 21px 18px !important;
        border-radius: 14px !important;
    }

    .auth-brand-title {
        font-size: 21px;
    }

    .auth-card h2 {
        font-size: 18px;
    }

    .auth-card input[type="text"],
    .auth-card input[type="password"] {
        font-size: 16px;
    }

    .auth-card form > div:last-child {
        flex-direction: column;
        align-items: stretch;
    }

    .auth-card button[type="submit"],
    .auth-card a[href*="Otp"] {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .swal2-popup.auth-login-swal {
        padding: 22px 16px !important;
    }

        .swal2-popup.auth-login-swal .swal2-title {
            font-size: 18px !important;
        }

    .swal2-popup.auth-login-error-popup button.swal2-confirm.auth-login-error-button {
        width: 100% !important;
        min-width: 0 !important;
    }
}
