/* ================================================================
   BinkBe — Auth Page Styles
   Reutiliza tokens de variables.css
   ================================================================ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    cursor: pointer;
    font-family: inherit;
    background: none;
}

/* ── Smooth theme transition (class added via JS) ── */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 500ms ease-out,
        color 500ms ease-out,
        border-color 500ms ease-out,
        box-shadow 500ms ease-out,
        background 500ms ease-out,
        fill 500ms ease-out !important;
}

/* ── Body ── */
.auth-body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    line-height: 1.65;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* ── Background glow ── */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(97, 191, 247, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse at 70% 80%, rgba(255, 217, 12, 0.08) 0%, transparent 50%);
    pointer-events: none;
}

/* ── Back to home button ── */
.auth-back-btn {
    position: fixed;
    top: var(--sp-5);
    right: calc(var(--sp-5) + 38px + 0.625rem);
    z-index: var(--z-float);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-card);
    color: var(--text-tertiary);
    text-decoration: none;
    transition: background var(--dur-mid) var(--ease-out),
                color var(--dur-mid) var(--ease-out),
                transform var(--dur-mid) var(--ease-spring);
}

.auth-back-btn:hover {
    background: var(--bg-surface-3);
    color: var(--bb-blue);
    transform: translateX(-2px);
}

/* ── Theme toggle ── */
.auth-theme-toggle {
    position: fixed;
    top: var(--sp-5);
    right: var(--sp-5);
    z-index: var(--z-float);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-2);
    border: 1px solid var(--border-card);
    color: var(--text-tertiary);
    transition: transform var(--dur-mid) var(--ease-spring);
}

.auth-theme-toggle:hover {
    transform: rotate(15deg);
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

/* Theme icons */
.theme-icon {
    width: 18px;
    height: 18px;
    transition: opacity 0.4s ease-out, transform 0.45s var(--ease-spring), color 0.4s ease-out;
}

.theme-icon--sun {
    position: absolute;
}

[data-theme="light"] .theme-icon--moon {
    color: var(--bb-blue);
    opacity: 1;
    transform: scale(1) rotate(0);
}

[data-theme="light"] .theme-icon--sun {
    opacity: 0;
    transform: scale(0.4) rotate(60deg);
    pointer-events: none;
}

[data-theme="dark"] .theme-icon--sun {
    color: var(--bb-yellow);
    opacity: 1;
    transform: scale(1) rotate(0);
}

[data-theme="dark"] .theme-icon--moon {
    opacity: 0;
    transform: scale(0.4) rotate(-60deg);
    pointer-events: none;
}

/* ── Main layout ── */
.auth-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 460px;
    padding: var(--sp-5) var(--sp-5) var(--sp-6);
}

/* ── Logo ── */
.auth-logo {
    display: inline-flex;
    margin-bottom: var(--sp-5);
    transition: transform var(--dur-mid) var(--ease-spring);
}

.auth-logo:hover {
    transform: scale(1.04);
}

.auth-logo__img {
    height: 42px;
    width: auto;
}

/* ── Card ── */
.auth-card {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--r-2xl);
    padding: var(--sp-8);
    box-shadow: var(--shadow-lg);
}

/* ── Switcher (Login / Registro) ── */
.auth-switcher {
    display: flex;
    justify-content: center;
    margin-bottom: var(--sp-8);
}

.auth-switcher__track {
    display: inline-flex;
    position: relative;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border-card);
    border-radius: 0.625em;
    padding: 4px;
    gap: 2px;
    width: 100%;
}

/* Sliding pill indicator */
.auth-switcher__pill {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 5px);
    height: calc(100% - 8px);
    background: var(--bb-blue);
    border-radius: 0.625em;
    box-shadow: 0 4px 16px rgba(97, 191, 247, 0.40);
    transition: transform var(--dur-mid) var(--ease-out);
    z-index: 0;
}

.auth-switcher__track[data-active="registro"] .auth-switcher__pill {
    transform: translateX(calc(100% + 2px));
}

.auth-switcher__btn {
    flex: 1;
    padding: var(--sp-2) var(--sp-5);
    border-radius: 0.625em;
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--text-tertiary);
    transition: color var(--dur-mid) var(--ease-out);
    letter-spacing: 0.03em;
    white-space: nowrap;
    text-align: center;
    position: relative;
    z-index: 1;
}

.auth-switcher__btn:hover {
    color: var(--text-primary);
}

.auth-switcher__btn.active {
    color: #fff;
}

/* ── Panels wrapper ── */
.auth-panels {
    position: relative;
    transition: height 0.35s var(--ease-out);
}

/* ── Form ── */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
    animation: authFadeIn 0.3s var(--ease-out);
}

.auth-form[hidden] {
    display: none;
}

.auth-form--exiting {
    animation: authFadeOut 0.2s var(--ease-out) forwards;
}

@keyframes authFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes authFadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}

/* ── Fields ── */
.auth-field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.auth-label {
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--text-primary);
}

.auth-input {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-input);
    border: 1.5px solid var(--border);
    border-radius: 0.625em;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--dur-mid) ease-out, box-shadow var(--dur-mid) ease-out;
}

.auth-input::placeholder {
    color: var(--text-muted);
}

[data-theme="light"] .auth-input::placeholder {
    color: var(--text-tertiary);
}

.auth-input:focus {
    border-color: #61BFF7;
    box-shadow: 0 0 0 3px rgba(97, 191, 247, 0.15);
}

.auth-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

/* Prevent browser autofill from overriding background */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus,
.auth-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
    background-color: var(--bg-input) !important;
}

/* Password wrapper */
.auth-input-wrap {
    position: relative;
}

.auth-input-wrap .auth-input {
    padding-right: var(--sp-10);
}

/* Eye toggle button */
.auth-eye {
    position: absolute;
    right: var(--sp-3);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    padding: var(--sp-1);
    border-radius: var(--r-sm);
    transition: color var(--dur-fast);
    display: grid;
    place-items: center;
}

.auth-eye:hover {
    color: var(--bb-blue);
}

/* Eye icon swap (open ↔ closed) */
.auth-eye__icon {
    grid-area: 1 / 1;
    transition: opacity 0.2s ease;
}

.auth-eye__icon--closed {
    opacity: 0;
}

.auth-eye.visible .auth-eye__icon--open {
    opacity: 0;
}

.auth-eye.visible .auth-eye__icon--closed {
    opacity: 1;
}

.auth-eye.visible {
    color: var(--bb-blue);
}

/* Forgot link */
.auth-forgot {
    font-size: var(--fs-xs);
    color: var(--bb-blue);
    font-weight: var(--fw-medium);
    align-self: flex-end;
    transition: color var(--dur-fast);
}

.auth-forgot:hover {
    color: var(--bb-blue-mid);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 0.75rem 1.75rem;
    border-radius: 0.625em;
    font-family: var(--font-display);
    font-weight: var(--fw-semi);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition:
        transform var(--dur-fast),
        box-shadow var(--dur-fast),
        background var(--dur-fast),
        border-color var(--dur-fast),
        color var(--dur-fast);
    position: relative;
    overflow: hidden;
    border: none;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    opacity: 0;
    transition: opacity var(--dur-fast);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:hover::after {
    opacity: 1;
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn--primary {
    background: var(--bb-blue);
    color: #fff;
    box-shadow: 0 4px 20px rgba(97, 191, 247, 0.35);
}

.btn--primary:hover {
    background: var(--bb-blue-mid);
    box-shadow: 0 8px 32px rgba(97, 191, 247, 0.30);
}

.btn--full {
    width: 100%;
    justify-content: center;
    padding: var(--sp-3) var(--sp-6);
    font-size: var(--fs-body);
}

/* ── Divider ── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--divider);
}

.auth-divider span {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    white-space: nowrap;
}

/* ── Social buttons (stacked) ── */
.auth-social {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.auth-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border-card);
    border-radius: 0.625em;
    font-family: var(--font-body);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--text-primary);
    transition: background var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast);
    width: 100%;
}

.auth-social-btn:hover {
    background: var(--bg-surface-3);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.auth-register-entry {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding-top: var(--sp-2);
}

.auth-divider--signup {
    max-width: 400px;
    width: 100%;
    align-self: center;
}

.auth-register-fields[hidden] {
    display: none;
}

.auth-mode-switcher--login {
    margin-top: var(--sp-2);
    margin-bottom: var(--sp-1);
}

/* ── Terms ── */
.auth-terms {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    text-align: center;
    line-height: 1.6;
}

.auth-terms a {
    color: var(--bb-blue);
    font-weight: var(--fw-medium);
}

.auth-terms a:hover {
    text-decoration: underline;
}

/* ── Back link ── */
.auth-back {
    margin-top: var(--sp-5);
    font-size: var(--fs-sm);
    color: var(--text-tertiary);
    font-weight: var(--fw-medium);
    transition: color var(--dur-fast);
}

.auth-back:hover {
    color: var(--bb-blue);
}

/* ── Error state ── */
.auth-field--error .auth-input {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.auth-field__error {
    font-size: var(--fs-2xs);
    color: #ef4444;
    font-weight: var(--fw-medium);
}

/* ── Footer ── */
.auth-footer {
    width: 100%;
    padding: var(--sp-5) var(--sp-5);
    border-top: 1px solid var(--divider);
}

.auth-footer__links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--sp-6);
    flex-wrap: wrap;
}

.auth-footer__links a {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    font-weight: var(--fw-medium);
    transition: color var(--dur-fast);
    white-space: nowrap;
}

.auth-footer__links a:hover {
    color: var(--text-secondary);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 520px) {
    .auth-main {
        padding: var(--sp-4) var(--sp-4) var(--sp-5);
    }

    .auth-card {
        padding: var(--sp-6);
        border-radius: var(--r-xl);
    }

    .auth-logo__img {
        height: 36px;
    }

    .auth-theme-toggle {
        top: var(--sp-4);
        right: var(--sp-4);
    }

    .auth-footer__links {
        gap: var(--sp-4);
    }
}

@media (max-height: 700px) {
    .auth-main {
        padding: var(--sp-3) var(--sp-5) var(--sp-4);
    }

    .auth-logo {
        margin-bottom: var(--sp-3);
    }

    .auth-logo__img {
        height: 34px;
    }
}

/* ================================================================
   ORGANIZADOR REGISTRO — Mode sub-switcher
   ================================================================ */

.auth-mode-switcher {
    display: flex;
    background: var(--bg-surface-2);
    border: 1.5px solid var(--border-card);
    border-radius: 0.625em;
    padding: 3px;
    gap: 2px;
}

.auth-mode-btn {
    flex: 1;
    padding: var(--sp-2) var(--sp-3);
    border-radius: calc(0.625em - 2px);
    font-family: var(--font-display);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semi);
    color: var(--text-tertiary);
    background: transparent;
    transition: background var(--dur-mid) var(--ease-out),
                color var(--dur-mid) var(--ease-out),
                box-shadow var(--dur-mid) var(--ease-out);
    white-space: nowrap;
    text-align: center;
}

.auth-mode-btn.active {
    background: var(--bb-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(97, 191, 247, 0.30);
}

/* Login mode buttons: Networker = yellow, Organizador = blue */
.auth-mode-switcher--login .auth-login-mode-btn[data-login-mode="networker"].active {
    background: var(--bb-yellow-warm);
    color: var(--text-on-yellow);
    box-shadow: 0 2px 8px rgba(232, 197, 11, 0.32);
}

.auth-mode-switcher--login .auth-login-mode-btn[data-login-mode="organizador"].active {
    background: var(--bb-blue);
    color: #fff;
    box-shadow: 0 2px 8px rgba(97, 191, 247, 0.30);
}

.auth-mode-btn:not(.active):hover {
    background: var(--bg-surface-3);
    color: var(--text-primary);
}

/* ── Registration panels ── */
.auth-reg-panel {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.auth-reg-panel[hidden] {
    display: none;
}

/* ── Select field ── */
select.auth-select {
    appearance: none;
    -webkit-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='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--sp-3) center;
    padding-right: var(--sp-8);
    cursor: pointer;
}

select.auth-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ── Hint text ── */
.auth-hint {
    font-size: var(--fs-2xs);
    color: var(--text-muted);
    line-height: 1.5;
}

.auth-hint--inline {
    margin-left: var(--sp-2);
    white-space: nowrap;
}

/* ── Checkbox field ── */
.auth-field--checkbox {
    gap: 0;
}

.auth-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    cursor: pointer;
}

.auth-checkbox {
    width: 18px;
    height: 18px;
    min-width: 18px;
    accent-color: var(--bb-blue);
    cursor: pointer;
    margin-top: 2px;
}

.auth-checkbox-text {
    font-size: var(--fs-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ── Industries search widget ── */
.auth-industries {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.auth-industries__tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.auth-industries__tags:empty {
    display: none;
}

.auth-industries__tag {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    padding: 2px var(--sp-2);
    background: rgba(97, 191, 247, 0.12);
    border: 1px solid rgba(97, 191, 247, 0.30);
    border-radius: var(--r-full);
    font-size: var(--fs-xs);
    color: var(--bb-blue);
    font-weight: var(--fw-medium);
    line-height: 1.5;
}

.auth-industries__tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    font-size: 11px;
    color: var(--bb-blue);
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    transition: background var(--dur-fast);
    line-height: 1;
}

.auth-industries__tag-remove:hover {
    background: rgba(97, 191, 247, 0.25);
}

.auth-industries__dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1.5px solid var(--border-card);
    border-radius: 0.625em;
    box-shadow: var(--shadow-lg);
    z-index: 100;
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    padding: var(--sp-1) 0;
}

.auth-industries__dropdown[hidden] {
    display: none;
}

.auth-industries__option {
    padding: var(--sp-2) var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--dur-fast);
}

.auth-industries__option:hover,
.auth-industries__option--active {
    background: var(--bg-surface-2);
    color: var(--bb-blue);
}

/* ── Form footer (submit + terms, below columns) ── */
.auth-form-footer {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    align-items: center;
    text-align: center;
    padding-top: var(--sp-4);
}

.auth-form-footer .btn--full {
    max-width: 400px;
    width: 100%;
}

.auth-form-footer .auth-divider,
.auth-form-footer .auth-social {
    max-width: 400px;
    width: 100%;
}

.auth-terms__switch {
    display: block;
    margin-top: var(--sp-2);
    color: var(--text-tertiary);
    font-size: var(--fs-xs);
    font-weight: var(--fw-medium);
    transition: color var(--dur-fast);
}

.auth-terms__switch:hover {
    color: var(--bb-blue);
}

/* ── Two-column grid — mobile default (single column) ── */
.auth-form-grid {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.auth-form-col {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

/* ================================================================
   ORGANIZADOR REGISTRO — Desktop two-column layout
   ================================================================ */
@media (min-width: 1024px) {

    .auth-main {
        transition: max-width 0.35s var(--ease-out);
    }

    .auth-main--wide {
        max-width: 980px;
    }

    .auth-main--wide .auth-card {
        padding: var(--sp-8) clamp(var(--sp-8), 4vw, 3.5rem);
    }

    .auth-form-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: var(--sp-8);
        align-items: start;
    }

    .auth-social--signup {
        flex-direction: row;
        width: 100%;
    }

    .auth-social--signup .auth-social-btn {
        flex: 1;
    }
}

/* ================================================================
   DYNAMIC BRANDING — Networker (yellow) vs Organizer (blue)
   Scoped to the registro form via data-reg-mode attribute
   ================================================================ */

/* Mode sub-switcher pill — yellow when Networker is active */
[data-auth-panel="registro"][data-reg-mode="networker"] .auth-mode-btn.active {
    background: var(--bb-yellow-warm);
    color: var(--text-on-yellow);
    box-shadow: 0 2px 8px rgba(232, 197, 11, 0.32);
}

/* Submit button — yellow for Networker */
[data-auth-panel="registro"][data-reg-mode="networker"] .btn--primary {
    background: var(--bb-yellow-warm);
    color: var(--text-on-yellow);
    box-shadow: 0 4px 20px rgba(232, 197, 11, 0.35);
}

[data-auth-panel="registro"][data-reg-mode="networker"] .btn--primary:hover {
    background: var(--bb-yellow);
    box-shadow: 0 8px 32px rgba(255, 217, 12, 0.30);
}

[data-auth-panel="registro"][data-reg-mode="networker"] .btn--primary::after {
    background: rgba(0, 0, 0, 0.06);
}
