/* =============================================
   Depctor Auth — split-screen login experience
   ============================================= */

.auth-page {
    font-family: var(--dep-font);
    background: var(--dep-bg);
    color: var(--dep-text);
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

.auth-page *,
.auth-page *::before,
.auth-page *::after {
    box-sizing: border-box;
}

/* --- Shell layout --- */
.auth-shell {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.auth-showcase {
    flex: 1 1 55%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.5rem 3rem;
    background: var(--dep-bg);
    overflow: hidden;
    border-right: 1px solid var(--dep-border);
}

.auth-panel-wrap {
    flex: 0 0 45%;
    max-width: 520px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2.5rem;
    background: var(--dep-surface);
    transition: box-shadow var(--dep-duration-slow) var(--dep-ease);
}

.auth-panel-wrap:focus-within {
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--auth-accent) 25%, transparent),
                0 0 40px color-mix(in srgb, var(--auth-accent) 8%, transparent);
}

.auth-panel {
    width: 100%;
    max-width: 400px;
    animation: authPanelIn 0.5s var(--dep-ease) both;
}

@keyframes authPanelIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Showcase brand --- */
.auth-brand {
    position: relative;
    z-index: 2;
}

.auth-brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    text-decoration: none;
    color: #fff;
}

.depctor-logo--auth {
    height: 64px;
    width: auto;
    max-width: min(220px, 70vw);
    border-radius: 10px;
}

.auth-brand-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--auth-accent) 0%, color-mix(in srgb, var(--auth-accent) 70%, #fff) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: var(--dep-bg);
    box-shadow: 0 8px 24px var(--auth-accent-glow);
}

.auth-brand-name {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
    color: #fff;
}

.auth-showcase-content {
    position: relative;
    z-index: 2;
    max-width: 420px;
    margin-top: auto;
    margin-bottom: auto;
    padding: 2rem 0;
}

.auth-showcase-tagline {
    font-size: var(--dep-text-display);
    line-height: var(--dep-text-display-lh);
    font-weight: 700;
    letter-spacing: var(--dep-tracking-tight);
    color: #fff;
    margin: 0 0 1rem;
}

.auth-showcase-desc {
    font-size: var(--dep-text-body);
    line-height: var(--dep-text-body-lh);
    color: var(--dep-text-muted);
    margin: 0 0 1.75rem;
}

.auth-showcase-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.auth-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.auth-stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.auth-stat-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--dep-text-dim);
    font-weight: 500;
}

.auth-showcase-footer {
    position: relative;
    z-index: 2;
    font-size: 0.78rem;
    color: var(--dep-text-dim);
}

.auth-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
    border: 1px solid color-mix(in srgb, var(--auth-accent) 25%, transparent);
    margin-bottom: 1.25rem;
}

/* --- Detection motif (camera grid + bounding boxes) --- */
.auth-motif {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-motif-grid {
    position: absolute;
    inset: -20%;
    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;
    transform: perspective(600px) rotateX(12deg) scale(1.1);
    transform-origin: center 80%;
    opacity: 0.6;
}

.auth-motif-glow {
    position: absolute;
    width: 60%;
    height: 50%;
    top: 30%;
    left: 20%;
    background: radial-gradient(ellipse, var(--auth-accent-glow) 0%, transparent 70%);
    opacity: 0.25;
    filter: blur(40px);
}

.auth-detection-box {
    position: absolute;
    border: 1.5px solid var(--auth-accent);
    border-radius: 4px;
    opacity: 0;
    box-shadow: 0 0 12px var(--auth-accent-glow);
}

.auth-detection-box::before {
    content: attr(data-label);
    position: absolute;
    top: -1.4em;
    left: -1px;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--dep-font-mono);
    color: var(--auth-accent);
    background: rgba(9, 9, 11, 0.85);
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    letter-spacing: 0.02em;
}

.auth-detection-box--1 {
    width: 120px;
    height: 90px;
    top: 22%;
    left: 18%;
    animation: detectionPulse 22s var(--dep-ease) infinite;
}

.auth-detection-box--2 {
    width: 80px;
    height: 110px;
    top: 45%;
    left: 55%;
    animation: detectionPulse 26s var(--dep-ease) 3s infinite;
}

.auth-detection-box--3 {
    width: 100px;
    height: 75px;
    top: 58%;
    left: 28%;
    animation: detectionPulse 24s var(--dep-ease) 6s infinite;
}

.auth-detection-box--4 {
    width: 70px;
    height: 70px;
    top: 30%;
    left: 68%;
    animation: detectionPulse 28s var(--dep-ease) 2s infinite;
}

@keyframes detectionPulse {
    0%, 100% { opacity: 0; transform: scale(0.95); }
    15%, 75% { opacity: 0.7; transform: scale(1); }
    90% { opacity: 0; transform: scale(1.02); }
}

.auth-scan-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--auth-accent), transparent);
    opacity: 0.4;
    animation: scanLine 20s linear infinite;
}

@keyframes scanLine {
    0% { top: 20%; opacity: 0; }
    10% { opacity: 0.5; }
    90% { opacity: 0.5; }
    100% { top: 75%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-detection-box,
    .auth-scan-line {
        animation: none;
        opacity: 0.35;
    }
    .auth-panel {
        animation: none;
    }
}

/* --- Panel header --- */
.auth-panel-header {
    margin-bottom: 1.75rem;
}

.auth-panel-title {
    font-size: var(--dep-text-h1);
    line-height: var(--dep-text-h1-lh);
    font-weight: 700;
    letter-spacing: var(--dep-tracking-tight);
    color: #fff;
    margin: 0 0 0.35rem;
}

.auth-panel-subtitle {
    font-size: var(--dep-text-body);
    line-height: var(--dep-text-body-lh);
    color: var(--dep-text-muted);
    margin: 0;
}

/* --- Segmented control --- */
.auth-segment {
    display: flex;
    position: relative;
    background: var(--dep-bg);
    border: 1px solid var(--dep-border);
    border-radius: var(--dep-radius-sm);
    padding: 3px;
    margin-bottom: 1.5rem;
}

.auth-segment-indicator {
    position: absolute;
    top: 3px;
    bottom: 3px;
    left: 3px;
    width: calc(50% - 3px);
    background: var(--dep-surface-2);
    border: 1px solid var(--dep-border-strong);
    border-radius: 6px;
    transition: transform var(--dep-duration-slow) var(--dep-ease);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.auth-segment--3 .auth-segment-indicator {
    width: calc(33.333% - 2px);
}

.auth-segment-btn {
    flex: 1;
    position: relative;
    z-index: 1;
    background: none;
    border: none;
    padding: 0.55rem 0.75rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--dep-text-muted);
    cursor: pointer;
    border-radius: 6px;
    transition: color var(--dep-duration) var(--dep-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.auth-segment-btn:hover {
    color: var(--dep-text);
}

.auth-segment-btn.active {
    color: #fff;
}

.auth-segment-btn:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* --- Sub tabs (mobile / google) --- */
.auth-subtabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.auth-subtab {
    flex: 1;
    background: transparent;
    border: 1px solid var(--dep-border);
    padding: 0.5rem 0.75rem;
    border-radius: var(--dep-radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--dep-text-muted);
    cursor: pointer;
    transition: all var(--dep-duration) var(--dep-ease);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

.auth-subtab:hover {
    border-color: var(--dep-border-strong);
    color: var(--dep-text);
}

.auth-subtab.active {
    border-color: color-mix(in srgb, var(--auth-accent) 40%, transparent);
    background: var(--auth-accent-soft);
    color: var(--auth-accent);
}

.auth-subtab:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* --- Forms --- */
.auth-form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--dep-text);
    margin-bottom: 0.4rem;
}

.auth-form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--dep-text-dim);
    margin-top: 0.35rem;
}

.auth-input,
.auth-select {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.85rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #fff;
    background: var(--dep-bg);
    border: 1px solid var(--dep-border);
    border-radius: var(--dep-radius-sm);
    transition: border-color var(--dep-duration), box-shadow var(--dep-duration);
}

.auth-input::placeholder {
    color: var(--dep-text-dim);
}

.auth-input:hover,
.auth-select:hover {
    border-color: var(--dep-border-strong);
}

.auth-input:focus,
.auth-select:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--auth-accent) 55%, transparent);
    box-shadow: 0 0 0 3px var(--auth-accent-soft);
}

.auth-input.is-invalid {
    border-color: var(--dep-danger);
    box-shadow: 0 0 0 3px var(--dep-danger-soft);
}

.auth-field {
    margin-bottom: 1.1rem;
}

.auth-input-group {
    display: flex;
    gap: 0.5rem;
}

.auth-input-group .auth-select {
    flex: 0 0 auto;
    max-width: 150px;
}

.auth-input-group .auth-input {
    flex: 1;
    min-width: 0;
}

/* --- Buttons --- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    width: 100%;
    min-height: 44px;
    padding: 0.6rem 1.15rem;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    border-radius: var(--dep-radius-sm);
    cursor: pointer;
    transition: all var(--dep-duration) var(--dep-ease);
}

.auth-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.auth-btn-primary {
    background: #fff;
    color: var(--dep-bg);
}

.auth-btn-primary:hover:not(:disabled) {
    background: #E4E4E7;
    transform: translateY(-1px);
}

.auth-btn-primary:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-btn-ghost {
    background: transparent;
    color: var(--dep-text-muted);
    border: none;
    width: auto;
    min-height: auto;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
}

.auth-btn-ghost:hover:not(:disabled) {
    color: #fff;
}

.auth-btn-google {
    background: var(--dep-bg);
    border: 1px solid var(--dep-border-strong);
    color: var(--dep-text);
    font-weight: 500;
}

.auth-btn-google:hover:not(:disabled) {
    border-color: color-mix(in srgb, #4285F4 50%, var(--dep-border));
    background: rgba(66, 133, 244, 0.06);
}

.auth-btn-google svg {
    flex-shrink: 0;
}

/* --- OTP --- */
.auth-otp-group {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1.25rem;
}

.auth-otp-group--4 .auth-otp-digit {
    width: 52px;
    height: 52px;
}

.auth-otp-digit {
    width: 46px;
    height: 52px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    font-family: var(--dep-font-mono);
    color: #fff;
    background: var(--dep-bg);
    border: 1.5px solid var(--dep-border);
    border-radius: var(--dep-radius-sm);
    transition: border-color var(--dep-duration), box-shadow var(--dep-duration), transform var(--dep-duration);
}

.auth-otp-digit:focus {
    outline: none;
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-accent-soft);
    transform: scale(1.04);
}

.auth-otp-digit.filled {
    border-color: color-mix(in srgb, var(--auth-accent) 50%, transparent);
}

.auth-otp-digit.success {
    border-color: var(--dep-success);
    box-shadow: 0 0 0 3px var(--dep-success-soft);
    animation: otpSuccessSweep 0.45s var(--dep-ease) both;
}

@keyframes otpSuccessSweep {
    0% {
        transform: scale(1);
        background: var(--dep-bg);
    }
    40% {
        transform: scale(1.06);
        background: rgba(52, 211, 153, 0.15);
    }
    100% {
        transform: scale(1);
        background: rgba(52, 211, 153, 0.08);
    }
}

.auth-field-error {
    display: block;
    font-size: var(--dep-text-caption);
    color: #FCA5A5;
    margin-top: 0.35rem;
    min-height: 1rem;
}

.auth-field-error:empty {
    display: none;
}

.auth-otp-hint {
    text-align: center;
    font-size: 0.82rem;
    color: var(--dep-text-muted);
    margin-bottom: 1rem;
}

.auth-otp-actions {
    text-align: center;
    margin-top: 0.75rem;
}

/* --- Alerts (inline flash) --- */
.auth-flash {
    padding: 0.65rem 0.85rem;
    border-radius: var(--dep-radius-sm);
    font-size: 0.84rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.auth-flash--danger {
    background: var(--dep-danger-soft);
    border: 1px solid rgba(248, 113, 113, 0.25);
    color: #FCA5A5;
}

.auth-flash--success {
    background: var(--dep-success-soft);
    border: 1px solid rgba(52, 211, 153, 0.25);
    color: #6EE7B7;
}

.auth-flash--warning {
    background: var(--dep-warning-soft);
    border: 1px solid rgba(251, 191, 36, 0.25);
    color: #FCD34D;
}

/* --- Toast --- */
.auth-toast-container {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
    max-width: min(360px, calc(100vw - 2rem));
}

.auth-toast {
    pointer-events: auto;
    padding: 0.75rem 1rem;
    border-radius: var(--dep-radius-sm);
    font-size: 0.84rem;
    font-weight: 500;
    box-shadow: var(--dep-shadow-lg);
    border: 1px solid var(--dep-border);
    animation: toastIn 0.3s var(--dep-ease) both;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-toast--success {
    background: var(--dep-surface-2);
    border-color: rgba(52, 211, 153, 0.3);
    color: #6EE7B7;
}

.auth-toast--danger {
    background: var(--dep-surface-2);
    border-color: rgba(248, 113, 113, 0.3);
    color: #FCA5A5;
}

.auth-toast--warning {
    background: var(--dep-surface-2);
    border-color: rgba(251, 191, 36, 0.3);
    color: #FCD34D;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(12px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* --- Trust footer --- */
.auth-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--dep-border);
    font-size: 0.75rem;
    color: var(--dep-text-dim);
}

.auth-trust i {
    color: var(--auth-accent);
    font-size: 0.85rem;
}

.auth-panel-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin-top: 1rem;
    font-size: 0.75rem;
}

.auth-panel-links a {
    color: var(--dep-text-dim);
    text-decoration: none;
    transition: color var(--dep-duration);
}

.auth-panel-links a:hover {
    color: var(--dep-text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--dep-text-dim);
    font-size: 0.75rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--dep-border);
}

.auth-section-hidden {
    display: none !important;
}

/* --- Mobile showcase band --- */
.auth-showcase-mobile {
    display: none;
}

/* --- Responsive --- */
@media (max-width: 991px) {
    .auth-shell {
        flex-direction: column;
    }

    .auth-showcase {
        flex: none;
        min-height: auto;
        padding: 1.5rem 1.25rem 2rem;
        border-right: none;
        border-bottom: 1px solid var(--dep-border);
    }

    .auth-showcase-content {
        margin: 1rem 0 0;
        padding: 0;
        max-width: none;
    }

    .auth-showcase-tagline {
        font-size: 1.35rem;
    }

    .auth-showcase-stats {
        display: none;
    }

    .auth-motif {
        opacity: 0.5;
    }

    .auth-detection-box {
        transform: scale(0.8);
    }

    .auth-panel-wrap {
        flex: 1;
        max-width: none;
        padding: 1.75rem 1.25rem 2rem;
    }
}

@media (max-width: 480px) {
    .auth-otp-digit {
        width: 40px;
        height: 46px;
        font-size: 1.1rem;
    }

    .auth-otp-group--4 .auth-otp-digit {
        width: 44px;
        height: 46px;
    }

    .auth-input-group {
        flex-direction: column;
    }

    .auth-input-group .auth-select {
        max-width: none;
    }
}
