@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

body, input, button, select, textarea, h1, h2, h3, h4, h5, h6, p, a, span, div, label {
    font-family: 'Inter', sans-serif;
}

body {
    background: #0f0f13;
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(78,115,223,.18) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(28,200,138,.1) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
}

/* ── Main container ── */
.container {
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 30px 80px rgba(0,0,0,.55);
    position: relative;
    overflow: hidden;
    width: 1050px;
    max-width: 98vw;
    min-height: 680px;
}

/* ── Alert ── */
.auth-alert {
    width: 100%;
    background: #fff5f5;
    border: 1px solid #fecaca;
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .82rem;
    color: #b91c1c;
    font-weight: 500;
}
.auth-alert i { font-size: .9rem; flex-shrink: 0; }

/* ── Form panels ── */
.container form {
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 30px 42px;
    height: 100%;
    gap: 0;
}

/* ── Headings ── */
.container form h1 {
    font-size: 1.55rem;
    font-weight: 800;
    color: #111827;
    margin-bottom: 2px;
    letter-spacing: -.5px;
    text-align: center;
}

.form-subtitle {
    font-size: .79rem;
    color: #9ca3af;
    margin-bottom: 4px;
    text-align: center;
}

/* ── Accent bar ── */
.form-accent {
    width: 36px;
    height: 3px;
    background: linear-gradient(90deg, #4e73df, #36b9cc);
    border-radius: 2px;
    margin: 6px auto 14px;
}

/* ── Section label (unused but kept for compat) ── */
.field-section-label { display: none; }

/* ── Field group (label + input) ── */
.field-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    margin-bottom: 10px;
}

.field-label {
    font-size: .72rem;
    font-weight: 600;
    color: #374151;
    letter-spacing: .1px;
    padding-left: 2px;
}

/* ── Legacy two-column row (keep for potential reuse) ── */
.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

/* ── Sign-up specific layout helpers ── */
.su-full {
    width: 100%;
}

.su-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
}

/* ── Phone field: country code + number in one unified box ── */
.phone-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    height: 42px;
    overflow: hidden;
    transition: border-color .18s, box-shadow .18s, background .18s;
}
.phone-wrap:focus-within {
    border-color: #4e73df;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(78,115,223,.12);
}

.country-select {
    flex-shrink: 0;
    border: none;
    background: transparent;
    padding: 0 4px 0 12px;
    font-size: .82rem;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    outline: none;
    height: 100%;
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    appearance: none;
    min-width: 82px;
}

/* thin vertical divider between code and number */
.phone-divider {
    width: 1px;
    height: 22px;
    background: #d1d5db;
    flex-shrink: 0;
    margin: 0 2px;
}

.phone-wrap input[type="text"] {
    flex: 1;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 12px !important;
    height: 100%;
    font-size: .85rem;
    color: #111827;
    outline: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    min-width: 0;
}
.phone-wrap input[type="text"]::placeholder {
    color: #c4cad6;
    font-weight: 400;
    font-size: .83rem;
}

/* ── Input wrapper ── */
.input-wrap {
    position: relative;
    width: 100%;
}

/* Left icon */
.input-wrap > i.fas,
.input-wrap > i.far,
.input-wrap > i.fab {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: .82rem;
    pointer-events: none;
    transition: color .18s;
    z-index: 2;
    width: 14px;
    text-align: center;
}

.input-wrap input {
    width: 100%;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 0 14px 0 38px;
    height: 42px;
    font-size: .85rem;
    color: #111827;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background .18s;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    -webkit-appearance: none;
    appearance: none;
}

.input-wrap.has-eye input { padding-right: 42px; }

.input-wrap input::placeholder {
    color: #c4cad6;
    font-weight: 400;
    font-size: .83rem;
}

.input-wrap input:hover {
    border-color: #d1d5db;
    background: #fff;
}

.input-wrap input:focus {
    border-color: #4e73df;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(78,115,223,.12);
}

.input-wrap:focus-within > i.fas,
.input-wrap:focus-within > i.far,
.input-wrap:focus-within > i.fab { color: #4e73df; }

/* ── Eye toggle ── */
.pw-eye {
    position: absolute !important;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: #9ca3af !important;
    background: transparent !important;
    border: none !important;
    border-radius: 6px;
    font-size: .82rem;
    cursor: pointer;
    user-select: none;
    z-index: 4;
    transition: color .15s, background .15s;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
}
.pw-eye i { pointer-events: none; }
.pw-eye:hover { color: #4e73df !important; background: rgba(78,115,223,.07) !important; }
.pw-eye.active { color: #4e73df !important; }

/* Hide Safari's native password autofill icon */
input::-webkit-credentials-auto-fill-button,
input::-webkit-contacts-auto-fill-button {
    visibility: hidden !important;
    display: none !important;
    pointer-events: none;
    width: 0; height: 0; margin: 0;
}

/* ── Primary button ── */
.btn-primary-auth {
    width: 100%;
    background: linear-gradient(135deg, #4e73df 0%, #36b9cc 100%);
    color: #fff;
    border: none;
    border-radius: 9px;
    font-size: .88rem;
    font-weight: 700;
    letter-spacing: .2px;
    cursor: pointer;
    margin-top: 16px;
    transition: opacity .2s, transform .15s, box-shadow .2s;
    box-shadow: 0 4px 16px rgba(78,115,223,.35);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 46px;
}
.btn-primary-auth i { font-size: .9rem; }
.btn-primary-auth:hover {
    opacity: .92;
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(78,115,223,.42);
}
.btn-primary-auth:active { transform: translateY(0); }

/* Forgot password link */
.field-group .forgot {
    font-size: .74rem;
    color: #6b7280;
    text-decoration: none;
    margin-top: 4px;
    align-self: flex-end;
    transition: color .15s;
}
.field-group .forgot:hover { color: #4e73df; text-decoration: underline; }

/* legacy alias */
.container a.forgot {
    font-size: .74rem;
    color: #6b7280;
    text-decoration: none;
    margin: 6px 0 0;
    align-self: flex-end;
    transition: color .15s;
}
.container a.forgot:hover { color: #4e73df; text-decoration: underline; }

/* ── Divider ── */
.form-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 14px 0 10px;
}
.form-divider span { font-size: .72rem; color: #d1d5db; white-space: nowrap; }
.form-divider::before,
.form-divider::after { content:''; flex:1; height:1px; background:#e5e7eb; }

/* ── Sign-in sign-up panel positions ── */
.form-container {
    position: absolute;
    top: 0;
    height: 100%;
    transition: all 0.6s ease-in-out;
}

.sign-in {
    left: 0;
    width: 50%;
    z-index: 2;
}

.container.active .sign-in {
    transform: translateX(100%);
}

.sign-up {
    left: 0;
    width: 50%;
    opacity: 0;
    z-index: 1;
}

.container.active .sign-up {
    transform: translateX(100%);
    opacity: 1;
    z-index: 5;
    animation: move 0.6s;
}

@keyframes move {
    0%, 49.99%  { opacity: 0; z-index: 1; }
    50%, 100%   { opacity: 1; z-index: 5; }
}

/* ── Toggle panel ── */
.toggle-container {
    position: absolute;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: all 0.6s ease-in-out;
    border-radius: 140px 0 0 90px;
    z-index: 1000;
}

.container.active .toggle-container {
    transform: translateX(-100%);
    border-radius: 0 140px 90px 0;
}

.toggle {
    height: 100%;
    background: linear-gradient(160deg, #1a1f36 0%, #0d1117 50%, #151c2c 100%);
    color: #fff;
    position: relative;
    left: -100%;
    width: 200%;
    transform: translateX(0);
    transition: all 0.6s ease-in-out;
}

/* Subtle shimmer overlay on the dark panel */
.toggle::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 30% 30%, rgba(78,115,223,.22) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 70%, rgba(54,185,204,.15) 0%, transparent 55%);
    pointer-events: none;
}

.container.active .toggle {
    transform: translateX(50%);
}

.toggle-panel {
    position: absolute;
    width: 50%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 36px;
    text-align: center;
    top: 0;
    transform: translateX(0);
    transition: all 0.6s ease-in-out;
    z-index: 1;
}

.toggle-panel h1 {
    font-size: 1.7rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -.5px;
}

.toggle-panel p {
    font-size: .85rem;
    color: rgba(255,255,255,.65);
    line-height: 1.6;
    margin-bottom: 28px;
}

.toggle-left  { transform: translateX(-200%); }
.container.active .toggle-left  { transform: translateX(0); }
.toggle-right { right: 0; transform: translateX(0); }
.container.active .toggle-right { transform: translateX(200%); }

/* Hidden (outline) toggle button */
.container button.hidden {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.55);
    color: #fff;
    border-radius: 10px;
    padding: 10px 36px;
    font-size: .82rem;
    font-weight: 600;
    letter-spacing: .5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background .2s, border-color .2s;
}
.container button.hidden:hover {
    background: rgba(255,255,255,.1);
    border-color: #fff;
}

/* ── Logo / orbit animation ── */
.logo-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
}

.logo-wrapper img {
    position: relative;
    z-index: 2;
    animation: logo-float 3.5s ease-in-out infinite;
    filter: drop-shadow(0 0 16px rgba(78,115,223,.5));
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1.5px solid transparent;
}

.ring-1 {
    width: 145px; height: 145px;
    margin: -72.5px 0 0 -72.5px;
    border-top-color: rgba(78,115,223,.9);
    border-right-color: rgba(78,115,223,.15);
    animation: spin-cw 2s linear infinite;
}

.ring-2 {
    width: 172px; height: 172px;
    margin: -86px 0 0 -86px;
    border-bottom-color: rgba(54,185,204,.7);
    border-left-color: rgba(54,185,204,.1);
    animation: spin-ccw 3.4s linear infinite;
}

.ring-3 {
    width: 200px; height: 200px;
    margin: -100px 0 0 -100px;
    border-right-color: rgba(255,255,255,.25);
    animation: spin-cw 5s linear infinite;
}

@keyframes spin-cw  { to { transform: rotate(360deg);  } }
@keyframes spin-ccw { to { transform: rotate(-360deg); } }

@keyframes logo-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

/* ── Responsive ── */
@media (max-width: 720px) {
    body { overflow: auto; align-items: flex-start; padding: 18px 12px; }
    .container { min-height: auto; border-radius: 16px; overflow: visible; }
    .input-row  { grid-template-columns: 1fr; }
    .su-row { grid-template-columns: 1fr; }
    .container form { padding: 22px 18px; }

    /* Mobile: stack both forms, remove sliding overlay. */
    .form-container {
        position: relative;
        width: 100%;
        height: auto;
        transition: none;
    }
    .sign-in,
    .sign-up {
        left: auto;
        width: 100%;
        opacity: 1;
        transform: none !important;
        z-index: auto;
        animation: none !important;
    }
    .toggle-container { display: none; }
    .container.active .sign-in,
    .container.active .sign-up { transform: none !important; }

    /* Add spacing between the two sections. */
    .sign-up { margin-top: 10px; border-top: 1px solid #eef2f7; }
}
