/* Shared look for the sign-in and sign-up pages. Colours match the navbar
   (/nav-bar.css). Every class is prefixed with .auth- so nothing here leaks
   into the navbar. */

:root {
    --auth-accent: #00d1b2;
    --auth-accent-dark: #0a8f7c;
    --auth-accent-soft: rgba(0, 209, 178, 0.12);
    --auth-bg: #0a0a0a;
    --auth-panel: #141414;
    --auth-field: #1d1d1d;
    --auth-line: #2c2c2c;
    --auth-text: #f2f2f2;
    --auth-muted: #a6a6a6;
    --auth-error: #ff6b6b;
    --auth-error-soft: rgba(255, 107, 107, 0.1);
}

html, body {
    margin: 0;
    padding: 0;
}

body {
    min-height: 100vh;
    background:
        radial-gradient(900px 500px at 15% 10%, rgba(0, 209, 178, 0.14), transparent 60%),
        radial-gradient(700px 500px at 90% 90%, rgba(0, 143, 124, 0.12), transparent 60%),
        var(--auth-bg);
    background-attachment: fixed;
    color: var(--auth-text);
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.auth-page {
    box-sizing: border-box;
    min-height: 100vh;
    padding: 120px 16px 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    box-sizing: border-box;
    width: 100%;
    max-width: 440px;
    padding: 40px 36px 32px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%), var(--auth-panel);
    border: 1px solid var(--auth-line);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 209, 178, 0.04);
    position: relative;
    overflow: hidden;
}

/* Thin accent strip along the top edge of the card. */
.auth-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--auth-accent), transparent);
}

.auth-card *, .auth-card *::before, .auth-card *::after {
    box-sizing: border-box;
}

.auth-head {
    text-align: center;
    margin-bottom: 28px;
}

.auth-badge {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: var(--auth-accent-soft);
    border: 1px solid rgba(0, 209, 178, 0.3);
    color: var(--auth-accent);
}

.auth-head h1 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--auth-text);
}

.auth-head p {
    margin: 0;
    color: var(--auth-muted);
    font-size: 15px;
}

/* ---------- Fields ---------- */

.auth-field {
    margin-bottom: 18px;
}

.auth-label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 7px;
}

.auth-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #d8d8d8;
}

.auth-field > label {
    margin-bottom: 7px;
}

.auth-label-row .auth-hint,
.auth-label-row a {
    margin: 0;
    font-size: 13px;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap > svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #6f6f6f;
    pointer-events: none;
    transition: color 0.15s;
}

.auth-input-wrap input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 44px;
    background: var(--auth-field);
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    color: var(--auth-text);
    font: inherit;
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.auth-input-wrap input::placeholder {
    color: #5e5e5e;
}

.auth-input-wrap input:hover {
    border-color: #3a3a3a;
}

.auth-input-wrap input:focus {
    border-color: var(--auth-accent);
    background: #202020;
    box-shadow: 0 0 0 4px var(--auth-accent-soft);
}

.auth-input-wrap:focus-within > svg {
    color: var(--auth-accent);
}

.auth-input-wrap.has-toggle input {
    padding-right: 48px;
}

/* Keep browser autofill from painting the fields yellow/white. */
.auth-input-wrap input:-webkit-autofill {
    -webkit-text-fill-color: var(--auth-text);
    -webkit-box-shadow: 0 0 0 1000px var(--auth-field) inset;
    caret-color: var(--auth-text);
}

.auth-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 8px;
    color: #8a8a8a;
    cursor: pointer;
}

.auth-eye:hover {
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.06);
}

.auth-eye:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 1px;
}

.auth-eye .eye-off { display: none; }
.auth-eye[aria-pressed="true"] .eye-on { display: none; }
.auth-eye[aria-pressed="true"] .eye-off { display: block; }

.auth-hint {
    margin-top: 6px;
    font-size: 12.5px;
    color: var(--auth-muted);
}

.auth-hint.is-bad { color: var(--auth-error); }
.auth-hint.is-good { color: var(--auth-accent); }

/* ---------- Checkbox ---------- */

.auth-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 4px 0 22px;
    font-size: 14px;
    color: #cfcfcf;
    cursor: pointer;
    user-select: none;
}

.auth-check input {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 18px;
    height: 18px;
    margin: 0;
    border: 1.5px solid #4a4a4a;
    border-radius: 5px;
    background: var(--auth-field);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.auth-check input::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #0a0a0a;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px) scale(0);
    transition: transform 0.12s;
}

.auth-check input:checked {
    background: var(--auth-accent);
    border-color: var(--auth-accent);
}

.auth-check input:checked::after {
    transform: rotate(45deg) translate(-1px, -1px) scale(1);
}

.auth-check input:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* ---------- Button ---------- */

.auth-submit {
    width: 100%;
    height: 50px;
    margin: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #12e3c3, var(--auth-accent) 45%, var(--auth-accent-dark));
    color: #04211c;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 24px rgba(0, 209, 178, 0.25);
    transition: transform 0.12s, box-shadow 0.15s, filter 0.15s;
}

.auth-submit:not([disabled]):hover {
    filter: brightness(1.06);
    box-shadow: 0 10px 30px rgba(0, 209, 178, 0.35);
    transform: translateY(-1px);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 3px;
}

.auth-submit[disabled] {
    cursor: wait;
    filter: saturate(0.6) brightness(0.9);
    transform: none;
}

.auth-spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(4, 33, 28, 0.3);
    border-top-color: #04211c;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}

.auth-submit.is-loading .auth-spinner { display: block; }

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

/* ---------- Message ---------- */

.auth-msg {
    display: none;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}

.auth-msg.is-error {
    display: block;
    color: var(--auth-error);
    background: var(--auth-error-soft);
    border: 1px solid rgba(255, 107, 107, 0.3);
}

.auth-msg.is-success {
    display: block;
    color: var(--auth-accent);
    background: var(--auth-accent-soft);
    border: 1px solid rgba(0, 209, 178, 0.3);
}

/* Neutral message (e.g. "Sending…"). */
.auth-msg.is-info {
    display: block;
    color: #d8d8d8;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-line);
}

/* Smaller second line inside a message. */
.auth-msg .auth-msg-sub {
    display: block;
    margin-top: 4px;
    color: var(--auth-muted);
    font-size: 13px;
}

/* ---------- Status pages (verify email, email actions) ---------- */

.auth-badge.is-success {
    background: var(--auth-accent-soft);
    border-color: rgba(0, 209, 178, 0.45);
    color: var(--auth-accent);
}

.auth-badge.is-error {
    background: var(--auth-error-soft);
    border-color: rgba(255, 107, 107, 0.35);
    color: var(--auth-error);
}

.auth-badge .auth-spinner {
    display: block;
    width: 24px;
    height: 24px;
    border-color: rgba(0, 209, 178, 0.25);
    border-top-color: var(--auth-accent);
}

.auth-head p strong {
    color: var(--auth-text);
    font-weight: 600;
    overflow-wrap: anywhere;
}

.auth-secondary {
    width: 100%;
    height: 46px;
    margin-top: 12px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: transparent;
    color: var(--auth-text);
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.auth-card a.auth-secondary:hover,
.auth-secondary:hover {
    border-color: var(--auth-accent);
    background: var(--auth-accent-soft);
    text-decoration: none;
}

.auth-submit[disabled].is-done {
    cursor: default;
    filter: none;
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
    box-shadow: none;
    border: 1px solid rgba(0, 209, 178, 0.35);
}

.auth-submit[disabled]:not(.is-loading):not(.is-done) {
    cursor: not-allowed;
    filter: saturate(0.3) brightness(0.65);
    box-shadow: none;
}

[hidden] { display: none !important; }

/* ---------- Google sign-in ---------- */

.auth-google {
    width: 100%;
    height: 48px;
    margin: 0;
    border: 1px solid #dadce0;
    border-radius: 12px;
    background: #fff;
    color: #1f1f1f;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: background 0.15s, box-shadow 0.15s;
}

.auth-google:not([disabled]):hover {
    background: #f2f2f2;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.auth-google:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 3px;
}

.auth-google[disabled] {
    cursor: wait;
    opacity: 0.7;
}

.auth-google .auth-spinner {
    border-color: rgba(0, 0, 0, 0.15);
    border-top-color: #1f1f1f;
}

.auth-google.is-loading .auth-spinner { display: block; }
.auth-google.is-loading .auth-google-logo { display: none; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0;
    color: #7a7a7a;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-line);
}

/* Destructive action (delete account). */
.auth-submit.is-danger {
    background: linear-gradient(135deg, #ff7a85, #ff4d5e 50%, #d93445);
    color: #fff;
    box-shadow: 0 8px 24px rgba(255, 77, 94, 0.25);
}

.auth-submit.is-danger:not([disabled]):hover {
    box-shadow: 0 10px 30px rgba(255, 77, 94, 0.35);
}

.auth-submit.is-danger .auth-spinner {
    border-color: rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
}

.auth-note.is-danger {
    background: var(--auth-error-soft);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ffd6d6;
}

.auth-note.is-danger svg { color: var(--auth-error); }

/* Small privacy note under the username field. */
.auth-note {
    display: flex;
    gap: 10px;
    margin: 0 0 22px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--auth-accent-soft);
    border: 1px solid rgba(0, 209, 178, 0.25);
    color: #cfe9e4;
    font-size: 13.5px;
    line-height: 1.45;
}

.auth-note svg {
    flex: none;
    margin-top: 1px;
    color: var(--auth-accent);
}

/* ---------- Footer ---------- */

.auth-card a {
    color: var(--auth-accent);
    text-decoration: none;
    font-weight: 600;
}

.auth-card a:hover {
    text-decoration: underline;
}

.auth-foot {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--auth-line);
    text-align: center;
    font-size: 14px;
    color: var(--auth-muted);
}

@media (max-width: 480px) {
    .auth-page { padding-top: 104px; align-items: flex-start; }
    .auth-card { padding: 32px 22px 26px; border-radius: 16px; }
    .auth-head h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-submit, .auth-check input::after { transition: none; }
    .auth-spinner { animation-duration: 2s; }
}

/* "Stay signed in" sits above both sign-in options, so it applies to each. */
.auth-check.auth-check-top {
    justify-content: center;
    margin: 0 0 16px;
}

/* "Use my Google photo" choice, with a small preview of the photo. */
.auth-photo-choice img {
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--auth-line);
}

.auth-secondary.auth-photo-choice { gap: 10px; }
.auth-secondary.auth-photo-choice img { width: 26px; height: 26px; }

/* ---------- Password requirements checklist ---------- */

.pw-rules {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px 12px;
    font-size: 12.5px;
    color: var(--auth-muted);
}

.pw-rules li {
    display: flex;
    align-items: center;
    gap: 7px;
    transition: color 0.15s;
}

.pw-rules svg { flex: none; }
.pw-rules .pw-tick { opacity: 0; transition: opacity 0.15s; }

.pw-rules li.is-met { color: var(--auth-accent); }
.pw-rules li.is-met .pw-dot { fill: currentColor; stroke: currentColor; }
.pw-rules li.is-met .pw-tick { opacity: 1; stroke: #04211c; }

.pw-rules li.is-missing { color: var(--auth-error); }

@media (max-width: 380px) {
    .pw-rules { grid-template-columns: 1fr; }
}

/* "By creating an account, you agree to..." line on the sign-up page.
   It sits below both sign-up options, so it covers Google and email. */
.auth-legal {
    margin: 20px 0 0;
    text-align: center;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--auth-muted);
}
.auth-legal a {
    color: var(--auth-text);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: rgba(0, 209, 178, 0.5);
    text-underline-offset: 2px;
}
.auth-legal a:hover { color: var(--auth-accent); }
