/* ===================================================================
   DigestMed Auth Server – shared styles
   =================================================================== */

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

body {
    font-family: 'Source Sans Pro', system-ui, sans-serif;
    background: #fef8f0;
    color: #0a303c;
    min-height: 100vh;
}

/* ---- Page frame -------------------------------------------------- */
.auth-page {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: hidden;
}

.auth-page::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(to right, #e4e7f0 1px, transparent 1px),
        linear-gradient(to bottom, #e4e7f0 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.4;
}

.auth-page::after {
    content: "";
    position: absolute;
    top: 30%;
    left: 50%;
    width: 400px;
    height: 400px;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(244, 152, 51, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.auth-column {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 380px;
}

@media (max-width: 480px) {
    .auth-page {
        padding: 16px;
    }
}

/* ---- Brand ------------------------------------------------------- */
.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 32px;
}

.brand img {
    height: 36px;
    width: auto;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0a303c;
}

.brand-module {
    font-family: 'Open Sans', sans-serif;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #999999;
}

/* ---- Card -------------------------------------------------------- */
.card {
    background: #ffffff;
    border: 1px solid #e4e7f0;
    border-radius: 10px;
    padding: 28px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    animation: fadeIn 250ms ease both;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Typography -------------------------------------------------- */
h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #0a303c;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: #999999;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* ---- Form fields ------------------------------------------------- */
.field {
    margin-bottom: 14px;
}

label {
    display: block;
    font-family: 'Open Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: #666666;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.input-with-icon {
    position: relative;
}

.input-with-icon svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999999;
    pointer-events: none;
}

input[type=email],
input[type=password],
input[type=text] {
    width: 100%;
    height: 38px;
    padding: 0 10px;
    background: #f5f5f5;
    border: 1px solid #e4e7f0;
    border-radius: 6px;
    font-size: 13px;
    color: #0a303c;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.input-with-icon input {
    padding-left: 34px;
}

input[type=email]:focus,
input[type=password]:focus,
input[type=text]:focus {
    border-color: #f49833;
}

input::placeholder {
    color: #999999;
}

/* MFA code field overrides */
.field--code input[type=text] {
    height: auto;
    padding: 12px 14px;
    font-size: 20px;
    letter-spacing: 0.35em;
    text-align: center;
}

.field--code input::placeholder {
    color: #c9bfae;
    letter-spacing: 0.35em;
}

/* ---- Buttons ----------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    height: 38px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn--primary {
    background: #f49833;
    border-color: #f49833;
    color: #ffffff;
}

.btn--primary:hover {
    background: #e08520;
    border-color: #e08520;
}

.btn--secondary {
    background: #f5f5f5;
    border-color: #e4e7f0;
    color: #0a303c;
}

.btn--secondary:hover {
    background: #f0ebe3;
}

.btn:disabled {
    cursor: progress;
}

form > .btn--primary {
    margin-top: 4px;
}

.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* Button styled as an inline link */
.link-button {
    background: none;
    border: none;
    color: #f49833;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.link-button:hover {
    text-decoration: underline;
}

/* ---- Divider ----------------------------------------------------- */
.divider {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 18px 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #e4e7f0;
}

.external-providers {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ---- Alerts ------------------------------------------------------ */
.error {
    background: rgba(229, 62, 62, 0.1);
    border: 1px solid rgba(229, 62, 62, 0.3);
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 400;
    color: #e53e3e;
    margin-bottom: 14px;
    line-height: 1.5;
}

.error ul {
    margin: 6px 0 0 18px;
}

.error li {
    margin-bottom: 2px;
}

.info {
    background: #f1f9f0;
    border: 1px solid #bfdcba;
    border-radius: 5px;
    padding: 8px 12px;
    font-size: 13px;
    color: #2f7a24;
    margin-bottom: 14px;
    line-height: 1.5;
}

/* ---- Actions row ------------------------------------------------- */
.actions {
    margin-top: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    gap: 10px;
}

.actions form {
    margin: 0;
}

.actions--center {
    justify-content: center;
    text-align: center;
}

.actions--column {
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

/* ---- Links ------------------------------------------------------- */
a.back {
    color: #666666;
    text-decoration: none;
    font-weight: 600;
}

a.back:hover {
    color: #0a303c;
}

a.link {
    color: #f49833;
    text-decoration: none;
    font-weight: 600;
}

a.link:hover {
    text-decoration: underline;
}

.forgot-link {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
}

.forgot-link a {
    color: #f49833;
    text-decoration: none;
    font-weight: 600;
}

.forgot-link a:hover {
    text-decoration: underline;
}

/* ---- Authorization page extras ----------------------------------- */
.scope-list {
    margin: 10px 0 24px 20px;
    color: #333;
}

.scope-list li {
    margin: 6px 0;
}

.authenticator-qr {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.authenticator-qr img {
    max-width: 100%;
    height: auto;
}

.authenticator-key-label {
    font-size: 13px;
    color: #666666;
    text-align: center;
    margin-bottom: 4px;
}

.authenticator-key {
    text-align: center;
    margin-bottom: 24px;
}

.authenticator-key code {
    font-size: 15px;
    letter-spacing: 1px;
    word-break: break-all;
}
