/* ====================================================
   GuardIA by Karasena — Keycloak Login Theme
   ==================================================== */

/* ===== Neo Sans Std — @font-face ===== */
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Light.otf') format('opentype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Italic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Medium.otf') format('opentype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-MediumItalic.otf') format('opentype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-BoldItalic.otf') format('opentype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'Neo Sans Std';
    src: url('../fonts/NeoSansStd-Black.otf') format('opentype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --brand-purple-darkest: #3a1c3f;
    --brand-purple-dark: #4a2550;
    --brand-purple: #5C2E63;
    --brand-purple-light: #7a3482;
    --brand-purple-soft: #c48bcc;
    --brand-purple-50: #f9f0fa;
    --accent-magenta: #D30A69;
    --accent-salmon: #FA8664;
    --gradient-primary: linear-gradient(135deg, #FA8664 0%, #D30A69 50%, #5C2E63 100%);
    --gradient-bg: linear-gradient(135deg, #fafafe 0%, #f5f0fa 50%, #fdf4f7 100%);

    --neutral-0: #ffffff;
    --neutral-25: #fcfcfd;
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;

    --error: #D30A69;
    --error-bg: #fef2f5;
    --success: #4DB282;
    --success-bg: #edf7f1;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Neo Sans Std', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--neutral-800);
    background: var(--gradient-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Decorative background blobs */
.bg-decoration {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
}

.circle-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-salmon) 0%, transparent 70%);
    top: -200px;
    left: -150px;
}

.circle-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-magenta) 0%, transparent 70%);
    bottom: -300px;
    right: -200px;
    opacity: 0.3;
}

.circle-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--brand-purple) 0%, transparent 70%);
    top: 50%;
    left: 60%;
    opacity: 0.2;
}

/* Login layout */
.login-wrapper {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 20px 40px;
    gap: 16px;
}

.login-card {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    box-shadow:
        0 25px 60px -12px rgba(92, 46, 99, 0.15),
        0 4px 12px -2px rgba(92, 46, 99, 0.06),
        0 1px 0 rgba(255, 255, 255, 0.9) inset;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: fadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header */
.login-header {
    padding: 40px 40px 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 40px;
    right: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-magenta), var(--accent-salmon), transparent);
    opacity: 0.4;
}

.logo {
    height: 42px;
    width: auto;
    object-fit: contain;
    opacity: 0.95;
}

/* Body */
.login-body {
    padding: 28px 40px 32px;
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neutral-900);
    text-align: center;
    letter-spacing: -0.01em;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.8125rem;
    color: var(--neutral-500);
    text-align: center;
    margin-bottom: 24px;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 18px;
    font-size: 0.8125rem;
    line-height: 1.4;
    border: 1px solid;
}

.alert-error {
    background: var(--error-bg);
    border-color: rgba(211, 10, 105, 0.2);
    color: #8a1248;
}

.alert-success {
    background: var(--success-bg);
    border-color: rgba(77, 178, 130, 0.3);
    color: #1f6e4a;
}

.alert-warning,
.alert-info {
    background: var(--warning-bg);
    border-color: rgba(245, 158, 11, 0.3);
    color: #92400e;
}

.alert-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-weight: 700;
    font-size: 11px;
    background: currentColor;
    color: white;
    opacity: 0.9;
}

.alert-error .alert-icon { background: var(--accent-magenta); color: white; }

/* Form */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.label-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--neutral-700);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--neutral-600);
    cursor: pointer;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-purple);
    cursor: pointer;
}

.forgot-link {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--brand-purple);
    text-decoration: none;
    transition: color 0.15s;
}

.forgot-link:hover {
    color: var(--accent-magenta);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--neutral-200);
    border-radius: var(--radius-sm);
    font-size: 0.9375rem;
    background: var(--neutral-0);
    color: var(--neutral-800);
    transition: all 0.15s ease;
    font-family: inherit;
    outline: none;
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
    color: var(--neutral-300);
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: var(--accent-magenta);
    box-shadow: 0 0 0 3px rgba(211, 10, 105, 0.12);
    background: var(--neutral-0);
}

input[type="text"]:hover:not(:focus),
input[type="email"]:hover:not(:focus),
input[type="password"]:hover:not(:focus) {
    border-color: var(--neutral-300);
}

input[aria-invalid="true"] {
    border-color: var(--error);
    background: var(--error-bg);
}

.field-error {
    font-size: 0.75rem;
    color: var(--error);
    font-weight: 500;
    margin-top: 2px;
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 44px;
}

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--neutral-400);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.password-toggle:hover {
    color: var(--brand-purple);
    background: var(--brand-purple-50);
}

.remember-row {
    flex-direction: row;
    margin-top: -4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    text-decoration: none;
    letter-spacing: 0.01em;
    line-height: 1.2;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    color: white;
    box-shadow:
        0 4px 14px -2px rgba(211, 10, 105, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    margin-top: 6px;
    padding: 13px 20px;
    font-size: 0.9375rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow:
        0 8px 20px -4px rgba(211, 10, 105, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    background-position: 100% 100%;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-social {
    background: white;
    color: var(--neutral-700);
    border: 1.5px solid var(--neutral-200);
    font-weight: 500;
    font-size: 0.875rem;
}

.btn-social:hover {
    background: var(--neutral-25);
    border-color: var(--neutral-300);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.06);
}

.social-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.social-icon-fallback {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--gradient-primary);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 22px 0 14px;
    color: var(--neutral-400);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--neutral-200);
}

.social-providers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Footer */
.login-footer {
    padding: 18px 40px 24px;
    text-align: center;
    background: var(--neutral-50);
    font-size: 0.875rem;
    color: var(--neutral-500);
    border-top: 1px solid var(--neutral-100);
}

.login-footer a {
    color: var(--brand-purple);
    text-decoration: none;
    font-weight: 600;
    margin-left: 4px;
    transition: color 0.15s;
}

.login-footer a:hover {
    color: var(--accent-magenta);
}

.page-credit {
    font-size: 0.6875rem;
    color: var(--neutral-400);
    letter-spacing: 0.04em;
    text-align: center;
    margin-top: 8px;
}

/* ====================================================
   Secondary buttons / link buttons
   ==================================================== */
.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 10px;
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: var(--brand-purple);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: background 0.2s ease, color 0.2s ease;
}
.btn-link:hover {
    background: var(--brand-purple-50);
    color: var(--accent-magenta);
}

.other-options-toggle {
    margin-top: 14px;
}

.other-options-block {
    margin-top: 14px;
}

.other-options-block.is-hidden {
    display: none;
}

.login-footer-inline {
    margin-top: 14px;
    padding: 16px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--neutral-100);
}

/* ====================================================
   Info / error / verify pages
   ==================================================== */
.info-content,
.error-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
    text-align: center;
}
.info-content .login-subtitle,
.error-content .login-subtitle {
    text-align: center;
    margin: 0;
}
.login-info {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--neutral-200);
    font-size: 0.875rem;
    color: var(--neutral-600);
    text-align: center;
}

/* ====================================================
   TOTP setup
   ==================================================== */
.totp-setup {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.totp-instructions {
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    color: var(--neutral-700);
    font-size: 0.9375rem;
}
.totp-instructions li {
    line-height: 1.55;
}
.totp-instructions p {
    margin-bottom: 8px;
}
.totp-app-list,
.totp-config-list {
    list-style: disc;
    padding-left: 20px;
    margin-top: 6px;
    color: var(--neutral-600);
    font-size: 0.875rem;
}
.totp-secret {
    margin: 8px 0;
    text-align: center;
}
.totp-secret code {
    display: inline-block;
    padding: 8px 14px;
    background: var(--brand-purple-50);
    color: var(--brand-purple-darkest);
    border-radius: var(--radius-sm);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    word-break: break-all;
}
.totp-qr {
    display: block;
    margin: 12px auto;
    width: 180px;
    height: 180px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
}

/* ====================================================
   Terms
   ==================================================== */
.terms-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.terms-text {
    max-height: 280px;
    overflow-y: auto;
    padding: 16px 18px;
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    line-height: 1.6;
    color: var(--neutral-700);
}
.terms-text::-webkit-scrollbar {
    width: 8px;
}
.terms-text::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 4px;
}

/* Responsive */
@media (max-width: 480px) {
    .login-wrapper {
        padding: 16px 12px 32px;
    }
    .login-card {
        border-radius: var(--radius-lg);
    }
    .login-header {
        padding: 28px 24px 20px;
    }
    .login-header::after {
        left: 24px;
        right: 24px;
    }
    .login-body {
        padding: 24px 24px 28px;
    }
    .login-footer {
        padding: 16px 24px 20px;
    }
    .totp-qr {
        width: 160px;
        height: 160px;
    }
}
