/* TIOO Auth Pages — Modern Split Layout */

/* Override accent colors for auth pages — teal palette */
.auth-page {
    --color-accent: #349EAD;
    --color-accent-light: #45B2C1;
    --color-accent-dark: #2B8694;
}

/* ── Page & Layout ──────────────────────────── */
.auth-page {
    min-height: 100vh;
    padding: 0;
    background: var(--color-white);
}

.auth-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}

/* ── Brand Panel (left) ─────────────────────── */
.auth-brand {
    position: relative;
    background: linear-gradient(160deg, #10131f 0%, #1c232d 50%, #262e3c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    overflow: hidden;
}

.auth-brand-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.auth-brand-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.12;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-brand-logo {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.75px;
    display: inline-block;
    margin-bottom: 36px;
}

.auth-brand-logo span {
    color: var(--color-accent);
}

.auth-brand-tenant-logo {
    max-height: 48px;
    max-width: 200px;
    object-fit: contain;
    margin-bottom: 36px;
}

.auth-brand-tagline {
    font-size: 30px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    margin: 0 0 14px;
    letter-spacing: -0.5px;
}

.auth-brand-sub {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.65;
    margin: 0 0 36px;
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 36px;
}

.auth-brand-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
}

.auth-brand-feature-icon {
    width: 30px;
    height: 30px;
    background: rgba(52, 158, 173, 0.15);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auth-brand-feature-icon svg {
    width: 16px;
    height: 16px;
    color: var(--color-accent);
}

.auth-brand-social-proof {
    padding-top: 28px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-brand-social-proof p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    margin: 0;
}

/* ── Form Panel (right) ─────────────────────── */
.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--color-white);
}

/* ── Auth Card ──────────────────────────────── */
.auth-card {
    width: 100%;
    max-width: 440px;
    position: relative;
}

.auth-card-logo {
    display: none;
    text-align: center;
    margin-bottom: 32px;
}

.auth-card-logo a {
    text-decoration: none;
}

.auth-card-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--color-gray-900);
    letter-spacing: -0.5px;
}

.auth-card-logo h1 span {
    color: var(--color-accent);
}

.auth-card h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 6px;
    color: var(--color-gray-900);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--color-gray-500);
    margin: 0 0 28px;
    line-height: 1.5;
}

/* ── Enhanced Form Controls ─────────────────── */
.auth-card .form-group {
    margin-bottom: 20px;
}

.auth-card .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-gray-700);
}

.auth-card .form-control {
    padding: 12px 16px;
    font-size: 15px;
    border: 1.5px solid var(--color-gray-300);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
}

.auth-card .form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(28, 35, 45, 0.08);
}

.auth-card .form-control::placeholder {
    color: var(--color-gray-400);
}

.auth-card select.form-control {
    appearance: none;
    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='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* Full-width CTA */
.auth-card .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-lg);
    justify-content: center;
    margin-top: 4px;
}

/* Override full-width when button is inside nav-row */
.auth-nav-row .btn-primary {
    width: auto;
}

/* Centered content (confirmation/success pages) */
.auth-card-centered {
    text-align: center;
}

.auth-card-centered .auth-subtitle {
    text-align: center;
}

/* Footer links */
.auth-footer {
    text-align: center;
    margin-top: 28px;
    font-size: 14px;
    color: var(--color-gray-500);
}

.auth-footer a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast);
}

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

/* Logout (and similar) buttons that should look like inline text links.
   Used where Django 5's LogoutView requires POST but the visual should
   match a plain <a> link. */
.btn-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    cursor: pointer;
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    transition: color var(--transition-fast, 0.15s);
}
.btn-link:hover { color: var(--color-accent); }

/* Helper text */
.auth-card small {
    display: block;
    color: var(--color-gray-400);
    font-size: 12px;
    margin-top: 4px;
}

/* ── Onboarding Stepper ─────────────────────── */
.auth-stepper {
    display: flex;
    margin-bottom: 32px;
}

.auth-stepper-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Connector line */
.auth-stepper-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 13px;
    left: calc(50% + 16px);
    width: calc(100% - 32px);
    height: 2px;
    background: var(--color-gray-200);
    z-index: 0;
}

.auth-stepper-step.done:not(:last-child)::after {
    background: var(--color-success);
}

.auth-stepper-step.active:not(:last-child)::after {
    background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-gray-200) 100%);
}

.auth-stepper-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    background: var(--color-gray-100);
    color: var(--color-gray-400);
    position: relative;
    z-index: 1;
    transition: all var(--transition-base);
    border: 2px solid transparent;
}

.auth-stepper-step.active .auth-stepper-dot {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 4px rgba(28, 35, 45, 0.1);
}

.auth-stepper-step.done .auth-stepper-dot {
    background: var(--color-success);
    color: #fff;
    border-color: var(--color-success);
}

.auth-stepper-label {
    margin-top: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-gray-400);
    text-align: center;
    white-space: nowrap;
}

.auth-stepper-step.active .auth-stepper-label {
    color: var(--color-gray-900);
    font-weight: 600;
}

.auth-stepper-step.done .auth-stepper-label {
    color: var(--color-success);
}

/* ── Navigation Row ─────────────────────────── */
.auth-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px 8px 14px;
    border-radius: var(--radius-full);
    background: rgba(142, 142, 147, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 0, 0, 0.06);
    color: var(--color-gray-600);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-back-link:hover {
    background: rgba(142, 142, 147, 0.15);
    color: var(--color-gray-800);
    border-color: rgba(0, 0, 0, 0.1);
}

.auth-back-link:active {
    transform: scale(0.96);
    transition-duration: 0.1s;
}

.auth-back-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.auth-skip-link {
    color: var(--color-gray-400);
    font-size: 13px;
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.auth-skip-link:hover {
    color: var(--color-gray-600);
}

/* ── Error States ───────────────────────────── */
.auth-card .alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.auth-card .alert-error p {
    margin: 0;
    color: #991b1b;
    font-size: 14px;
    font-weight: 500;
}

.auth-card .alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-lg);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.auth-card .alert-info p {
    margin: 0;
    color: #1e40af;
    font-size: 14px;
    font-weight: 500;
}

.field-error {
    color: var(--color-error);
    font-size: 12px;
    margin-top: 4px;
    font-weight: 500;
}

/* ── Success States ─────────────────────────── */
.auth-success-icon {
    width: 64px;
    height: 64px;
    background: #ecfdf5;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.auth-success-icon svg {
    width: 28px;
    height: 28px;
    color: var(--color-success);
}

/* ── Onboarding Complete Checklist ───────────── */
.auth-checklist {
    background: var(--color-gray-50);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    margin: 24px 0;
}

.auth-checklist-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-gray-700);
    margin: 0 0 12px;
}

.auth-checklist-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-checklist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--color-gray-500);
    font-weight: 500;
}

.auth-checklist-item::before {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--color-gray-300);
    flex-shrink: 0;
}

.auth-checklist-item.done {
    color: var(--color-gray-700);
}

.auth-checklist-item.done::before {
    background: var(--color-success);
    border-color: var(--color-success);
    /* Checkmark via background image */
    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='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px;
}

/* Subdomain display */
.auth-subdomain {
    font-size: 14px;
    color: var(--color-gray-500);
    margin: -4px 0 24px;
}

.auth-subdomain strong {
    color: var(--color-primary);
    font-weight: 600;
}

/* ── Close Button (Apple glass) ────────────── */
.auth-close {
    position: fixed;
    top: 28px;
    right: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(142, 142, 147, 0.12);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(0, 0, 0, 0.08);
    box-shadow:
        0 0.5px 1px rgba(0, 0, 0, 0.04),
        0 2px 6px rgba(0, 0, 0, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    color: var(--color-gray-500);
    text-decoration: none;
}

.auth-close:hover {
    background: rgba(142, 142, 147, 0.2);
    color: var(--color-gray-700);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.06),
        0 4px 12px rgba(0, 0, 0, 0.1);
    transform: scale(1.08);
}

.auth-close:active {
    transform: scale(0.92);
    background: rgba(142, 142, 147, 0.28);
    transition-duration: 0.1s;
}

.auth-close svg {
    width: 16px;
    height: 16px;
}

/* ── Subdomain Hint ────────────────────────── */
.auth-subdomain-hint {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: var(--color-gray-400);
    line-height: 1.5;
}

.auth-subdomain-hint strong {
    color: var(--color-gray-600);
    font-weight: 600;
}

/* ── Powered by TIOO ───────────────────────── */
.auth-powered-by {
    text-align: center;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--color-gray-100);
    font-size: 12px;
    color: var(--color-gray-400);
}

.auth-powered-by a {
    color: var(--color-gray-500);
    font-weight: 600;
    text-decoration: none;
}

.auth-powered-by a:hover {
    color: var(--color-primary);
}

/* ── Responsive ─────────────────────────────── */

/* Tablet: collapse to single column */
@media (max-width: 960px) {
    .auth-layout {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        min-height: 100vh;
        padding: 20px;
        background: linear-gradient(160deg, #10131f 0%, #1c232d 50%, #262e3c 100%);
    }

    .auth-card {
        background: var(--color-white);
        border-radius: var(--radius-2xl);
        padding: 40px 36px;
        box-shadow: var(--shadow-2xl);
        max-width: 440px;
    }

    .auth-card-logo {
        display: block;
    }

    .auth-card h2 {
        text-align: center;
    }

    .auth-subtitle {
        text-align: center;
    }

    .auth-close {
        position: absolute;
        top: 14px;
        right: 14px;
        width: 36px;
        height: 36px;
        background: rgba(255, 255, 255, 0.65);
        border: 0.5px solid rgba(0, 0, 0, 0.06);
        box-shadow:
            0 1px 3px rgba(0, 0, 0, 0.08),
            0 4px 12px rgba(0, 0, 0, 0.06);
    }

    .auth-close svg {
        width: 15px;
        height: 15px;
    }

    .auth-close:hover {
        background: rgba(255, 255, 255, 0.85);
    }
}

@media (max-width: 480px) {
    .auth-panel {
        padding: 16px;
        align-items: flex-start;
        padding-top: 40px;
    }

    .auth-card {
        padding: 32px 24px;
        border-radius: var(--radius-xl);
    }

    .auth-stepper-label {
        font-size: 10px;
    }

    .auth-stepper-dot {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }

    .auth-stepper-step:not(:last-child)::after {
        top: 11px;
        left: calc(50% + 14px);
        width: calc(100% - 28px);
    }
}
