/* orbitara global styles. Loaded AFTER static/tailwind.css so later rules
   keep winning equal-specificity cascade battles (e.g. .navbar glass
   background over the component-layer @apply bg-white). */
* {
    font-family: "Poppins", sans-serif;
}

.gradient-orbitara {
    background: linear-gradient(135deg, #4338ca 0%, #7c3aed 100%);
}

.text-gradient {
    background: linear-gradient(135deg, #4338ca, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* ── Orbital scene (planets + stars) ── */
.orbit-scene {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    user-select: none;
}

.orbit-scene--lg {
    width: min(420px, 90vw);
    height: min(420px, 90vw);
    margin: 0 auto 2rem;
}

.orbit-scene--sm {
    width: 200px;
    height: 200px;
    margin: 0 auto 1.5rem;
}

.orbit-stars {
    position: absolute;
    inset: -10%;
    overflow: hidden;
}

.orbit-star {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #c7d2fe;
    box-shadow: 0 0 6px #a5b4fc;
    animation: star-twinkle 3s ease-in-out infinite;
}

.orbit-star--0 {
    top: 8%;
    left: 12%;
    animation-delay: 0s;
}
.orbit-star--1 {
    top: 18%;
    left: 78%;
    animation-delay: 0.4s;
    width: 2px;
    height: 2px;
}
.orbit-star--2 {
    top: 72%;
    left: 8%;
    animation-delay: 0.8s;
}
.orbit-star--3 {
    top: 84%;
    left: 65%;
    animation-delay: 1.2s;
    width: 2px;
    height: 2px;
}
.orbit-star--4 {
    top: 42%;
    left: 4%;
    animation-delay: 1.6s;
}
.orbit-star--5 {
    top: 55%;
    left: 92%;
    animation-delay: 2s;
}
.orbit-star--6 {
    top: 28%;
    left: 48%;
    animation-delay: 0.6s;
    width: 2px;
    height: 2px;
}
.orbit-star--7 {
    top: 62%;
    left: 38%;
    animation-delay: 1.4s;
}

.orbit-scene--on-dark .orbit-star {
    background: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.orbit-scene--on-dark .orbit-ring {
    border-color: rgba(255, 255, 255, 0.18);
}

.orbit-system {
    position: relative;
    width: 100%;
    height: 100%;
}

.orbit-sun {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
}

.orbit-sun-core {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: radial-gradient(
        circle at 32% 28%,
        #fef3c7 0%,
        #fbbf24 35%,
        #f59e0b 65%,
        #ea580c 100%
    );
    box-shadow:
        0 0 30px rgba(251, 191, 36, 0.7),
        0 0 60px rgba(234, 88, 12, 0.35),
        inset -4px -4px 12px rgba(180, 83, 9, 0.4);
    animation: sun-pulse 4s ease-in-out infinite;
}

.orbit-scene--sm .orbit-sun-core {
    width: 36px;
    height: 36px;
}

.orbit-sun-glow {
    position: absolute;
    inset: -20px;
    border-radius: 50%;
    background: radial-gradient(
        circle,
        rgba(251, 191, 36, 0.25) 0%,
        transparent 70%
    );
    animation: sun-pulse 4s ease-in-out infinite reverse;
}

.orbit-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: orbit-spin linear infinite;
}

.orbit-ring--1 {
    width: 38%;
    height: 38%;
    animation-duration: 10s;
}
.orbit-ring--2 {
    width: 52%;
    height: 52%;
    animation-duration: 16s;
    animation-direction: reverse;
}
.orbit-ring--3 {
    width: 68%;
    height: 68%;
    animation-duration: 24s;
}
.orbit-ring--4 {
    width: 88%;
    height: 88%;
    animation-duration: 36s;
    animation-direction: reverse;
}

.orbit-body {
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    box-shadow: inset -2px -2px 6px rgba(0, 0, 0, 0.2);
}

.orbit-body--offset {
    left: 35%;
    top: 0%;
}
.orbit-body--offset-2 {
    left: 70%;
    top: 100%;
    transform: translate(-50%, -50%);
}

.orbit-body--mercury {
    width: 10px;
    height: 10px;
    background: radial-gradient(
        circle at 30% 30%,
        #e0e7ff,
        #818cf8
    );
}

.orbit-body--violet {
    width: 16px;
    height: 16px;
    background: radial-gradient(
        circle at 30% 30%,
        #ede9fe,
        #8b5cf6
    );
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.orbit-body--asteroid {
    width: 6px;
    height: 6px;
    background: #94a3b8;
    border-radius: 40%;
}

.orbit-body--coral {
    width: 20px;
    height: 20px;
    background: radial-gradient(
        circle at 30% 30%,
        #fecdd3,
        #f43f5e
    );
    box-shadow: 0 0 14px rgba(244, 63, 94, 0.4);
}

.orbit-body--mint {
    width: 12px;
    height: 12px;
    background: radial-gradient(
        circle at 30% 30%,
        #ccfbf1,
        #14b8a6
    );
}

.orbit-body--indigo {
    width: 14px;
    height: 14px;
    background: radial-gradient(
        circle at 30% 30%,
        #c7d2fe,
        #4338ca
    );
    box-shadow: 0 0 10px rgba(67, 56, 202, 0.45);
}

.orbit-scene--sm .orbit-body--mercury {
    width: 7px;
    height: 7px;
}
.orbit-scene--sm .orbit-body--violet {
    width: 11px;
    height: 11px;
}
.orbit-scene--sm .orbit-body--coral {
    width: 13px;
    height: 13px;
}
.orbit-scene--sm .orbit-body--mint {
    width: 8px;
    height: 8px;
}
.orbit-scene--sm .orbit-body--indigo {
    width: 10px;
    height: 10px;
}
.orbit-scene--sm .orbit-body--asteroid {
    width: 4px;
    height: 4px;
}

@keyframes orbit-spin {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes sun-pulse {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.06);
        opacity: 0.92;
    }
}

@keyframes star-twinkle {
    0%,
    100% {
        opacity: 0.35;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.3);
    }
}

.hero-orbit-wrap {
    position: relative;
    overflow: hidden;
}

.hero-orbit-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(
            ellipse 80% 60% at 50% 40%,
            rgba(99, 102, 241, 0.08) 0%,
            transparent 70%
        ),
        radial-gradient(
            circle at 20% 80%,
            rgba(167, 139, 250, 0.06) 0%,
            transparent 40%
        ),
        radial-gradient(
            circle at 80% 20%,
            rgba(244, 63, 94, 0.05) 0%,
            transparent 35%
        );
    pointer-events: none;
}

.auth-orbit-panel {
    background: linear-gradient(
        160deg,
        #1e1b4b 0%,
        #312e81 45%,
        #4c1d95 100%
    );
    position: relative;
    overflow: hidden;
}

.auth-orbit-panel .orbit-scene--sm {
    opacity: 0.9;
}

.auth-orbit-panel .orbit-ring {
    border-color: rgba(199, 210, 254, 0.15);
}

/* ─────────────────────────────────────────────
           Visual effects
        ───────────────────────────────────────────── */

/* Animated brand gradient text */
.text-gradient-animate {
    background: linear-gradient(
        135deg,
        #4338ca,
        #7c3aed,
        #f43f5e,
        #4338ca
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradient-shift 9s ease infinite;
}
@keyframes gradient-shift {
    0%,
    100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

/* Scroll reveal */
.reveal {
    opacity: 0;
    transform: translateY(26px);
    transition:
        opacity 0.7s cubic-bezier(0.2, 0.7, 0.2, 1),
        transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}
.reveal.in-view {
    opacity: 1;
    transform: none;
}

/* Glass navbar */
.navbar {
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    background: rgba(255, 255, 255, 0.72);
    transition:
        background 0.3s,
        box-shadow 0.3s,
        border-color 0.3s;
}
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 8px 30px -12px rgba(67, 56, 202, 0.28);
}
.dark .navbar {
    background: rgba(13, 11, 34, 0.6);
    border-color: rgba(129, 140, 248, 0.12);
}
.dark .navbar.scrolled {
    background: rgba(13, 11, 34, 0.88);
    box-shadow: 0 8px 30px -12px rgba(0, 0, 0, 0.6);
}

/* Button shine sweep */
.btn-primary {
    position: relative;
    overflow: hidden;
}
.btn-primary::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 55%;
    height: 100%;
    background: linear-gradient(
        120deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}
.btn-primary:hover::after {
    left: 150%;
}

/* Thought card lift + entrance/exit */
.thought-card {
    position: relative;
}
.thought-card:hover {
    transform: translateY(-4px);
}
@keyframes card-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.thought-card.card-enter {
    animation: card-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.thought-card.card-leave {
    overflow: hidden;
    animation: card-out 0.42s ease forwards;
}
@keyframes card-out {
    to {
        opacity: 0;
        transform: translateX(48px) scale(0.95);
        max-height: 0;
        margin-top: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
    }
}

.dark .cat-strength {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
}
.dark .cat-energy {
    background: rgba(245, 158, 11, 0.18);
    color: #fcd34d;
}
.dark .cat-advice {
    background: rgba(20, 184, 166, 0.18);
    color: #5eead4;
}
.dark .cat-unique {
    background: rgba(139, 92, 246, 0.18);
    color: #ddd6fe;
}
.dark .cat-freeform {
    background: rgba(148, 163, 184, 0.18);
    color: #cbd5e1;
}

.thought-card[data-cat="strength"] {
    border-left: 3px solid #6366f1;
}
.thought-card[data-cat="energy"] {
    border-left: 3px solid #f59e0b;
}
.thought-card[data-cat="advice"] {
    border-left: 3px solid #14b8a6;
}
.thought-card[data-cat="unique"] {
    border-left: 3px solid #8b5cf6;
}
.thought-card[data-cat="freeform"] {
    border-left: 3px solid #94a3b8;
}

/* React button + burst */
.react-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #9ca3af;
    background: transparent;
    border: 1px solid transparent;
    transition:
        color 0.2s,
        background 0.2s;
    cursor: pointer;
}
.react-btn:hover {
    color: #f43f5e;
    background: rgba(244, 63, 94, 0.08);
}
.react-btn.reacted {
    color: #f43f5e;
}
.react-btn svg {
    transition: transform 0.25s cubic-bezier(0.2, 1.4, 0.5, 1);
}
.react-btn.pop svg {
    transform: scale(1.45);
}
.react-particle {
    position: fixed;
    pointer-events: none;
    z-index: 120;
    font-size: 0.85rem;
    animation: react-float 0.8s ease-out forwards;
}
@keyframes react-float {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(0.6);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx, 0), -30px) scale(1.1);
    }
}

/* Toasts */
#toast-stack {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.toast {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: #fff;
    color: #1f2937;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-left: 4px solid #6366f1;
    border-radius: 0.9rem;
    padding: 0.8rem 1.1rem;
    box-shadow: 0 12px 30px -8px rgba(30, 27, 75, 0.35);
    transform: translateX(120%);
    opacity: 0;
    transition:
        transform 0.4s cubic-bezier(0.2, 0.7, 0.2, 1),
        opacity 0.4s;
    min-width: 220px;
    max-width: 340px;
    font-weight: 500;
}
.toast.show {
    transform: none;
    opacity: 1;
}
.toast.success {
    border-left-color: #10b981;
}
.toast.error {
    border-left-color: #ef4444;
}
.dark .toast {
    background: #14132b;
    color: #e5e7eb;
    border-color: rgba(129, 140, 248, 0.2);
}

/* Confirm modal */
#modal-root {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
}
#modal-root.open {
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 12, 41, 0.55);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s;
}
#modal-root.open .modal-backdrop {
    opacity: 1;
}
.modal-card {
    position: relative;
    background: #fff;
    border-radius: 1.25rem;
    padding: 1.75rem;
    max-width: 380px;
    width: calc(100% - 2rem);
    box-shadow: 0 30px 60px -15px rgba(30, 27, 75, 0.5);
    transform: scale(0.92) translateY(10px);
    opacity: 0;
    transition:
        transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.25),
        opacity 0.3s;
}
#modal-root.open .modal-card {
    transform: none;
    opacity: 1;
}
.dark .modal-card {
    background: #14132b;
    color: #e5e7eb;
}

/* Circle chat room (uncommon layout utilities are missing from the
   prebuilt Tailwind, so the scroll/wrap behaviour lives here) */
#chat-load-older[hidden], #chat-latest[hidden], #chat-status[hidden] {
    display: none;
}
.chat-scroll {
    max-height: 26rem;
    overflow-y: auto;
}
.chat-bubble {
    max-width: min(26rem, 85%);
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}
.chat-meta {
    opacity: 0.75;
}

/* Stat card hover */
.stat-card {
    transition:
        transform 0.25s,
        box-shadow 0.25s;
}
.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -16px rgba(67, 56, 202, 0.4);
}

/* Shooting stars in hero */
.shooting-star {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px 1px rgba(255, 255, 255, 0.8);
    opacity: 0;
    z-index: 5;
}
.shooting-star::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 0;
    width: 60px;
    height: 1px;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.7),
        transparent
    );
    transform: translateY(-50%);
}
@keyframes shoot {
    0% {
        opacity: 0;
        transform: translate(0, 0) rotate(18deg);
    }
    12% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate(-340px, 150px) rotate(18deg);
    }
}

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 9999px;
    color: #6366f1;
    transition:
        background 0.2s,
        color 0.2s,
        transform 0.4s;
}
.theme-toggle:hover {
    background: rgba(99, 102, 241, 0.12);
}
.theme-toggle:active {
    transform: rotate(40deg);
}
.dark .theme-toggle {
    color: #fcd34d;
}

/* ── Dark theme surfaces ── */
.dark .thought-card {
    background: #14132b;
    border-color: rgba(129, 140, 248, 0.14);
}
.dark .input-field {
    background: #14132b;
    border-color: rgba(129, 140, 248, 0.22);
    color: #e5e7eb;
}
.dark .input-field:focus {
    border-color: #818cf8;
}
.dark .btn-secondary {
    background: transparent;
    color: #c7d2fe;
    border-color: #6366f1;
}
.dark .btn-secondary:hover {
    background: rgba(99, 102, 241, 0.12);
}
.dark .btn-ghost {
    color: #cbd5e1;
}
.dark .btn-ghost:hover {
    background: rgba(148, 163, 184, 0.12);
}
.dark .bg-white {
    background-color: #14132b;
}
.dark .text-gray-900 {
    color: #f3f4f6;
}
.dark .text-gray-700 {
    color: #cbd5e1;
}
.dark .text-gray-600 {
    color: #9ca3af;
}
.dark .text-gray-500 {
    color: #9ca3af;
}
.dark .bg-gray-100 {
    background-color: rgba(148, 163, 184, 0.14);
}
.dark .bg-gray-200 {
    background-color: rgba(148, 163, 184, 0.2);
}
.dark .border-indigo-50,
.dark .border-indigo-100 {
    border-color: rgba(129, 140, 248, 0.14);
}
.dark .border-gray-100 {
    border-color: rgba(129, 140, 248, 0.1);
}

@media (prefers-reduced-motion: reduce) {
    .orbit-ring,
    .orbit-sun-core,
    .orbit-sun-glow,
    .orbit-star,
    .text-gradient-animate,
    .shooting-star,
    .btn-primary::after {
        animation: none !important;
        transition: none !important;
    }
    .reveal {
        opacity: 1;
        transform: none;
    }
    .thought-card:hover {
        transform: none;
    }
}
