/* =========================================================
   STORKTRACK AUTHENTICATION DESIGN
   Shared by register.html and login.html
   Keeps existing HTML classes and JavaScript IDs intact.
   ========================================================= */

:root {
    --auth-ink: #172b4d;
    --auth-muted: #66758c;
    --auth-blue: #246bfd;
    --auth-blue-dark: #174acb;
    --auth-teal: #16b8a6;
    --auth-orange: #ff9b54;
    --auth-border: #e1e9f3;
    --auth-surface: #ffffff;
    --auth-background: #f4f8ff;
    --auth-shadow: 0 24px 70px rgba(31, 65, 119, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    padding: 38px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--auth-ink);
    background:
        radial-gradient(circle at 12% 12%, rgba(22, 184, 166, 0.15), transparent 28%),
        radial-gradient(circle at 88% 18%, rgba(255, 155, 84, 0.17), transparent 25%),
        radial-gradient(circle at 85% 90%, rgba(36, 107, 253, 0.13), transparent 30%),
        linear-gradient(135deg, #f7faff 0%, #eef5ff 52%, #f7fbff 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}

body::before,
body::after {
    content: "";
    position: fixed;
    z-index: 0;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(1px);
    animation: authFloat 10s ease-in-out infinite;
}

body::before {
    width: 210px;
    height: 210px;
    top: 7%;
    right: 5%;
    border: 1px solid rgba(36, 107, 253, 0.13);
    box-shadow: 0 0 0 22px rgba(36, 107, 253, 0.025), 0 0 0 44px rgba(36, 107, 253, 0.02);
}

body::after {
    width: 130px;
    height: 130px;
    bottom: 7%;
    left: 5%;
    background: linear-gradient(135deg, rgba(22, 184, 166, 0.12), rgba(36, 107, 253, 0.06));
    animation-delay: -4s;
}

a {
    color: var(--auth-blue);
    text-decoration: none;
    transition: color 180ms ease, opacity 180ms ease;
}

a:hover {
    color: var(--auth-blue-dark);
}

button,
input {
    font: inherit;
}

/* Registration and login page wrapper */
.register-container,
.login-page {
    position: relative;
    z-index: 1;
    width: min(100%, 510px);
    margin: auto;
    animation: authEnter 650ms cubic-bezier(.2, .75, .25, 1) both;
}

/* Brand header */
.brand,
.login-header {
    margin: 0 auto 22px;
    text-align: center;
}

.brand > a,
.brand a,
.login-navbar .brand,
.login-header a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    color: var(--auth-ink);
    text-decoration: none;
}

.brand img,
.login-header img,
.login-navbar img {
    display: block;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 14px;
    filter: drop-shadow(0 7px 12px rgba(36, 107, 253, 0.12));
}

.brand-name,
.brand span {
    font-size: 1.55rem;
    font-weight: 850;
    letter-spacing: -0.055em;
}

.brand-name::after,
.brand span::after {
    content: ".";
    color: var(--auth-teal);
}

/* Main form card */
.register-card,
.login-card {
    position: relative;
    overflow: hidden;
    padding: clamp(27px, 5vw, 43px);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--auth-shadow), 0 2px 7px rgba(31, 65, 119, 0.04);
    backdrop-filter: blur(16px);
}

.register-card::before,
.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 5px;
    background: linear-gradient(90deg, var(--auth-blue), var(--auth-teal), var(--auth-orange));
}

.register-card h1,
.login-card h1 {
    margin: 0 0 12px;
    color: var(--auth-ink);
    font-size: clamp(1.8rem, 4.5vw, 2.35rem);
    font-weight: 820;
    letter-spacing: -0.055em;
    line-height: 1.15;
}

.intro-text,
.login-card > p,
.login-card .intro-text {
    margin: 0 0 28px;
    color: var(--auth-muted);
    font-size: 0.98rem;
    line-height: 1.7;
}

/* Form fields */
#register-form,
#login-form {
    display: grid;
    gap: 19px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.form-group label {
    color: #31435e;
    font-size: 0.9rem;
    font-weight: 720;
}

.form-group input,
#register-form input,
#login-form input {
    width: 100%;
    min-height: 53px;
    padding: 14px 16px;
    border: 1px solid var(--auth-border);
    border-radius: 13px;
    outline: none;
    color: var(--auth-ink);
    background: #f9fbff;
    font-size: 0.96rem;
    transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

.form-group input::placeholder,
#register-form input::placeholder,
#login-form input::placeholder {
    color: #9aa8ba;
}

.form-group input:hover,
#register-form input:hover,
#login-form input:hover {
    border-color: #c2d4f2;
    background: #fff;
}

.form-group input:focus,
#register-form input:focus,
#login-form input:focus {
    border-color: var(--auth-blue);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(36, 107, 253, 0.11);
}

/* Main submit buttons */
.register-button,
.login-button,
#register-button,
#login-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 54px;
    margin-top: 5px;
    padding: 14px 20px;
    overflow: hidden;
    border: 0;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(105deg, var(--auth-blue), #367efb 58%, var(--auth-teal));
    box-shadow: 0 12px 24px rgba(36, 107, 253, 0.22);
    font-size: 0.98rem;
    font-weight: 780;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.register-button::after,
.login-button::after,
#register-button::after,
#login-button::after {
    content: "";
    position: absolute;
    top: -60%;
    left: -45%;
    width: 30%;
    height: 220%;
    transform: rotate(22deg);
    background: rgba(255, 255, 255, 0.2);
    transition: left 450ms ease;
}

.register-button:hover,
.login-button:hover,
#register-button:hover,
#login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(36, 107, 253, 0.27);
    filter: saturate(1.06);
}

.register-button:hover::after,
.login-button:hover::after,
#register-button:hover::after,
#login-button:hover::after {
    left: 125%;
}

.register-button:active,
.login-button:active,
#register-button:active,
#login-button:active {
    transform: translateY(0);
}

.register-button:disabled,
.login-button:disabled,
#register-button:disabled,
#login-button:disabled {
    opacity: 0.7;
    cursor: wait;
    transform: none;
}

/* Status messages inserted by the existing JavaScript */
#register-message,
#login-message {
    min-height: 0;
    color: var(--auth-muted);
    font-size: 0.9rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

#register-message:not(:empty),
#login-message:not(:empty) {
    padding: 12px 14px;
    border: 1px solid #dce8fb;
    border-radius: 12px;
    background: #f4f8ff;
}

#register-message:empty,
#login-message:empty {
    display: none;
}

/* Common login/register navigation links */
.login-link,
.register-link,
.forgot-password,
.login-card .login-link {
    margin-top: 23px;
    color: var(--auth-muted);
    text-align: center;
    font-size: 0.92rem;
    line-height: 1.7;
}

.login-link a,
.register-link a,
.forgot-password a {
    margin-left: 4px;
    color: var(--auth-blue);
    font-weight: 750;
}

.login-link a:hover,
.register-link a:hover,
.forgot-password a:hover {
    color: var(--auth-teal);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-text {
    margin: 22px 0 0;
    color: #8b99ad;
    font-size: 0.8rem;
    text-align: center;
}

/* Compatibility with older login page structures */
.login-navbar {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 22px;
}

.login-navbar .brand {
    margin: 0;
}

.login-page {
    width: min(100%, 510px);
}

.login-card {
    width: 100%;
}

.login-card form {
    display: grid;
    gap: 19px;
}

.login-card label {
    color: #31435e;
    font-size: 0.9rem;
    font-weight: 720;
}

.login-card input {
    width: 100%;
    min-height: 53px;
    padding: 14px 16px;
    border: 1px solid var(--auth-border);
    border-radius: 13px;
    outline: none;
    background: #f9fbff;
}

.login-card input:focus {
    border-color: var(--auth-blue);
    box-shadow: 0 0 0 4px rgba(36, 107, 253, 0.11);
}

@keyframes authEnter {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes authFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-13px) rotate(4deg); }
}

@media (max-width: 540px) {
    body {
        padding: 24px 14px;
        align-items: flex-start;
    }

    .register-container,
    .login-page {
        width: 100%;
        margin: auto;
    }

    .brand,
    .login-header {
        margin-bottom: 18px;
    }

    .brand img,
    .login-header img,
    .login-navbar img {
        width: 40px;
        height: 40px;
    }

    .brand-name,
    .brand span {
        font-size: 1.4rem;
    }

    .register-card,
    .login-card {
        padding: 27px 21px;
        border-radius: 21px;
    }

    .register-card h1,
    .login-card h1 {
        font-size: 1.85rem;
    }

    .intro-text,
    .login-card > p,
    .login-card .intro-text {
        margin-bottom: 23px;
        font-size: 0.93rem;
    }

    #register-form,
    #login-form,
    .login-card form {
        gap: 16px;
    }

    .form-group input,
    #register-form input,
    #login-form input,
    .login-card input {
        min-height: 51px;
    }

    body::before {
        width: 140px;
        height: 140px;
        right: -55px;
    }

    body::after {
        width: 90px;
        height: 90px;
        left: -35px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================================================
   LOGIN PAGE LAYOUT UPDATE
   Keep the brand/logo at the top and the login form beneath it.
   All these layout rules are scoped to login.html so the
   existing registration page layout is not unintentionally changed.
   ========================================================= */
body.login-layout {
    min-height: 100vh;
    padding: 25px clamp(16px, 4vw, 56px) 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
}

body.login-layout .login-header {
    position: relative;
    z-index: 2;
    width: min(100%, 1120px);
    margin: 0 auto 28px;
    text-align: left;
}

body.login-layout .login-navbar {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin: 0;
}

body.login-layout .login-navbar .brand {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    margin: 0;
    color: var(--auth-ink);
    font-size: 1.5rem;
    font-weight: 850;
    letter-spacing: -0.055em;
    text-decoration: none;
}

body.login-layout .login-navbar .brand img {
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    object-fit: contain;
    border-radius: 14px;
}

body.login-layout .login-navbar .brand span::after {
    content: ".";
    color: var(--auth-teal);
}

body.login-layout .home-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 17px;
    border: 1px solid rgba(36, 107, 253, 0.15);
    border-radius: 999px;
    color: #31527f;
    background: rgba(255, 255, 255, 0.78);
    font-size: 0.9rem;
    font-weight: 750;
    white-space: nowrap;
}

body.login-layout .home-link:hover {
    border-color: rgba(36, 107, 253, 0.4);
    background: #fff;
}

body.login-layout .login-page {
    width: min(100%, 620px);
    margin: 0 auto;
    flex: 0 0 auto;
}

body.login-layout .login-card {
    width: 100%;
    padding: clamp(28px, 5vw, 48px);
    border: 1px solid rgba(255, 255, 255, 0.94);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 24px 70px rgba(31, 65, 119, 0.13), 0 2px 7px rgba(31, 65, 119, 0.04);
    backdrop-filter: blur(16px);
}

body.login-layout .login-description {
    margin: 0 0 28px;
    color: var(--auth-muted);
    font-size: 1rem;
    line-height: 1.7;
}

body.login-layout .login-button span {
    margin-left: 7px;
    transition: transform 180ms ease;
}

body.login-layout .login-button:hover span {
    transform: translateX(3px);
}

body.login-layout .footer-text {
    position: relative;
    z-index: 1;
    margin: auto 0 0;
    padding-top: 24px;
}

@media (max-width: 600px) {
    body.login-layout {
        padding: 18px 14px 14px;
    }

    body.login-layout .login-header {
        margin-bottom: 22px;
    }

    body.login-layout .login-navbar .brand {
        gap: 9px;
        font-size: 1.25rem;
    }

    body.login-layout .login-navbar .brand img {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    body.login-layout .home-link {
        padding: 9px 13px;
        font-size: 0.83rem;
    }

    body.login-layout .login-card {
        padding: 28px 21px;
        border-radius: 22px;
    }

    body.login-layout .login-card h1 {
        font-size: 1.9rem;
    }
}
