/* ═══════════════════════════════════════════════════════════════════════════
   TalkVatar AI — Authentication Page Styles
   Premium glassmorphism design with animated background
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Variables ──────────────────────────────────────────────────────────────  */
:root {
    --tv-auth-accent:       #4f46e5;
    --tv-auth-accent2:      #7c3aed;
    --tv-auth-accent3:      #06b6d4;
    --tv-auth-success:      #10b981;
    --tv-auth-warning:      #f59e0b;
    --tv-auth-danger:       #ef4444;
    --tv-auth-text:         #1e293b;
    --tv-auth-muted:        #64748b;
    --tv-auth-border:       rgba(255,255,255,0.2);
    --tv-auth-glass:        rgba(255,255,255,0.85);
    --tv-auth-glass-blur:   20px;
    --tv-auth-radius:       20px;
    --tv-auth-shadow:       0 24px 64px rgba(79,70,229,.18), 0 4px 16px rgba(0,0,0,.12);
    --tv-auth-transition:   0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    --tv-auth-font:         -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
}

/* ── Root wrapper ────────────────────────────────────────────────────────────  */
.tv-auth-root {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 30%, #4338ca 60%, #0f172a 100%);
    padding: 40px 16px;
    font-family: var(--tv-auth-font);
    overflow: hidden;
}

/* ── Animated background particles ──────────────────────────────────────────  */
.tv-auth-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.tv-auth-particle {
    position: absolute;
    border-radius: 50%;
    animation: tv-float-particle 20s ease-in-out infinite;
    opacity: 0.08;
}

.tv-p1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, #818cf8, transparent 70%);
    top: -200px; left: -200px;
    animation-duration: 18s;
}
.tv-p2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    bottom: -100px; right: -100px;
    animation-duration: 22s;
    animation-delay: -6s;
}
.tv-p3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #38bdf8, transparent 70%);
    top: 30%; right: 10%;
    animation-duration: 16s;
    animation-delay: -3s;
    opacity: 0.06;
}
.tv-p4 {
    width: 200px; height: 200px;
    background: radial-gradient(circle, #f472b6, transparent 70%);
    bottom: 20%; left: 5%;
    animation-duration: 24s;
    animation-delay: -9s;
    opacity: 0.05;
}
.tv-p5 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #34d399, transparent 70%);
    top: 50%; left: 30%;
    animation-duration: 28s;
    animation-delay: -14s;
    opacity: 0.04;
}

@keyframes tv-float-particle {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25%       { transform: translate(30px, -40px) scale(1.05); }
    50%       { transform: translate(-20px, 30px) scale(0.95); }
    75%       { transform: translate(40px, 20px) scale(1.02); }
}

/* ── Container ───────────────────────────────────────────────────────────────  */
.tv-auth-container {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

/* ── Brand ───────────────────────────────────────────────────────────────────  */
.tv-auth-brand {
    text-align: center;
    color: #fff;
    animation: tv-fade-down 0.6s ease both;
}

.tv-auth-logo {
    font-size: 52px;
    line-height: 1;
    margin-bottom: 10px;
    filter: drop-shadow(0 4px 12px rgba(129,140,248,.6));
    animation: tv-pulse-logo 3s ease-in-out infinite;
}

@keyframes tv-pulse-logo {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 4px 12px rgba(129,140,248,.6)); }
    50%       { transform: scale(1.06); filter: drop-shadow(0 6px 20px rgba(167,139,250,.8)); }
}

.tv-auth-site-name {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0 0 6px;
    background: linear-gradient(135deg, #fff 0%, #c7d2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tv-auth-tagline {
    font-size: 13px;
    margin: 0;
    color: rgba(199,210,254,0.8);
    font-weight: 500;
    letter-spacing: 0.3px;
}

/* ── Card ────────────────────────────────────────────────────────────────────  */
.tv-auth-card {
    width: 100%;
    background: var(--tv-auth-glass);
    backdrop-filter: blur(var(--tv-auth-glass-blur));
    -webkit-backdrop-filter: blur(var(--tv-auth-glass-blur));
    border-radius: var(--tv-auth-radius);
    border: 1px solid rgba(255,255,255,0.3);
    box-shadow: var(--tv-auth-shadow);
    overflow: hidden;
    animation: tv-fade-up 0.6s ease both 0.1s;
}

@keyframes tv-fade-up {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tv-fade-down {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Tabs ────────────────────────────────────────────────────────────────────  */
.tv-auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #f1f5f9;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.tv-auth-tab {
    padding: 16px 12px;
    border: none;
    background: transparent;
    font-family: var(--tv-auth-font);
    font-size: 14px;
    font-weight: 600;
    color: var(--tv-auth-muted);
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    letter-spacing: 0.2px;
}

.tv-auth-tab::after {
    content: '';
    position: absolute;
    bottom: 0; left: 10%; right: 10%;
    height: 3px;
    border-radius: 3px 3px 0 0;
    background: var(--tv-auth-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.tv-auth-tab:hover { color: var(--tv-auth-accent); }

.tv-auth-tab.active {
    color: var(--tv-auth-accent);
    background: rgba(79,70,229,0.05);
}
.tv-auth-tab.active::after { transform: scaleX(1); }

/* ── Panels ──────────────────────────────────────────────────────────────────  */
.tv-auth-panel {
    display: none;
    padding: 28px 28px 24px;
}

.tv-auth-panel.active {
    display: block;
}

.tv-auth-panel.slide-in-right {
    animation: tv-slide-in 0.32s cubic-bezier(0.4,0,0.2,1) both;
}

@keyframes tv-slide-in {
    from { opacity: 0; transform: translateX(16px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* ── Form fields ─────────────────────────────────────────────────────────────  */
.tv-auth-form { display: flex; flex-direction: column; gap: 18px; }

.tv-auth-field { display: flex; flex-direction: column; gap: 6px; }

.tv-auth-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--tv-auth-text);
    letter-spacing: 0.2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tv-auth-strength-label {
    font-size: 12px;
    font-weight: 500;
    transition: color 0.3s;
}

.tv-auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.tv-auth-input-icon {
    position: absolute;
    left: 14px;
    font-size: 16px;
    pointer-events: none;
    z-index: 1;
    line-height: 1;
}

.tv-auth-input {
    width: 100%;
    padding: 13px 44px 13px 42px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 15px;
    font-family: var(--tv-auth-font);
    color: var(--tv-auth-text);
    background: #fff;
    transition: all 0.2s ease;
    outline: none;
    -webkit-appearance: none;
}

.tv-auth-input:focus {
    border-color: var(--tv-auth-accent);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
    background: #fafbff;
}

.tv-auth-input.error {
    border-color: var(--tv-auth-danger);
    box-shadow: 0 0 0 4px rgba(239,68,68,0.1);
}

.tv-auth-input::placeholder { color: #94a3b8; }

.tv-auth-eye-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    color: var(--tv-auth-muted);
    line-height: 1;
    transition: transform 0.2s;
}
.tv-auth-eye-btn:hover { transform: scale(1.15); }

/* ── Password strength bar ───────────────────────────────────────────────────  */
.tv-auth-strength-bar {
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.tv-strength-fill {
    height: 100%;
    width: 0;
    border-radius: 4px;
    transition: width 0.4s ease, background 0.4s ease;
}

/* ── Field errors ────────────────────────────────────────────────────────────  */
.tv-auth-field-error {
    font-size: 12px;
    color: var(--tv-auth-danger);
    display: none;
    align-items: center;
    gap: 4px;
    padding-left: 2px;
}
.tv-auth-field-error.visible { display: flex; }

/* ── Remember me + Forgot ────────────────────────────────────────────────────  */
.tv-auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -4px;
}

.tv-auth-check-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--tv-auth-muted);
    cursor: pointer;
    user-select: none;
}

.tv-auth-check {
    width: 16px;
    height: 16px;
    accent-color: var(--tv-auth-accent);
    cursor: pointer;
}

/* ── Alert messages ──────────────────────────────────────────────────────────  */
.tv-auth-alert {
    display: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.5;
    font-weight: 500;
}

.tv-auth-alert.visible { display: block; }

.tv-alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.tv-alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.tv-alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

/* ── Submit button ───────────────────────────────────────────────────────────  */
.tv-auth-submit {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, var(--tv-auth-accent) 0%, var(--tv-auth-accent2) 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    font-family: var(--tv-auth-font);
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 14px rgba(79,70,229,0.35);
}

.tv-auth-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.tv-auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(79,70,229,0.45);
}
.tv-auth-submit:hover:not(:disabled)::before { opacity: 1; }

.tv-auth-submit:active:not(:disabled) { transform: translateY(0); }

.tv-auth-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.tv-auth-submit.loading .tv-btn-text   { opacity: 0; }
.tv-auth-submit.loading .tv-btn-spinner { display: block; }

.tv-btn-spinner {
    display: none;
    position: absolute;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: tv-spin 0.75s linear infinite;
}

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

/* ── Link-style buttons ──────────────────────────────────────────────────────  */
.tv-auth-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--tv-auth-accent);
    font-size: 13px;
    font-family: var(--tv-auth-font);
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.2s, opacity 0.2s;
}
.tv-auth-link:hover { color: var(--tv-auth-accent2); text-decoration: underline; }

/* ── Switch + Terms text ─────────────────────────────────────────────────────  */
.tv-auth-switch {
    font-size: 13px;
    color: var(--tv-auth-muted);
    text-align: center;
    margin: 0;
}

.tv-auth-terms {
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

/* ── Register perks ──────────────────────────────────────────────────────────  */
.tv-auth-perks {
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1px solid #bbf7d0;
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: -4px 0;
}

.tv-auth-perk {
    font-size: 13px;
    color: #15803d;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

/* ── OTP panel ───────────────────────────────────────────────────────────────  */
.tv-otp-header {
    text-align: center;
    margin-bottom: 24px;
}

.tv-otp-icon {
    font-size: 48px;
    line-height: 1;
    margin-bottom: 12px;
    animation: tv-bounce-icon 0.6s ease both;
}

@keyframes tv-bounce-icon {
    0%   { transform: scale(0);   opacity: 0; }
    60%  { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); }
}

.tv-otp-title {
    font-size: 22px;
    font-weight: 800;
    color: var(--tv-auth-text);
    margin: 0 0 8px;
}

.tv-otp-desc {
    font-size: 14px;
    color: var(--tv-auth-muted);
    margin: 0;
    line-height: 1.6;
}

/* ── OTP digit inputs ────────────────────────────────────────────────────────  */
.tv-otp-inputs {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.tv-otp-digit {
    width: 52px;
    height: 60px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: var(--tv-auth-accent);
    background: #fff;
    outline: none;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    caret-color: transparent;
}

.tv-otp-digit:focus {
    border-color: var(--tv-auth-accent);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.15);
    transform: scale(1.08);
    background: #fafbff;
}

.tv-otp-digit.verified {
    border-color: var(--tv-auth-success);
    background: #f0fdf4;
    color: var(--tv-auth-success);
    animation: tv-pop-in 0.4s var(--tv-auth-transition) both;
}

.tv-otp-digit.shake {
    animation: tv-shake 0.5s ease;
    border-color: var(--tv-auth-danger);
    background: #fff5f5;
}

@keyframes tv-pop-in {
    0%   { transform: scale(0.8); }
    60%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes tv-shake {
    0%, 100% { transform: translateX(0); }
    20%      { transform: translateX(-6px); }
    40%      { transform: translateX(6px); }
    60%      { transform: translateX(-4px); }
    80%      { transform: translateX(4px); }
}

.tv-otp-sep {
    font-size: 20px;
    color: #cbd5e1;
    margin: 0 2px;
    user-select: none;
}

/* ── OTP resend & back ───────────────────────────────────────────────────────  */
.tv-otp-resend {
    text-align: center;
    font-size: 13px;
    color: var(--tv-auth-muted);
}

.tv-otp-back {
    display: block;
    text-align: center;
    margin-top: 4px;
}

/* ── Forgot panel header ─────────────────────────────────────────────────────  */
.tv-auth-panel-head {
    margin-bottom: 20px;
}
.tv-auth-panel-head h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--tv-auth-text);
    margin: 0 0 6px;
}
.tv-auth-panel-head p {
    font-size: 14px;
    color: var(--tv-auth-muted);
    margin: 0;
}

/* ── Feature highlights (below card) ────────────────────────────────────────  */
.tv-auth-features {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    animation: tv-fade-up 0.6s ease both 0.25s;
}

.tv-auth-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 100px;
    padding: 6px 14px;
    color: rgba(255,255,255,0.9);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.2px;
    transition: all 0.2s ease;
}

.tv-auth-feature:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

.tv-feat-icon { font-size: 16px; line-height: 1; }

/* ── Responsive ──────────────────────────────────────────────────────────────  */
@media (max-width: 480px) {
    .tv-auth-root    { padding: 20px 12px; align-items: flex-start; }
    .tv-auth-card    { border-radius: 16px; }
    .tv-auth-panel   { padding: 22px 20px 18px; }
    .tv-otp-digit    { width: 44px; height: 52px; font-size: 20px; }
    .tv-auth-submit  { padding: 12px; font-size: 14px; }
    .tv-auth-features { gap: 10px; }
}

/* ── WordPress theme override fixes ──────────────────────────────────────────  */
.tv-auth-root input,
.tv-auth-root button,
.tv-auth-root select,
.tv-auth-root textarea {
    font-family: var(--tv-auth-font) !important;
}

.tv-auth-root *,
.tv-auth-root *::before,
.tv-auth-root *::after {
    box-sizing: border-box;
}

/* Hide WP admin bar vertical offset for this page */
.tv-auth-root ~ #wpadminbar { position: fixed !important; }
