/* ===== Echo Auth — Original premium layout ===== */

.auth-honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.auth-page {
    --echo-bg: #07070d;
    --echo-surface: rgba(16, 16, 24, 0.72);
    --echo-border: rgba(255, 255, 255, 0.08);
    --echo-text: #f4f4f8;
    --echo-muted: #9494a8;
    --echo-accent: #818cf8;
    --echo-glow: rgba(129, 140, 248, 0.35);

    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    background: var(--echo-bg);
    color: var(--echo-text);
    font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif;
}

/* Aurora background */
.auth-aurora {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.aurora {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.55;
    animation: echoAurora 20s ease-in-out infinite;
}

.aurora-1 {
    width: 55vw;
    height: 55vw;
    max-width: 600px;
    max-height: 600px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.5) 0%, transparent 70%);
    top: -15%;
    right: -10%;
}

.aurora-2 {
    width: 45vw;
    height: 45vw;
    max-width: 500px;
    max-height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.45) 0%, transparent 70%);
    bottom: -10%;
    left: -8%;
    animation-delay: -7s;
}

.aurora-3 {
    width: 35vw;
    height: 35vw;
    max-width: 400px;
    max-height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.35) 0%, transparent 70%);
    top: 40%;
    left: 30%;
    animation-delay: -14s;
}

.auth-noise {
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes echoAurora {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-20px, 25px) scale(0.95); }
}

/* Shell — split layout */
.auth-shell {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 1280px;
    margin: 0 auto;
}

/* Hero side */
.auth-hero {
    position: relative;
    display: flex;
    align-items: center;
    padding: 48px 56px;
    overflow: hidden;
}

.auth-hero-content {
    position: relative;
    z-index: 2;
    max-width: 440px;
    animation: echoFadeUp 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.auth-brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 32px;
}

.auth-brand-mark img {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.auth-brand-mark span {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e879f9 0%, #818cf8 50%, #67e8f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-hero-title {
    font-size: clamp(2rem, 4vw, 2.75rem);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 16px;
    background: linear-gradient(180deg, #fff 30%, rgba(255,255,255,0.65) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-hero-desc {
    font-size: 1.05rem;
    color: var(--echo-muted);
    line-height: 1.7;
    margin-bottom: 0;
}

/* Hero copy — desktop only */
.auth-hero-copy {
    display: none;
}

.auth-hero-ring {
    position: absolute;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    border: 1px solid rgba(129, 140, 248, 0.12);
    top: 50%;
    right: -80px;
    transform: translateY(-50%);
    animation: echoRingSpin 40s linear infinite;
}

.auth-hero-ring::before {
    content: '';
    position: absolute;
    inset: 40px;
    border-radius: 50%;
    border: 1px dashed rgba(168, 85, 247, 0.15);
}

@keyframes echoRingSpin {
    to { transform: translateY(-50%) rotate(360deg); }
}

/* Form panel */
.auth-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 40px 24px;
    padding-top: max(32px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 32px;
    background: var(--echo-surface);
    border: 1px solid var(--echo-border);
    border-radius: 20px;
    backdrop-filter: blur(24px);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.03) inset,
        0 24px 48px rgba(0, 0, 0, 0.4);
    animation: echoFadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 21px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(168,85,247,0.4), rgba(99,102,241,0.2), rgba(6,182,212,0.3));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    opacity: 0.6;
}

@keyframes echoFadeUp {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tabs */
.auth-tabs {
    position: relative;
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 12px;
    padding: 4px;
    margin-bottom: 28px;
}

.auth-tab {
    flex: 1;
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 11px 16px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--echo-muted);
    border-radius: 9px;
    transition: color 0.25s ease;
}

.auth-tab.is-active {
    color: var(--echo-text);
}

.auth-tab-indicator {
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: calc(50% - 4px);
    background: rgba(129, 140, 248, 0.2);
    border: 1px solid rgba(129, 140, 248, 0.3);
    border-radius: 9px;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.auth-tab-indicator[data-mode="login"] {
    right: 4px;
    transform: translateX(0);
}

.auth-tab-indicator[data-mode="register"] {
    right: 4px;
    transform: translateX(-100%);
}

/* Card header */
.auth-card-head {
    margin-bottom: 24px;
}

.auth-card-head h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.auth-card-head p {
    font-size: 0.875rem;
    color: var(--echo-muted);
}

/* Register steps */
.auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 28px;
}

.auth-step {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--echo-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.08);
    transition: all 0.35s ease;
}

.auth-step.is-active {
    color: #fff;
    background: linear-gradient(135deg, #a855f7, #6366f1);
    border-color: transparent;
    box-shadow: 0 4px 16px var(--echo-glow);
    transform: scale(1.08);
}

.auth-step.is-done {
    color: #c4b5fd;
    border-color: rgba(129, 140, 248, 0.4);
    background: rgba(129, 140, 248, 0.12);
}

.auth-step-line {
    width: 48px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.35s ease;
}

.auth-step-line.is-done {
    background: linear-gradient(90deg, #6366f1, #a855f7);
}

/* Form fields */
.auth-form {
    display: flex;
    flex-direction: column;
}

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 8px;
}

.auth-input {
    position: relative;
}

.auth-input input {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1.5px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    color: var(--echo-text);
    font-size: 0.9375rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.auth-input input::placeholder {
    color: rgba(148, 148, 168, 0.6);
}

.auth-input input:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(0, 0, 0, 0.5);
}

.auth-input input:focus {
    outline: none;
    border-color: rgba(129, 140, 248, 0.6);
    box-shadow: 0 0 0 4px rgba(129, 140, 248, 0.12);
    background: rgba(0, 0, 0, 0.55);
}

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--echo-muted);
    pointer-events: none;
    transition: color 0.2s ease;
}

.auth-input input:focus ~ .auth-input-icon {
    color: var(--echo-accent);
}

.auth-input .toggle-password {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--echo-muted);
    border-radius: 8px;
    transition: color 0.2s ease, background 0.2s ease;
}

.auth-input .toggle-password:hover {
    color: var(--echo-text);
    background: rgba(255, 255, 255, 0.06);
}

.auth-input .toggle-password svg {
    width: 18px;
    height: 18px;
}

.field-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--echo-muted);
}

/* Button */
.auth-btn {
    position: relative;
    width: 100%;
    padding: 14px 20px;
    margin-top: 6px;
    background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #818cf8 100%);
    background-size: 200% 100%;
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-position 0.4s ease;
}

.auth-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(99, 102, 241, 0.45);
    background-position: 100% 0;
}

.auth-btn:active:not(:disabled) {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.auth-btn .btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: echoSpin 0.7s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    margin: -10px 0 0 -10px;
}

.auth-btn.loading .btn-text { opacity: 0; }
.auth-btn.loading .btn-loader { display: block !important; }

@keyframes echoSpin {
    to { transform: rotate(360deg); }
}

.auth-link-btn {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 8px;
    background: none;
    border: none;
    color: var(--echo-muted);
    font-size: 0.85rem;
    cursor: pointer;
    text-align: center;
}

.auth-link-btn:hover {
    color: var(--echo-accent);
}

/* 2FA login — dark, compact cells */
.auth-2fa-form {
    text-align: center;
}

.auth-2fa-icon {
    width: 44px;
    height: 44px;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    color: #a1a1aa;
}

.auth-2fa-icon svg {
    width: 22px;
    height: 22px;
}

.auth-2fa-label {
    margin: 0 0 4px;
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #71717a;
}

.auth-2fa-code-field {
    margin: 16px 0 4px;
}

.auth-2fa-cells.twofa-code-row {
    margin: 0 auto;
}

.auth-2fa-form .twofa-code-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    direction: ltr;
}

.auth-2fa-form .twofa-code-cell {
    width: 36px;
    height: 42px;
    padding: 0;
    font-size: 1.1rem;
    font-weight: 600;
    text-align: center;
    color: var(--echo-text);
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    outline: none;
}

.auth-2fa-form .twofa-code-cell:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.55);
}

.auth-btn-outline {
    background: transparent;
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    box-shadow: none;
    color: var(--echo-text);
    font-weight: 600;
}

.auth-btn-outline:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: none;
    transform: none;
}

.auth-step-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.auth-step-actions .auth-btn {
    flex: 1;
    margin-top: 0;
}

/* Register panels */
.register-step-panel {
    display: none;
}

.register-step-panel.active {
    display: block;
    animation: echoPanelIn 0.35s ease both;
}

@keyframes echoPanelIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Password strength */
.password-strength {
    margin: -6px 0 16px;
}

.strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.strength-fill {
    height: 100%;
    width: 0;
    border-radius: 2px;
    transition: width 0.35s ease, background 0.35s ease;
}

.strength-text {
    font-size: 0.75rem;
    color: var(--echo-muted);
}

/* Notice */
.auth-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px;
    background: rgba(129, 140, 248, 0.08);
    border: 1px solid rgba(129, 140, 248, 0.15);
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.8125rem;
    color: var(--echo-muted);
    line-height: 1.5;
}

.auth-notice svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--echo-accent);
    margin-top: 1px;
}

/* Alerts */
.form-alert {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 0.875rem;
    margin-bottom: 12px;
}

.form-alert.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.form-alert.success {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #86efac;
}

.auth-legal {
    margin-top: 20px;
    font-size: 0.75rem;
    color: rgba(148, 148, 168, 0.7);
    text-align: center;
    max-width: 420px;
}

/* Mobile logo — above form, logo only */
.auth-mobile-logo {
    display: none;
}

/* ===== Responsive ===== */

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: 100dvh;
        align-items: center;
    }

    .auth-hero {
        display: none;
    }

    .auth-panel {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 100dvh;
        padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
    }

    .auth-mobile-logo {
        display: flex;
        justify-content: center;
        margin-bottom: 28px;
        flex-shrink: 0;
    }

    .auth-mobile-logo img {
        width: 56px;
        height: 56px;
        border-radius: 14px;
    }

    .auth-card {
        padding: 28px 24px;
        border-radius: 18px;
        width: 100%;
        max-width: 420px;
        flex-shrink: 0;
    }

    .auth-legal {
        margin-top: 16px;
        flex-shrink: 0;
    }
}

@media (max-width: 400px) {
    .auth-card {
        padding: 24px 18px;
    }

    .auth-tab {
        padding: 10px 8px;
        font-size: 0.8125rem;
    }

    .auth-step-actions {
        flex-direction: column-reverse;
    }
}

@media (min-width: 901px) {
    .auth-panel {
        border-right: 1px solid rgba(255, 255, 255, 0.04);
    }

    .auth-hero-copy {
        display: block;
    }

    .auth-hero-title {
        margin-bottom: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aurora,
    .auth-hero-ring,
    .auth-hero-content,
    .auth-card,
    .register-step-panel {
        animation: none !important;
    }
}
