/* Reparo Codex — Auth pages (login, register, forgot password) */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --auth-bg: #0a0a0c;
    --auth-bg-2: #111114;
    --auth-elevated: #141418;
    --auth-text: #f4f4f5;
    --auth-muted: #a1a1aa;
    --auth-dim: #71717a;
    --auth-border: rgba(255, 255, 255, 0.06);
    --auth-border-strong: rgba(255, 255, 255, 0.1);
    --auth-violet: #8b5cf6;
    --auth-cyan: #22d3ee;
    --auth-radius: 20px;
    --auth-font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background-color: var(--auth-bg);
    background-image:
        radial-gradient(ellipse 100% 60% at 50% -30%, rgba(139, 92, 246, 0.22), transparent 55%),
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(34, 211, 238, 0.12), transparent 45%),
        linear-gradient(180deg, var(--auth-bg) 0%, var(--auth-bg-2) 55%, var(--auth-bg) 100%);
    background-attachment: fixed;
    position: relative;
    overflow: hidden;
    margin: 0;
    padding: 24px 16px;
}

body.auth-page::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.35;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
}

.auth-back-link {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 12px;
    border: 1px solid var(--auth-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--auth-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.auth-back-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--auth-text);
    border-color: var(--auth-border-strong);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    background: rgba(20, 20, 24, 0.65);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 32px 28px 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    overflow: hidden;
}

.auth-card::before {
    content: "";
    position: absolute;
    top: -40%;
    right: -20%;
    width: 55%;
    height: 80%;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card > * {
    position: relative;
    z-index: 1;
}

.auth-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.auth-header img {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
    box-shadow: 0 0 0 1px var(--auth-border-strong);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(105deg, #fafafa 0%, #a78bfa 55%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.auth-subtitle {
    font-size: 0.875rem;
    color: var(--auth-muted);
    margin-top: 4px;
}

.auth-field {
    margin-bottom: 16px;
}

.auth-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--auth-muted);
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-dim);
    font-size: 0.9rem;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border-radius: 12px;
    border: 1px solid var(--auth-border-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--auth-text);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.auth-input::placeholder {
    color: var(--auth-dim);
}

.auth-input:focus {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.auth-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 8px 0 20px;
    font-size: 0.8rem;
    color: var(--auth-muted);
}

.auth-actions a {
    color: var(--auth-cyan);
    text-decoration: none;
    font-weight: 600;
}

.auth-actions a:hover {
    text-decoration: underline;
}

.auth-actions label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--auth-border-strong);
    background: rgba(255, 255, 255, 0.96);
    color: #1f1f1f;
    font-family: inherit;
    font-weight: 650;
    font-size: 0.92rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
}

.auth-google-btn:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.auth-google-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0 18px;
    color: var(--auth-dim);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--auth-border-strong);
}

.auth-button {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 13px 16px;
    background: linear-gradient(135deg, #fafafa 0%, #e4e4e7 100%);
    color: #09090b;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 0 32px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.2s ease;
}

.auth-button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.2), 0 12px 32px rgba(0, 0, 0, 0.4);
}

.auth-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-footer {
    margin-top: 18px;
    font-size: 0.85rem;
    color: var(--auth-muted);
    text-align: center;
    line-height: 1.6;
}

.auth-footer a {
    color: var(--auth-text);
    text-decoration: none;
    font-weight: 600;
}

.auth-footer a:hover {
    color: var(--auth-cyan);
}

.auth-message {
    font-size: 0.85rem;
    border-radius: 12px;
    padding: 10px 14px;
    margin-bottom: 14px;
    font-weight: 500;
}

.auth-message.error {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.3);
    color: #fca5a5;
}

.auth-message.success {
    background: rgba(34, 211, 238, 0.1);
    border: 1px solid rgba(34, 211, 238, 0.3);
    color: #67e8f9;
}

/* Reset password page aliases */
body.auth-page .reset-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    background: rgba(20, 20, 24, 0.65);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 32px 28px 28px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

body.auth-page .reset-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(105deg, #fafafa 0%, #a78bfa 55%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

body.auth-page .reset-header p {
    color: var(--auth-muted);
}

body.auth-page .form-group label {
    color: var(--auth-muted);
    font-size: 0.8rem;
    font-weight: 600;
}

body.auth-page .form-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--auth-border-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--auth-text);
    font: inherit;
    font-size: 0.9rem;
    outline: none;
}

body.auth-page .form-group input:focus {
    border-color: rgba(139, 92, 246, 0.45);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

body.auth-page .btn-reset,
body.auth-page button[type="submit"] {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 13px 16px;
    background: linear-gradient(135deg, #fafafa 0%, #e4e4e7 100%);
    color: #09090b;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 0 32px rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.35);
}

@media (max-width: 480px) {
    .auth-card {
        padding: 24px 20px 20px;
        border-radius: 16px;
    }

    .auth-back-link {
        top: 12px;
        left: 12px;
    }
}

/* ── Register: reactive Arabic coach ── */
body.auth-page--register {
    font-family: "IBM Plex Sans Arabic", "Inter", system-ui, sans-serif;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 72px 16px 32px;
}

.reg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    z-index: 0;
    animation: regOrbFloat 12s ease-in-out infinite alternate;
}

.reg-orb--a {
    width: 280px;
    height: 280px;
    background: rgba(139, 92, 246, 0.28);
    top: -80px;
    right: 8%;
}

.reg-orb--b {
    width: 220px;
    height: 220px;
    background: rgba(34, 211, 238, 0.18);
    bottom: -40px;
    left: 6%;
    animation-delay: -4s;
}

.reg-orb--c {
    width: 160px;
    height: 160px;
    background: rgba(244, 114, 182, 0.16);
    top: 42%;
    left: 42%;
    animation-delay: -7s;
}

.reg-shell {
    width: 100%;
    max-width: 980px;
    display: grid;
    grid-template-columns: minmax(240px, 0.92fr) minmax(320px, 1.08fr);
    gap: 22px;
    align-items: stretch;
    position: relative;
    z-index: 1;
}

.reg-coach {
    background: rgba(20, 20, 24, 0.55);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 28px 24px;
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    position: relative;
}

.reg-coach.is-reacting .reg-phone__hello,
.reg-coach.is-reacting h1,
.reg-coach.is-reacting p {
    animation: regCoachPulse 0.38s ease;
}

.reg-coach__badge {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #67e8f9;
    border: 1px solid rgba(103, 232, 249, 0.35);
    border-radius: 999px;
    padding: 4px 10px;
}

.reg-phone {
    width: 92px;
    height: 160px;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.16);
    background: linear-gradient(180deg, #16161d, #08080c);
    position: relative;
    overflow: hidden;
    margin: 8px 0 4px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}

.reg-phone__notch {
    width: 36px;
    height: 6px;
    border-radius: 0 0 8px 8px;
    background: #000;
    margin: 0 auto;
}

.reg-phone__hello {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 1.15rem;
    background: linear-gradient(180deg, #fafafa, #67e8f9);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.reg-phone__pulse {
    position: absolute;
    inset: 18% 18%;
    border-radius: 50%;
    border: 1px solid rgba(34, 211, 238, 0.35);
    animation: regPulse 2.4s ease-out infinite;
    pointer-events: none;
}

.reg-coach h1 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.03em;
    line-height: 1.25;
}

.reg-coach p {
    margin: 0;
    color: var(--auth-muted);
    line-height: 1.75;
    font-size: 0.95rem;
}

.reg-tips {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: grid;
    gap: 8px;
}

.reg-tips li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.86rem;
    color: #d4d4d8;
}

.reg-tips i {
    color: #a78bfa;
    width: 16px;
}

.reg-progress {
    margin-top: auto;
    padding-top: 16px;
}

.reg-progress__label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--auth-muted);
    margin-bottom: 8px;
}

.reg-progress__bar {
    height: 6px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.reg-progress__bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #8b5cf6, #22d3ee);
    transition: width 0.35s ease;
}

.reg-card {
    max-width: none;
    animation: regCardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.auth-page--register .auth-back-link {
    left: auto;
    right: 20px;
}

.auth-page--register .auth-input {
    direction: ltr;
    text-align: left;
    padding-right: 42px;
}

.auth-page--register .auth-input-wrap i {
    left: auto;
    right: 14px;
}

.auth-page--register .auth-input {
    padding: 12px 40px 12px 42px;
}

.reg-field-status {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.auth-field.is-ok .reg-field-status {
    background: #34d399;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
}

.auth-field.is-warn .reg-field-status {
    background: #fbbf24;
}

.auth-field.is-bad .reg-field-status {
    background: #f87171;
}

.auth-field.is-ok .auth-input {
    border-color: rgba(52, 211, 153, 0.45);
}

.auth-field.is-bad .auth-input {
    border-color: rgba(248, 113, 113, 0.5);
}

.reg-hint {
    margin: 7px 2px 0;
    font-size: 0.78rem;
    color: var(--auth-dim);
    line-height: 1.55;
    min-height: 1.2em;
}

.auth-field.is-ok .reg-hint { color: #6ee7b7; }
.auth-field.is-warn .reg-hint { color: #fcd34d; }
.auth-field.is-bad .reg-hint { color: #fca5a5; }

.reg-toggle-pass {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: none;
    color: var(--auth-dim);
    cursor: pointer;
    padding: 6px;
    z-index: 2;
}

.reg-strength {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-top: 8px;
}

.reg-strength[hidden] {
    display: none;
}

.reg-strength span {
    height: 4px;
    border-radius: 99px;
    background: rgba(255, 255, 255, 0.1);
}

.reg-strength[data-score="1"] span:nth-child(1) { background: #f87171; }
.reg-strength[data-score="2"] span:nth-child(-n+2) { background: #fbbf24; }
.reg-strength[data-score="3"] span:nth-child(-n+3) { background: #34d399; }
.reg-strength[data-score="4"] span { background: #22d3ee; }

.auth-button.is-ready {
    box-shadow: 0 0 40px rgba(34, 211, 238, 0.28), 0 8px 24px rgba(0, 0, 0, 0.35);
}

body.reg-submitting .reg-shell {
    filter: saturate(1.1);
}

body.reg-success .reg-shell {
    animation: regSuccessPop 0.6s ease;
}

@keyframes regOrbFloat {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to { transform: translate3d(18px, -24px, 0) scale(1.08); }
}

@keyframes regPulse {
    0% { transform: scale(0.6); opacity: 0.55; }
    100% { transform: scale(1.35); opacity: 0; }
}

@keyframes regCoachPulse {
    from { opacity: 0.35; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes regCardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@keyframes regSuccessPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.015); }
    100% { transform: scale(1); }
}

@media (max-width: 860px) {
    .reg-shell {
        grid-template-columns: 1fr;
        max-width: 480px;
    }

    .reg-coach {
        padding: 20px 18px 16px;
    }

    .reg-phone {
        display: none;
    }

    .reg-tips {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .reg-orb,
    .reg-phone__pulse,
    .reg-card,
    .reg-coach.is-reacting .reg-phone__hello,
    body.reg-success .reg-shell {
        animation: none;
    }
}
