:root {
    --primary-color: #4c33b6;
    --secondary-color: #f5f5f5;
    --text-color: #222222;
    --background-color: #fdfdfe;
    --body-form-background-color: #797985;
    --button-background-color: var(--primary-color);
    --button-background-hover-color: #3a1d8b;
    --text-button-background-hover-color: #d0d0ec;
}


body {
    font-family: Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    font-size: 16px;
}

.user-menu {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    white-space: nowrap;
}

.user-menu__list {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.user-menu__link {
    display: block;
    border-radius: 999px;
    background-color: #ffffff;
    color: var(--primary-color);
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.user-menu__link.active {
    background-color: var(--primary-color);
    color: #ffffff;
    &:hover {
        background-color: var(--primary-color);
    }
}

.user-menu__link:hover {
    background-color: var(--text-button-background-hover-color);
    text-decoration: none;
}

body.account form.user-menu__form {
    margin: 0;
    padding: 0;
    display: inline-block;
}

@media screen and (max-width: 600px) {
    .user-menu {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
    }
}

body.home main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

body.home img.logo {
    width: 200px;
    height: auto;
}

body.home h1 {
    font-size: 2.5em;
    margin: 20px 0 10px 0;
}

body.login {
    background-color: var(--body-form-background-color);
}

body.login main,
body.setup main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 0 1rem;
}

body.account main {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: start;
    padding: 0 1rem;
    min-height: calc(100vh - 3rem);
}

body.login img.logo,
body.setup img.logo,
body.account img.logo {
    width: 120px;
    height: auto;
    margin: auto;
}


body.login form {
    max-width: 300px;
    width: 100%;
    padding: 1.5rem;
    margin: 0;
    background-color: #ffffff;
    border: 1px solid #ccc;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.login form p {
    text-align: center;
}

body.login form p.error {
    color: #9e2222;
    font-size: 0.9rem;
    margin: 10px 0;
}

body.login form .login__other-methods {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    width: 100%;
}

body.login form .login__other-methods p {
    margin: 10px 0 2px 0;
    font-size: 0.85rem;
    color: #888;
}

body.login form .login__other-methods button.text-button {
    margin: 5px 5px 0;
    font-size: 0.85rem;
}

/* Form Styles */

form {
    display: flex;
    flex-direction: column;
}

form .form-input {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;

    & label {
        font-size: 0.8rem;
    }

    input[type="text"],
    input[type="email"],
    input[type="password"] {
        padding: 10px;
        margin: 5px 0 10px 0;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 1rem;
    }

    input::placeholder {
        color: #999;
    }

    select {
        padding: 10px;
        margin: 5px 5px 10px 5px;
        border: 1px solid #ccc;
        border-radius: 4px;
        font-size: 1rem;
        appearance: none; /* Disable the default arrow */
        -webkit-appearance: none; /* For WebKit-based browsers */
        -moz-appearance: none; /* For Firefox */
        background-image: url('data:image/svg+xml;utf8,<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M6 9L12 15L18 9" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor"/></svg>');
        background-repeat: no-repeat;
        background-position: right 10px center;
        background-size: 18px;
    }
}

form .button-row {
    width: 100%;
    max-width: 300px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;

    & button {
        flex: 1;
        margin: 0 5px;
    }
}

@media screen and (max-width: 600px) {
    form .button-row {
        flex-direction: column;
    }

    form .button-row button {
        margin: 5px 0;
        width: 100%;
    }
}

form button, a.btn {
    padding: 10px;
    margin: 10px 0 0 0;
    background-color: var(--primary-color);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    width: 100%;
    max-width: 300px;

    &:hover {
        background-color: var(--button-background-hover-color);
    }

    transition: background-color 0.3s ease;

    &.text-button {
        padding: 5px;
        margin: 5px 0;
        background-color: transparent;
        color: var(--text-color);

        &:hover {
            background-color: var(--text-button-background-hover-color);
        }
    }
}

.user-menu__form .user-menu__link--button {
    width: auto;
    max-width: none;
    margin: 0;
    padding: 0.5rem 0.85rem;
    font-size: 0.9rem;
    border: none;
    background-color: #ffffff;
    color: var(--primary-color);
    border-radius: 999px;
    text-align: left;

    &:hover {
        background-color: var(--text-button-background-hover-color);
    }
}

a.btn {
    text-decoration: none;
    display: block;
    text-align: center;
}

form a.cancel {
    color: #888;
    font-size: 0.85rem;
}

form a.action {
    color: var(--primary-color);
    font-size: 1rem;
}

form a.cancel,
form a.action {
    display: inline-block;
    padding: 5px;
    margin: 10px 0 0 0;
    text-align: center;
    text-decoration: none;
}

@media screen and (max-width: 600px) {
    form a.action {
        margin: 0;
        padding: 10px;
    }
}

form a.cancel:hover,
form a.action:hover {
    text-decoration: underline;
}

form a.action svg {
    height: 1rem;
    fill: var(--primary-color);
}

form h1 {
    font-size: 1.5em;
    margin-bottom: 20px;
    text-align: center;
}

body.setup {
    background-color: var(--background-color);
}

body.setup form,
body.account form,
body.setup .complete {
    max-width: 600px;
    padding: 1.5rem;
    margin: 0;
    background-color: #ffffff;
    /*border: 1px solid #ccc;*/
    border-radius: 8px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

body.setup form p,
body.account form p,
body.setup .complete p {
    text-align: center;
}

body.setup form p.error,
body.account form p.error,
body.setup .complete p.error {
    color: #9e2222;
    font-size: 0.9rem;
    margin: 10px 0;
}

body.change-email p {
    max-width: 300px;
}

body.setup form button,
body.setup a.btn {
    max-width: 300px;
    width: 100%;
}

.codes {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 20px;
    margin: 0 auto;
    gap: 20px;
}

.codes .text-code {
    max-width: 300px;
}

.codes .text-code p {
    color: #888;
    text-align: left;
    font-size: 0.9rem;
    margin: 10px 0;
}

.codes .text-code a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

form input[type="email"]:read-only {
    background-color: #f0f0f0;
    color: #888;
    cursor: not-allowed;
}


form .form-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    width: 100%;
    gap: 5px;

    & button {
        flex: 1;
        margin: 0 5px;
    }
}

@media screen and (max-width: 600px) {
    form .form-row {
        flex-direction: column;
    }

    form .form-row .form-input {
        width: 100%;
        max-width: none;
    }

    form .form-row button {
        margin: 5px 0;
        width: 100%;
    }
}

/* Reusable checkbox row (aligned + optional large variant). */
.form-check {
    width: 100%;
    max-width: 300px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0;
}

.form-check__input {
    margin: 0;
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
    flex: 0 0 auto;
}

.form-check__label {
    margin: 0;
    line-height: 1.3;
    cursor: pointer;
}

.form-check--large .form-check__input {
    width: 1.35rem;
    height: 1.35rem;
}

.form-check--large .form-check__label {
    font-size: 1.05rem;
    font-weight: 600;
}

.form-check--center {
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
}

/* Reusable centered list for security codes/tokens. */
.token-list {
    list-style: none;
    padding: 0;
    margin: 8px auto 12px auto;
    width: fit-content;
    text-align: center;
}

.token-list li {
    margin: 2px 0;
}

.token-list--wide {
    width: 100%;
    max-width: 520px;
}

.token-list--wide li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0;
}

.token-display {
    width: 100%;
    max-width: 520px;
    background-color: #f4f0ff;
    border: 1px solid #d8cff8;
    border-radius: 6px;
    padding: 12px;
}

.token-display p {
    margin: 0;
    text-align: left;
}

a {
    color: var(--primary-color);
    text-decoration: none;

    &:hover {
        text-decoration: underline;
    }
}
