/**
 * Super Admin Login — enterprise layout (scoped to body.super-login-page only)
 */

:root {
    --sa-indigo: #4f46e5;
    --sa-indigo-hover: #4338ca;
    --sa-violet: #6366f1;
    --sa-text: #0f172a;
    --sa-muted: #64748b;
    --sa-border: #e2e8f0;
    --sa-surface: #f8fafc;
    --sa-dark: #0f172a;
    --sa-dark-mid: #1e293b;
    --sa-radius: 10px;
    --sa-font: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
}

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

body.super-login-page {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sa-font);
    color: var(--sa-text);
    background: var(--sa-surface);
    -webkit-font-smoothing: antialiased;
}

.sa-login {
    display: flex;
    min-height: 100vh;
}

/* ── Brand panel ─────────────────────────────────────── */

.sa-login__brand {
    display: none;
    flex: 1;
    position: relative;
    background: linear-gradient(160deg, var(--sa-dark) 0%, var(--sa-dark-mid) 100%);
    color: #fff;
    overflow: hidden;
}

@media (min-width: 1024px) {
    .sa-login__brand {
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 48px;
    }
}

.sa-login__brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.sa-login__brand::after {
    content: '';
    position: absolute;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.12) 0%, transparent 70%);
    top: -120px;
    right: -100px;
    pointer-events: none;
}

.sa-login__brand-inner {
    position: relative;
    z-index: 1;
    max-width: 400px;
    width: 100%;
}

.sa-login__logo {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    color: #fff;
    margin-bottom: 48px;
}

.sa-login__logo img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 6px 18px rgba(76, 29, 149, 0.35);
}

.sa-login__logo span {
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.sa-login__brand h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin: 0 0 14px;
}

.sa-login__brand > .sa-login__brand-inner > p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 36px;
}

.sa-login__points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sa-login__points li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.5;
}

.sa-login__points li svg {
    width: 18px;
    height: 18px;
    stroke: var(--sa-violet);
    flex-shrink: 0;
    margin-top: 2px;
}

.sa-login__brand-copy {
    margin-top: 48px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ── Right panel — original white layout ─────────────── */

.login-panel {
    flex: 1;
    max-width: 560px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
    background: #fff;
    position: relative;
}

@media (min-width: 1024px) {
    .login-panel {
        max-width: 560px;
        min-width: 480px;
    }
}

@media (max-width: 1023px) {
    .login-panel {
        max-width: 100%;
        flex: 1;
        background: var(--sa-surface);
        padding: 2rem 1.5rem 2.5rem;
        justify-content: flex-start;
        padding-top: 2.5rem;
    }

    .login-form-wrapper {
        max-width: 400px;
    }

    .brand-logo {
        justify-content: center;
        width: 100%;
        margin-bottom: 2rem;
    }

    .brand-logo .logo-icon img {
        height: 44px;
        width: 44px;
        object-fit: cover;
    }

    .brand-logo span {
        font-size: 1.4rem;
    }

    .form-heading {
        text-align: center;
    }

    .form-heading h1 {
        font-size: 1.5rem;
    }

    .form-heading p {
        font-size: 0.9rem;
    }
}

.login-form-wrapper {
    width: 100%;
    max-width: 380px;
    animation: saFadeUp 0.5s ease-out;
}

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

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    margin-bottom: 2.75rem;
}

.brand-logo .logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.brand-logo .logo-icon img {
    height: 40px;
    width: auto;
    object-fit: contain;
    border-radius: 10px;
}

.brand-logo span {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--sa-text);
    letter-spacing: -0.02em;
}

.brand-logo__erp {
    font-weight: 600;
    font-size: 0.82em;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--sa-muted);
    margin-left: 3px;
}

.form-heading h1 {
    font-size: 1.65rem;
    font-weight: 800;
    color: var(--sa-text);
    letter-spacing: -0.02em;
    margin-bottom: 0.45rem;
}

.form-heading p {
    color: var(--sa-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* ── Alerts ──────────────────────────────────────────── */

.login-alert {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--sa-radius);
    padding: 0.85rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.login-alert svg {
    width: 18px;
    height: 18px;
    stroke: #dc2626;
    flex-shrink: 0;
    margin-top: 1px;
}

.login-alert span {
    color: #991b1b;
    font-size: 0.88rem;
    font-weight: 500;
    line-height: 1.45;
}

.login-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.login-alert-success svg { stroke: #16a34a; }
.login-alert-success span { color: #166534; }

/* ── Form fields ─────────────────────────────────────── */

.form-group { margin-bottom: 1.25rem; }

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--sa-text);
    margin-bottom: 0.45rem;
}

.input-wrapper { position: relative; }

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--sa-muted);
    pointer-events: none;
    transition: stroke 0.2s;
}

[dir="rtl"] .input-wrapper .input-icon {
    left: auto;
    right: 14px;
}

.input-wrapper input {
    width: 100%;
    padding: 0.72rem 0.9rem 0.72rem 2.65rem;
    border: 1.5px solid var(--sa-border);
    border-radius: var(--sa-radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--sa-text);
    background: #fff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

[dir="rtl"] .input-wrapper input {
    padding: 0.72rem 2.65rem 0.72rem 0.9rem;
}

.input-wrapper input::placeholder { color: #94a3b8; }

.input-wrapper input:focus {
    border-color: var(--sa-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.input-wrapper input:focus ~ .input-icon { stroke: var(--sa-indigo); }

.input-wrapper input.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

[dir="rtl"] .toggle-password {
    right: auto;
    left: 12px;
}

.toggle-password svg {
    width: 18px;
    height: 18px;
    stroke: var(--sa-muted);
    transition: stroke 0.2s;
}

.toggle-password:hover svg { stroke: var(--sa-indigo); }

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.remember-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1.5px solid var(--sa-border);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    position: relative;
    transition: all 0.15s;
}

.remember-check input[type="checkbox"]:checked {
    background: var(--sa-indigo);
    border-color: var(--sa-indigo);
}

.remember-check input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4.5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.remember-check span {
    font-size: 0.875rem;
    color: var(--sa-muted);
    font-weight: 500;
    user-select: none;
}

.forgot-link {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--sa-indigo);
    text-decoration: none;
    transition: color 0.2s;
}

.forgot-link:hover {
    color: var(--sa-indigo-hover);
    text-decoration: underline;
}

/* ── Submit — matches installation wizard Continue ───── */

.btn-login {
    width: 100%;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--sa-violet), #7c3aed);
    border: none;
    border-radius: var(--sa-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--sa-indigo-hover), #6d28d9);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(99, 102, 241, 0.35);
}

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

.btn-login svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-login .spinner {
    display: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: saSpin 0.6s linear infinite;
}

.btn-login.is-loading .btn-text,
.btn-login.is-loading .btn-arrow { display: none; }
.btn-login.is-loading .spinner { display: block; }

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

/* ── Divider & footer ────────────────────────────────── */

.divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.75rem 0;
}

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

.divider span {
    font-size: 0.8rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.back-home {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--sa-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1rem;
    border-radius: var(--sa-radius);
    border: 1.5px solid var(--sa-border);
    transition: all 0.2s;
    width: 100%;
}

.back-home svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    transition: transform 0.2s;
}

.back-home:hover {
    color: var(--sa-indigo);
    border-color: #c7d2fe;
    background: rgba(99, 102, 241, 0.04);
}

.back-home:hover svg { transform: translateX(-3px); }

.login-footer {
    margin-top: 3rem;
    text-align: center;
    color: #94a3b8;
    font-size: 0.8rem;
}

@media (max-width: 480px) {
    .form-options { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Register / create tenant ────────────────────────── */

.login-panel--wide {
    max-width: 600px;
    overflow-y: auto;
}

@media (min-width: 1024px) {
    .login-panel--wide {
        max-width: 600px;
        min-width: 520px;
    }
}

.login-form-wrapper--wide {
    max-width: 420px;
}

.login-alert-list {
    flex: 1;
    font-size: 0.88rem;
    color: #991b1b;
    font-weight: 500;
    line-height: 1.45;
}

.login-alert-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.steps-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.steps-bar .step-dot {
    flex: 1;
    height: 4px;
    border-radius: 4px;
    background: var(--sa-border);
}

.steps-bar .step-dot.active {
    background: linear-gradient(135deg, var(--sa-violet), #7c3aed);
}

.input-wrapper select {
    width: 100%;
    padding: 0.72rem 2.5rem 0.72rem 2.65rem;
    border: 1.5px solid var(--sa-border);
    border-radius: var(--sa-radius);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--sa-text);
    background: #fff;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' 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;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrapper select:focus {
    border-color: var(--sa-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.input-wrapper select:focus ~ .input-icon { stroke: var(--sa-indigo); }

.input-wrapper select.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.field-hint {
    font-size: 0.8rem;
    color: var(--sa-muted);
    margin-top: 0.35rem;
    line-height: 1.45;
}

.field-error {
    font-size: 0.82rem;
    color: #dc2626;
    margin-top: 0.35rem;
    font-weight: 500;
}

.subdomain-preview {
    display: flex;
    align-items: center;
    position: relative;
    border: 1.5px solid var(--sa-border);
    border-radius: var(--sa-radius);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.subdomain-preview:focus-within {
    border-color: var(--sa-indigo);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.subdomain-preview:focus-within .input-icon { stroke: var(--sa-indigo); }

.subdomain-preview.is-invalid {
    border-color: #f87171;
    box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.1);
}

.subdomain-preview .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    stroke: var(--sa-muted);
    pointer-events: none;
}

.subdomain-preview input {
    flex: 1;
    border: none;
    padding: 0.72rem 0.5rem 0.72rem 2.65rem;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--sa-text);
    background: transparent;
    outline: none;
    min-width: 0;
}

.subdomain-suffix {
    padding: 0.72rem 0.85rem;
    background: var(--sa-surface);
    color: var(--sa-muted);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    border-left: 1px solid var(--sa-border);
    user-select: none;
}

.form-row {
    display: flex;
    gap: 0.85rem;
}

.form-row .form-group { flex: 1; }

@media (max-width: 480px) {
    .form-row { flex-direction: column; gap: 0; }
}

.cycle-group { display: none; }
.cycle-group.visible { display: block; }

.cycle-options {
    display: flex;
    gap: 0.65rem;
}

.cycle-option {
    flex: 1;
    position: relative;
}

.cycle-option input { display: none; }

.cycle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    border: 1.5px solid var(--sa-border);
    border-radius: var(--sa-radius);
    padding: 0.75rem 0.5rem;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.cycle-card:hover { border-color: #cbd5e1; }

.cycle-option input:checked + .cycle-card {
    border-color: var(--sa-indigo);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.cycle-card .cycle-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--sa-text);
}

.cycle-card .cycle-price {
    font-size: 0.78rem;
    color: var(--sa-muted);
    font-weight: 500;
}

.password-requirements {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
}

.password-requirements p {
    font-size: 0.78rem;
    color: var(--sa-muted);
    margin: 0;
    font-weight: 500;
}

.login-form-wrapper--wide .back-home {
    margin-top: 1.5rem;
}

.login-form-wrapper--wide .btn-login {
    margin-top: 0.5rem;
}

.sa-login__brand-inner > h2 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.25;
    margin: 0 0 14px;
}

.sa-login__brand-inner > p {
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.65);
    margin: 0 0 36px;
}

