/* ========================================
   LOGIN / AUTH — Versión premium
   ======================================== */

/* Reset / base */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-body); color: var(--text-primary); overflow: hidden; }
.auth-shell *, .auth-shell *::before, .auth-shell *::after { box-sizing: border-box; }

/* ==== Panel izquierdo: brand con gradient mesh animado ==== */
.auth-brand {
    position: relative;
    background: #0f0f1e;
    color: #fff;
    padding: 3.5rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

/* Mesh animado — 3 blobs que flotan con blending */
.auth-brand__mesh { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.auth-brand__blob { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.75; mix-blend-mode: screen; animation: blobFloat 18s ease-in-out infinite; }
.auth-brand__blob--1 { width: 520px; height: 520px; top: -140px; left: -120px; background: radial-gradient(circle, #CE32FF 0%, #A020F0 60%, transparent 80%); animation-delay: 0s; }
.auth-brand__blob--2 { width: 460px; height: 460px; bottom: -100px; right: -80px; background: radial-gradient(circle, #FF3E89 0%, #DC2F9E 60%, transparent 80%); animation-delay: -6s; animation-duration: 22s; }
.auth-brand__blob--3 { width: 380px; height: 380px; top: 38%; left: 38%; background: radial-gradient(circle, #3B82F6 0%, #1D4ED8 60%, transparent 80%); animation-delay: -12s; animation-duration: 26s; opacity: 0.4; }

@keyframes blobFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -50px) scale(1.1); }
    66%      { transform: translate(-30px, 40px) scale(0.95); }
}

/* Grid de puntos sutil encima del mesh */
.auth-brand__grid {
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.35;
    pointer-events: none;
    mask-image: linear-gradient(180deg, transparent 0%, black 40%, black 60%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, black 40%, black 60%, transparent 100%);
}

.auth-brand__inner { position: relative; z-index: 1; }

.auth-brand__logo {
    display: flex; align-items: center; gap: 0.75rem;
    font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em;
}
.auth-brand__logo-chip {
    width: 40px; height: 40px; border-radius: 10px; padding: 6px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(206, 50, 255, 0.35), inset 0 0 0 1px rgba(255,255,255,0.6);
}
.auth-brand__logo-chip img { width: 100%; height: 100%; object-fit: contain; display: block; }

.auth-brand__hero { margin-top: auto; }
.auth-brand__hero h1 { font-size: 2.4rem; line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; margin: 0 0 1rem; }
.auth-brand__hero h1 .grad { background: linear-gradient(90deg, #FF3E89, #CE32FF, #3B82F6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.auth-brand__hero p { font-size: 0.95rem; color: rgba(255,255,255,0.7); margin: 0 0 1.5rem; line-height: 1.6; max-width: 420px; }

.auth-brand__features { display: flex; flex-direction: column; gap: 0.75rem; max-width: 360px; }
.auth-brand__feature { display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem; color: rgba(255,255,255,0.85); }
.auth-brand__feature-check {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(206, 50, 255, 0.25); color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; box-shadow: 0 0 0 1px rgba(206,50,255,0.4);
}

.auth-brand__foot { position: relative; z-index: 1; font-size: 0.7rem; color: rgba(255,255,255,0.45); letter-spacing: 0.05em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }

/* ==== Panel derecho: formulario ==== */
.auth-panel {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem 2.5rem; background: var(--bg-body);
    position: relative;
}

/* Theme toggle flotante */
.auth-theme-toggle { position: absolute; top: 1.5rem; right: 1.5rem; width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s; z-index: 2; }
.auth-theme-toggle:hover { border-color: var(--primary); color: var(--primary); transform: rotate(15deg); }
.auth-theme-toggle .sun, .auth-theme-toggle .moon { position: absolute; transition: all 0.3s; }
[data-theme="dark"] .auth-theme-toggle .sun { opacity: 1; transform: rotate(0); }
[data-theme="dark"] .auth-theme-toggle .moon { opacity: 0; transform: rotate(90deg); }
.auth-theme-toggle .sun { opacity: 0; transform: rotate(-90deg); }
.auth-theme-toggle .moon { opacity: 1; transform: rotate(0); }

.auth-form {
    width: 100%; max-width: 400px;
    animation: authFormIn 0.55s ease both;
}
@keyframes authFormIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-form__heading { margin-bottom: 1.5rem; }
.auth-form__welcome { font-size: 0.75rem; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 0.4rem; }
.auth-form__title { font-size: 1.75rem; font-weight: 800; margin: 0 0 0.3rem; letter-spacing: -0.02em; color: var(--text-primary); }
.auth-form__subtitle { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

/* Alerts con iconos */
.auth-alert { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.75rem 0.9rem; border-radius: 10px; font-size: 0.82rem; margin-bottom: 1rem; border: 1px solid transparent; line-height: 1.4; }
.auth-alert--success { background: rgba(16,185,129,0.08); color: #059669; border-color: rgba(16,185,129,0.2); }
.auth-alert--danger  { background: rgba(239,68,68,0.08); color: #DC2626; border-color: rgba(239,68,68,0.22); }
.auth-alert svg { flex-shrink: 0; margin-top: 1px; }

/* Floating label fields */
.auth-field { position: relative; margin-bottom: 1rem; }
.auth-field__input {
    width: 100%;
    padding: 1.1rem 0.9rem 0.45rem 2.6rem;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.92rem;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
}
.auth-field--password .auth-field__input { padding-right: 2.8rem; }
.auth-field__input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(206,50,255,0.12); }
.auth-field__input::placeholder { color: transparent; }

.auth-field__label {
    position: absolute;
    left: 2.6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: all 0.18s;
    background: transparent;
}
.auth-field__input:focus + .auth-field__label,
.auth-field__input:not(:placeholder-shown) + .auth-field__label {
    top: 0.45rem;
    transform: translateY(0);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-field__icon {
    position: absolute;
    left: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color 0.18s;
}
.auth-field__input:focus ~ .auth-field__icon { color: var(--primary); }

.auth-field__toggle {
    position: absolute;
    right: 0.9rem;
    top: 50%;
    transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    transition: color 0.15s, background 0.15s;
}
.auth-field__toggle:hover { color: var(--primary); background: rgba(206,50,255,0.08); }

/* Botón submit con gradient y hover */
.auth-submit {
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 10px;
    background: var(--gradient-primary);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(206,50,255,0.32);
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
    display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    margin-top: 0.5rem;
}
.auth-submit:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(206,50,255,0.45); }
.auth-submit:active { transform: translateY(0); }
.auth-submit::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
    transform: translateX(-100%);
    transition: transform 0.8s;
}
.auth-submit:hover::before { transform: translateX(100%); }
.auth-submit.is-loading { color: transparent; pointer-events: none; }
.auth-submit.is-loading::after {
    content: ''; position: absolute;
    top: 50%; left: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff;
    animation: authSpin 0.6s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* Links abajo */
.auth-helper { display: flex; justify-content: space-between; align-items: center; margin-top: 1rem; font-size: 0.8rem; }
.auth-helper a { color: var(--text-muted); text-decoration: none; transition: color 0.15s; }
.auth-helper a:hover { color: var(--primary); }
.auth-helper a.primary { color: var(--primary); font-weight: 600; }

.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin: 1.25rem 0 1rem; color: var(--text-muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-color); }

.auth-register { text-align: center; margin-top: 1.25rem; font-size: 0.85rem; color: var(--text-muted); }
.auth-register a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-register a:hover { text-decoration: underline; }

/* ==== Responsive ==== */
@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-panel { padding: 2.5rem 1.5rem; min-height: 100vh; }
    .auth-panel::before {
        content: '';
        position: absolute; top: -25%; left: -25%;
        width: 500px; height: 500px;
        background: radial-gradient(circle, rgba(206,50,255,0.18) 0%, transparent 60%);
        filter: blur(60px);
        pointer-events: none;
    }
    .auth-panel::after {
        content: '';
        position: absolute; bottom: -20%; right: -20%;
        width: 400px; height: 400px;
        background: radial-gradient(circle, rgba(255,62,137,0.15) 0%, transparent 60%);
        filter: blur(60px);
        pointer-events: none;
    }
    .auth-form { position: relative; z-index: 1; }
}

/* Dark mode refinements */
[data-theme="dark"] .auth-panel { background: #0a0a14; }
[data-theme="dark"] .auth-field__input { background: #15152a; border-color: #252540; }
[data-theme="dark"] .auth-field__input:focus { border-color: var(--primary); }

/* Legacy compat (por si otro view lo usa) */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-body); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; background: var(--bg-card); border-radius: var(--border-radius-lg); box-shadow: var(--shadow-lg); padding: 2.5rem; border: 1px solid var(--border-color); }
.auth-card__logo { display:flex; align-items:center; justify-content:center; gap:0.75rem; margin-bottom:2rem; }
.auth-card__logo-img { max-height: 100px; width: auto; object-fit: contain; }
.auth-card__logo-img--light { display: none; }
.auth-card__logo-img--dark { display: block; }
[data-theme="dark"] .auth-card__logo-img--light { display: block; }
[data-theme="dark"] .auth-card__logo-img--dark { display: none; }
.auth-card__title { text-align: center; font-size: var(--font-size-lg); color: var(--text-secondary); margin-bottom: 1.5rem; }
.auth-card__footer { text-align: center; margin-top: 1.5rem; font-size: var(--font-size-sm); color: var(--text-muted); }
