/* ════════════════════════════════════════════════════════════════════
   SENERA AUTH — Identity Server pages design system
   Matches Lovable AuthPage.tsx visual language
   Fonts: Inter (body), Source Serif 4 (headings), DM Mono (labels)
   ════════════════════════════════════════════════════════════════════ */

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

/* ── Base / Body ── */
body.id-body {
    margin: 0;
    min-height: 100vh;
    background-color: hsl(38, 18%, 95%);
    background-image:
        url("data:image/svg+xml,%3Csvg width='600' height='600' viewBox='0 0 600 600' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23c4b89c' stroke-width='0.6' opacity='0.18'%3E%3Cellipse cx='300' cy='300' rx='280' ry='220'/%3E%3Cellipse cx='300' cy='300' rx='240' ry='180'/%3E%3Cellipse cx='300' cy='300' rx='200' ry='145'/%3E%3Cellipse cx='300' cy='300' rx='160' ry='110'/%3E%3Cellipse cx='300' cy='300' rx='120' ry='80'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 600px 600px;
    background-position: center top;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: hsl(210, 40%, 12%);
    -webkit-font-smoothing: antialiased;
}

/* Kill Bootstrap blue links */
.sa-wrap a,
.sa-wrap a:link,
.sa-wrap a:visited {
    color: inherit;
    text-decoration: none;
}

/* ── Shell / Centering ── */
.sa-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    position: relative;
}

/* Subtle radial glow behind card */
.sa-wrap::before {
    content: '';
    position: absolute;
    top: 0; left: 50%;
    transform: translateX(-50%);
    width: 600px; height: 400px;
    background: radial-gradient(ellipse, hsla(172, 50%, 50%, 0.08), transparent 70%);
    pointer-events: none;
}

.sa-inner {
    position: relative;
    width: 100%;
    max-width: 420px;
}

/* ── Back link ── */
.sa-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: hsl(210, 10%, 46%) !important;
    margin-bottom: 20px;
    transition: color 0.2s;
    font-weight: 500;
}
.sa-back:hover { color: hsl(210, 40%, 12%) !important; }
.sa-back svg {
    width: 14px; height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* ── Card ── */
.sa-card {
    background: hsl(40, 20%, 99%);
    border: 1px solid hsl(38, 15%, 87%);
    border-radius: 12px;
    box-shadow:
        0 1px 3px hsla(210, 40%, 12%, 0.04),
        0 8px 24px hsla(210, 40%, 12%, 0.06),
        0 20px 48px hsla(210, 40%, 12%, 0.03);
    padding: 32px 32px 28px;
}

/* ── Logo ── */
.sa-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.sa-logo img {
    height: 52px;
    width: auto;
    object-fit: contain;
}

/* ── Heading ── */
.sa-heading {
    text-align: center;
    margin-bottom: 28px;
}
.sa-title {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: hsl(210, 40%, 12%);
    margin: 0 0 6px;
    line-height: 1.2;
}
.sa-subtitle {
    font-size: 13px;
    color: hsla(210, 10%, 46%, 0.7);
    margin: 0;
    line-height: 1.5;
}

/* ── OAuth button ── */
.sa-oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 44px;
    border-radius: 8px;
    background: hsl(38, 14%, 92%);
    border: 1px solid hsl(38, 15%, 83%);
    font-size: 14px;
    font-weight: 600;
    color: hsl(210, 40%, 12%) !important;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-decoration: none !important;
    margin-bottom: 20px;
}
.sa-oauth-btn:hover {
    background: hsl(38, 14%, 88%);
    border-color: hsl(38, 15%, 78%);
    color: hsl(210, 40%, 12%) !important;
}
.sa-oauth-icon {
    width: 20px; height: 20px;
    flex-shrink: 0;
}

/* ── OR divider ── */
.sa-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}
.sa-divider::before {
    content: '';
    position: absolute;
    inset: 50% 0 auto;
    height: 1px;
    background: linear-gradient(90deg, transparent, hsl(38, 15%, 85%) 20%, hsl(38, 15%, 85%) 80%, transparent);
}
.sa-divider-label {
    position: relative;
    padding: 3px 12px;
    background: hsl(40, 20%, 99%);
    border: 1px solid hsl(38, 15%, 85%);
    border-radius: 999px;
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: hsla(210, 10%, 46%, 0.6);
}

/* ── Form fields ── */
.sa-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}
.sa-field { display: flex; flex-direction: column; gap: 6px; }

.sa-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sa-label {
    font-family: 'DM Mono', monospace;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: hsl(210, 10%, 46%);
    display: block;
}
.sa-forgot {
    font-size: 11px;
    color: hsl(172, 55%, 32%) !important;
    transition: opacity 0.15s;
    font-weight: 500;
}
.sa-forgot:hover { opacity: 0.75; }

.sa-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: hsl(38, 18%, 97%);
    border: 1px solid hsl(38, 15%, 85%);
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', system-ui, sans-serif;
    color: hsl(210, 40%, 12%);
    transition: border-color 0.15s, box-shadow 0.15s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.sa-input::placeholder { color: hsla(210, 10%, 46%, 0.45); }
.sa-input:focus {
    border-color: hsl(172, 55%, 42%);
    box-shadow: 0 0 0 3px hsla(172, 55%, 32%, 0.1);
}
.sa-input.is-invalid { border-color: hsl(18, 70%, 55%); }

.sa-error {
    font-size: 11px;
    color: hsl(18, 70%, 55%);
    margin-top: 2px;
}

/* Validation summary */
.sa-validation {
    background: hsla(18, 70%, 55%, 0.06);
    border: 1px solid hsla(18, 70%, 55%, 0.2);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 12px;
    color: hsl(18, 50%, 40%);
}
.sa-validation ul { margin: 0; padding-left: 16px; }
.sa-validation.validation-summary-valid { display: none; }

/* ── Buttons ── */
.sa-btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border-radius: 8px;
    background: hsl(172, 55%, 32%);
    border: none;
    color: #ffffff !important;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
    box-shadow: 0 2px 10px hsla(172, 55%, 32%, 0.25);
    text-decoration: none !important;
    font-family: 'Inter', system-ui, sans-serif;
}
.sa-btn-primary:hover {
    background: hsl(172, 55%, 28%);
    box-shadow: 0 4px 16px hsla(172, 55%, 32%, 0.35);
    color: #ffffff !important;
}

.sa-btn-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid hsl(38, 15%, 83%);
    color: hsl(210, 40%, 12%) !important;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none !important;
    font-family: 'Inter', system-ui, sans-serif;
}
.sa-btn-outline:hover {
    background: hsl(38, 14%, 92%);
    color: hsl(210, 40%, 12%) !important;
}

.sa-btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid hsl(38, 15%, 83%);
    color: hsl(210, 40%, 12%) !important;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none !important;
    font-family: 'Inter', system-ui, sans-serif;
}
.sa-btn-ghost:hover {
    background: hsl(38, 14%, 92%);
    color: hsl(210, 40%, 12%) !important;
}

/* ── Footer links area ── */
.sa-footer {
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.sa-footer-link {
    font-size: 13px;
    color: hsl(172, 55%, 32%) !important;
    font-weight: 500;
    transition: opacity 0.15s;
    cursor: pointer;
}
.sa-footer-link:hover { opacity: 0.75; text-decoration: none !important; }

.sa-demo-section {
    padding-top: 12px;
    border-top: 1px solid hsla(38, 15%, 87%, 0.8);
    width: 100%;
    text-align: center;
}
.sa-demo-label {
    font-size: 11px;
    color: hsla(210, 10%, 46%, 0.5);
    margin-bottom: 8px;
    display: block;
}

/* ── Check your email / success state ── */
.sa-message {
    text-align: center;
    padding: 16px 0;
}
.sa-message-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: hsla(172, 55%, 32%, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: hsl(172, 55%, 32%);
}
.sa-message-icon svg {
    width: 26px; height: 26px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Checkbox / Remember me ── */
.sa-check-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.sa-check-row input[type="checkbox"] {
    width: 15px; height: 15px;
    accent-color: hsl(172, 55%, 32%);
    cursor: pointer;
    flex-shrink: 0;
}
.sa-check-row label {
    font-size: 13px;
    color: hsl(210, 10%, 46%);
    cursor: pointer;
    margin: 0;
}

/* ── Select input ── */
select.sa-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237a8394' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
    cursor: pointer;
}

/* ── Legal text ── */
.sa-legal {
    font-size: 11px;
    color: hsla(210, 10%, 46%, 0.55);
    text-align: center;
    line-height: 1.5;
    margin-top: 4px;
}
.sa-legal a {
    color: hsl(172, 55%, 32%) !important;
}

/* ── Terms footer ── */
.sa-terms {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 11px;
    color: hsla(210, 10%, 46%, 0.4);
    font-family: 'DM Mono', monospace;
}
.sa-terms a { color: hsla(210, 10%, 46%, 0.4) !important; transition: color 0.15s; }
.sa-terms a:hover { color: hsl(172, 55%, 32%) !important; }

/* ── Password toggle ── */
.sa-pw-wrap { position: relative; }
.sa-pw-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: hsl(210, 10%, 50%);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    z-index: 5;
}
.sa-pw-toggle:hover { color: hsl(210, 10%, 75%); }
.sa-pw-toggle:focus { outline: none; }

/* ── Responsive ── */
@media (max-width: 480px) {
    .sa-card { padding: 24px 20px 20px; border-radius: 10px; }
}
