/**
 * React Bits — adaptação vanilla para MeuAppVendas
 * DotGrid, SpotlightCard e entradas suaves (sem dependências React)
 */

/* ── Auth shell + DotGrid ── */
.rb-auth-page {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow: hidden;
    background: #0f172a;
}

.rb-dot-grid {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.rb-dot-grid canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.rb-auth-page::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    background: radial-gradient(ellipse 80% 60% at 50% 40%, transparent 0%, rgb(15 23 42 / 0.55) 100%);
    pointer-events: none;
}

/* Register — fundo igual à landing com desfoque */
.rb-auth-page--landing {
    background: #0a1628;
    padding: 1.5rem 1rem;
}

.rb-auth-page--landing::after {
    display: none;
}

.rb-auth-page__bg-wrap {
    position: absolute;
    inset: -6px;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.rb-auth-page__bg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    filter: blur(3px);
    transform: scale(1.01);
}

.rb-auth-page__retro {
    z-index: 1;
    opacity: 0.45;
}

.rb-auth-page__overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(to bottom, rgb(10 22 40 / 0.35) 0%, rgb(10 22 40 / 0.72) 55%, rgb(10 22 40 / 0.92) 100%),
        radial-gradient(ellipse 80% 60% at 50% 20%, rgb(37 99 235 / 0.18) 0%, transparent 60%);
}

.rb-auth-page--landing .rb-auth-content {
    max-width: 520px;
    z-index: 3;
}

.rb-auth-page--landing .rb-glass-card.auth-card {
    background: rgb(255 255 255 / 0.82);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgb(255 255 255 / 0.45);
    box-shadow:
        0 24px 60px rgb(0 0 0 / 0.35),
        0 0 0 1px rgb(255 255 255 / 0.08) inset;
}

.rb-auth-content--wide {
    max-width: 520px;
}

.rb-auth-content {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 440px;
}

.rb-auth-page:has(.rb-auth-split-full) {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: #0a1628;
}

.rb-auth-page:has(.rb-auth-split-full) .rb-dot-grid,
.rb-auth-page:has(.rb-auth-split-full)::after {
    display: none;
}

.rb-auth-content:has(.rb-auth-split-full) {
    max-width: none;
    min-height: 100vh;
    min-height: 100dvh;
}

.rb-auth-split-full {
    display: grid;
    grid-template-columns: minmax(360px, 460px) 1fr;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.rb-auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 2.5rem;
    background: linear-gradient(160deg, #0a1628 0%, #0f2744 42%, #132f52 100%);
    position: relative;
}

.rb-auth-panel::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 90% 70% at 20% 50%, rgb(37 99 235 / 0.12) 0%, transparent 65%),
        radial-gradient(ellipse 60% 50% at 80% 20%, rgb(16 185 129 / 0.06) 0%, transparent 55%);
    pointer-events: none;
}

.rb-auth-panel .auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    background: rgb(255 255 255 / 0.97);
    border-radius: var(--radius);
    box-shadow:
        0 20px 50px rgb(0 0 0 / 0.35),
        0 0 0 1px rgb(255 255 255 / 0.08);
    border: 1px solid rgb(255 255 255 / 0.12);
    padding: 2.5rem;
}

.rb-auth-visual {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    background: #0a1628;
}

.rb-auth-visual-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.rb-auth-visual-caption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 3;
    padding: 2.5rem 2rem 2rem;
    background: linear-gradient(to top, rgb(10 22 40 / 0.92) 0%, rgb(10 22 40 / 0.45) 55%, transparent 100%);
    pointer-events: none;
}

.rb-auth-visual-caption h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.02em;
    margin-bottom: 0.375rem;
}

.rb-auth-visual-caption p {
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #cbd5e1;
    max-width: 420px;
}

/* ── Glass card (login legado / landing / outras telas) ── */
.rb-glass-card {
    background: rgb(255 255 255 / 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgb(255 255 255 / 0.45);
    box-shadow:
        0 8px 32px rgb(15 23 42 / 0.08),
        0 0 0 1px rgb(255 255 255 / 0.08) inset;
}

[data-theme="dark"] .rb-glass-card {
    background: rgb(17 24 39 / 0.72);
    border-color: rgb(148 163 184 / 0.18);
    box-shadow:
        0 8px 32px rgb(0 0 0 / 0.35),
        0 0 0 1px rgb(148 163 184 / 0.08) inset;
}

.rb-glass-card.auth-card {
    background: rgb(255 255 255 / 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgb(255 255 255 / 0.35);
    box-shadow:
        0 4px 24px rgb(0 0 0 / 0.12),
        0 0 0 1px rgb(255 255 255 / 0.05) inset;
}

.auth-card.auth-card-wide {
    max-width: 480px;
}

.auth-card .auth-subtitle {
    color: var(--muted);
    margin-top: 0.375rem;
    font-size: 0.875rem;
}

.auth-card .auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.auth-card .auth-footer p + p {
    margin-top: 0.625rem;
}

.auth-card .auth-intro {
    color: var(--muted);
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* ── SpotlightCard (React Bits) ── */
.rb-spotlight-card {
    position: relative;
    overflow: hidden;
    --mouse-x: 50%;
    --mouse-y: 50%;
    --spotlight-color: rgb(37 99 235 / 0.07);
}

.rb-spotlight-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(
        520px circle at var(--mouse-x) var(--mouse-y),
        var(--spotlight-color),
        transparent 72%
    );
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
    z-index: 0;
}

.rb-spotlight-card:hover::before,
.rb-spotlight-card:focus-within::before {
    opacity: 1;
}

.rb-spotlight-card > * {
    position: relative;
    z-index: 1;
}

[data-theme="dark"] .rb-spotlight-card {
    --spotlight-color: rgb(59 130 246 / 0.12);
}

/* ── App shell background (gestor / empresa) ── */
.rb-app-shell {
    position: relative;
    min-height: calc(100vh - 80px);
}

.rb-app-shell::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.45;
    background-image: radial-gradient(rgb(148 163 184 / 0.35) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: linear-gradient(to bottom, black 0%, transparent 85%);
}

[data-theme="dark"] .rb-app-shell::before {
    opacity: 0.2;
    background-image: radial-gradient(rgb(100 116 139 / 0.4) 1px, transparent 1px);
}

.rb-app-shell > * {
    position: relative;
    z-index: 1;
}

/* ── Profile / settings panels ── */
.rb-profile-panel {
    max-width: 760px;
}

.rb-profile-panel .card-header {
    font-size: 0.9375rem;
    letter-spacing: -0.01em;
}

.rb-profile-intro {
    color: var(--muted);
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
    line-height: 1.55;
}

.rb-section-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 0.75rem;
}

/* ── Fade entrance ── */
.rb-fade-in {
    animation: rbFadeIn 0.55s ease both;
}

.rb-fade-in-delay {
    animation: rbFadeIn 0.65s ease 0.08s both;
}

@keyframes rbFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .rb-fade-in,
    .rb-fade-in-delay {
        animation: none;
    }

    .rb-spotlight-card::before {
        display: none;
    }

    .rb-marquee__track {
        animation: none !important;
        transform: none !important;
    }

    .rb-tilt-card {
        transform: none !important;
    }
}

/* ── Retro Grid (React Bits) ── */
.rb-retro-grid {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.rb-retro-grid__plane {
    position: absolute;
    left: -50%;
    right: -50%;
    bottom: -30%;
    height: 80%;
    transform-origin: center bottom;
    transform: perspective(520px) rotateX(72deg);
    background-image:
        linear-gradient(rgb(56 189 248 / 0.45) 1px, transparent 1px),
        linear-gradient(90deg, rgb(56 189 248 / 0.45) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(to top, black 0%, transparent 88%);
    -webkit-mask-image: linear-gradient(to top, black 0%, transparent 88%);
    animation: rbRetroGridScroll 18s linear infinite;
}

.rb-retro-grid__plane--subtle {
    opacity: 0.35;
    background-image:
        linear-gradient(rgb(37 99 235 / 0.22) 1px, transparent 1px),
        linear-gradient(90deg, rgb(37 99 235 / 0.22) 1px, transparent 1px);
    animation-duration: 28s;
}

@keyframes rbRetroGridScroll {
    from { background-position: 0 0; }
    to { background-position: 0 48px; }
}

/* ── GradientText (React Bits) ── */
.rb-gradient-text {
    display: inline-block;
    background: linear-gradient(135deg, #38bdf8 0%, #818cf8 45%, #22d3ee 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ── TiltCard (React Bits) ── */
.rb-tilt-card {
    transition: transform 0.15s ease, box-shadow 0.25s ease;
    will-change: transform;
}

.rb-tilt-card:hover {
    box-shadow:
        0 16px 40px rgb(37 99 235 / 0.14),
        0 0 0 1px rgb(37 99 235 / 0.12);
}

@media (prefers-reduced-motion: reduce) {
    .rb-retro-grid__plane {
        animation: none;
    }

    .rb-gradient-text {
        background: none;
        -webkit-background-clip: unset;
        background-clip: unset;
        color: #38bdf8;
    }
}

@media (max-width: 900px) {
    .rb-auth-split-full {
        grid-template-columns: 1fr;
        grid-template-rows: auto minmax(280px, 42vh);
    }

    .rb-auth-panel {
        order: 1;
        padding: 2rem 1.25rem;
    }

    .rb-auth-visual {
        order: 2;
        min-height: 280px;
    }

    .rb-auth-visual-caption {
        padding: 1.5rem 1.25rem 1.25rem;
    }
}

@media (max-width: 480px) {
    .rb-auth-content {
        max-width: 100%;
    }

    .rb-auth-panel .auth-card {
        padding: 1.75rem 1.25rem;
    }

    .rb-glass-card.auth-card {
        padding: 1.75rem 1.25rem;
    }
}
