/* =========================================================
   REGISTRAR QUEUING SYSTEM
   LOGIN PAGE  (public/css/login.css)

   Replaces: the Tailwind CDN script, the inline <style> block,
   and the inline style="" on the button.
   Colors / font stack match public/css/app.css so the login
   page looks like the rest of the system.
   ========================================================= */

:root {
    /* ---- System color palette (maroon / gold / warm white) ---- */
    --color-primary: #4e0a10;
    --color-primary-dark: #3a070c;
    --color-primary-light: #640d14;
    --color-accent: #C9952A;
    --color-accent-light: #F5C842;
    --color-bg: #F7F4F0;
    --color-surface: #FFFFFF;
    --color-sidebar-bg: #4e0a10;
    --color-sidebar-text: #E8D5C4;
    --color-text: #1A1410;
    --color-muted: #7A6E67;
    --color-border: #E2D9D0;

    /* ---- Login page tokens, now mapped to the palette above ---- */
    --primary: var(--color-primary);
    --primary-dark: var(--color-primary-dark);
    --primary-light: var(--color-primary-light);

    --text-dark: var(--color-text);
    --text: var(--color-text);
    --text-light: var(--color-muted);

    --border: var(--color-border);
    --white: var(--color-surface);
    --success: #15803d;

    /* Slightly darker than app.css --danger (#dc2626) so small error
       text passes contrast on white (about 6.5:1) */
    --danger: #b91c1c;
    --danger-light: #fef2f2;

    /* Deep maroon used for the page background and branding
       (variable name kept as --navy so the rest of the code stays untouched) */
    --navy: var(--color-primary-dark);

    --radius: 12px;
    --radius-sm: 8px;
}


/* =========================================================
   RESET + BASE
   ========================================================= */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px; /* 16px inputs prevent iOS zoom-on-focus */
}

body {
    /* Same stack as the rest of the system */
    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Arial,
        sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font-family: inherit;
    font-size: inherit;
}

[hidden] {
    display: none !important;
}


/* =========================================================
   PAGE BACKGROUND + CENTERING
   The outer padding keeps the card away from the screen
   edges on small phones.
   ========================================================= */

.login-page {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;

    padding: 24px 16px;

    /* Campus photo with a dark maroon overlay on top, so the white card
       and the footer text stay easy to read. The solid color underneath
       is shown if the photo fails to load. */
    background-color: var(--navy);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.10), transparent 40%),
        linear-gradient(135deg, rgba(58, 7, 12, 0.84) 0%, rgba(100, 13, 20, 0.74) 100%),
        url("../images/tcc-campus-2.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}


/* =========================================================
   CARD
   ========================================================= */

.login-card {
    width: 100%;
    max-width: 420px;

    background: var(--white);
    border-top: 4px solid var(--color-accent); /* gold accent */
    border-radius: var(--radius);
    padding: 40px 32px 28px;

    box-shadow:
        0 20px 40px -12px rgba(15, 23, 42, 0.35),
        0 8px 16px -8px rgba(15, 23, 42, 0.20);
}


/* =========================================================
   BRANDING
   ========================================================= */

.brand-header {
    text-align: center;
    margin-bottom: 24px;
}

.brand-header img {
    display: block;
    width: 80px;
    height: 80px;
    margin: 0 auto 14px auto;
}

.brand-header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.25;
    color: var(--navy);
}

.brand-header p {
    margin-top: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.welcome {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.welcome h2 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-dark);
}

.welcome p {
    margin-top: 4px;
    font-size: 0.875rem;
    color: var(--text-light);
}


/* =========================================================
   SESSION STATUS (e.g. "password reset link sent")
   ========================================================= */

.status-message {
    margin-bottom: 16px;
    padding: 10px 12px;

    font-size: 0.875rem;
    font-weight: 500;
    color: var(--success);

    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: var(--radius-sm);
}


/* =========================================================
   FORM FIELDS
   ========================================================= */

.field {
    margin-bottom: 16px;
}

.field label {
    display: block;
    margin-bottom: 6px;

    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
}

.field input {
    display: block;
    width: 100%;
    height: 46px; /* comfortable touch target */
    padding: 0 14px;

    color: var(--text-dark);
    background: var(--white);

    border: 1px solid var(--border);
    border-radius: var(--radius-sm);

    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:hover {
    border-color: var(--color-muted);
}

.field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 149, 42, 0.35);
}

/* Error state: red border + red ring (set by .has-error in the Blade file) */
.field.has-error input {
    border-color: var(--danger);
    background: var(--danger-light);
}

.field.has-error input:focus {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.20);
}

/* Success state: green border + green check, shown just before redirecting */
.field.is-valid input {
    border-color: var(--success);
    background: #f0fdf4;
}

.field.is-valid input:focus {
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.20);
}

.field.is-valid label::after {
    /* check mark so success is not shown by color alone */
    content: " \2713";
    font-weight: 800;
    color: var(--success);
}

.field-error {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;

    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--danger);
}

.field-error::before {
    /* small "!" badge so the error is not shown by color alone */
    content: "!";
    flex: 0 0 auto;

    width: 16px;
    height: 16px;
    margin-top: 1px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    font-size: 0.6875rem;
    font-weight: 800;
    color: var(--white);
    background: var(--danger);
    border-radius: 50%;
}

.caps-hint {
    margin-top: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #b45309; /* amber, readable on white */
}


/* =========================================================
   PASSWORD SHOW / HIDE
   ========================================================= */

.password-wrap {
    position: relative;
}

.password-wrap input {
    padding-right: 48px; /* room for the eye button */
}

.toggle-password {
    position: absolute;
    top: 0;
    right: 0;

    width: 46px;
    height: 46px;

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--text-light);
    background: transparent;
    border: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
}

.toggle-password:hover {
    color: var(--text-dark);
}

.toggle-password:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

/* Only one icon is visible at a time */
.toggle-password .icon-eye-off {
    display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye {
    display: none;
}

.toggle-password[aria-pressed="true"] .icon-eye-off {
    display: block;
}


/* =========================================================
   REMEMBER ME + FORGOT PASSWORD
   ========================================================= */

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;

    margin-bottom: 20px;
}

.remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

.remember span {
    font-size: 0.875rem;
    color: var(--text);
}

.forgot-link {
    font-size: 0.875rem;
    color: var(--primary-dark);
    text-decoration: underline;
    border-radius: 4px;
}

.forgot-link:hover {
    color: var(--navy);
}

.forgot-link:focus-visible,
.remember input:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}


/* =========================================================
   SUBMIT BUTTON (+ loading state)
   ========================================================= */

.btn-login {
    width: 100%;
    height: 46px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;

    color: var(--white);
    background: var(--primary);

    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;

    transition: background-color 0.15s ease, transform 0.05s ease;
}

.btn-login:hover {
    background: var(--primary-dark);
}

.btn-login:active {
    transform: translateY(1px);
}

.btn-login:focus-visible {
    outline: 3px solid rgba(201, 149, 42, 0.60);
    outline-offset: 2px;
}

/* Green button after a successful login (JS adds .is-success) */
.btn-login.is-success,
.btn-login.is-success:hover,
.btn-login.is-success.is-loading {
    background: var(--success);
    opacity: 1;
}

/* Spinner is hidden until JS adds .is-loading to the button */
.btn-login .spinner {
    display: none;

    width: 16px;
    height: 16px;

    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: var(--white);
    border-radius: 50%;

    animation: login-spin 0.7s linear infinite;
}

.btn-login.is-loading {
    cursor: progress;
    opacity: 0.85;
}

.btn-login.is-loading .spinner {
    display: inline-block;
}

@keyframes login-spin {
    to { transform: rotate(360deg); }
}


/* =========================================================
   HELP TEXT + FOOTER
   ========================================================= */

.help-text {
    margin-top: 20px;
    padding-top: 16px;

    font-size: 0.8125rem;
    line-height: 1.5;
    text-align: center;
    color: var(--text-light);

    border-top: 1px solid var(--border);
}

.login-footer {
    font-size: 0.8125rem;
    text-align: center;
    color: var(--color-sidebar-text);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45); /* stays readable over the photo */
}


/* =========================================================
   SMALL PHONES (about 360px wide and below)
   ========================================================= */

@media (max-width: 400px) {
    .login-page {
        padding: 16px 12px;
    }

    .login-card {
        padding: 28px 20px 22px;
    }

    .brand-header h1 {
        font-size: 1.0625rem;
    }
}


/* =========================================================
   REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
    .field input,
    .btn-login {
        transition: none;
    }

    .btn-login .spinner {
        animation-duration: 1.6s;
    }
}
