/**
 * AURA Widget — ALNYRA Unified Response Assistant
 * Premium glass orb mascot with gold halo
 * 
 * CSS Variables (Tokens):
 * --aura-bg: Background color
 * --aura-gold: Primary gold accent
 * --aura-size: Orb size
 * --aura-shadow: Box shadow
 * --aura-glow: Glow effect
 */

/* ========== CSS VARIABLES ========== */
:root {
    --aura-bg: #0a0a0c;
    --aura-bg-secondary: #18181b;
    --aura-gold: #DFB837;
    --aura-gold-light: #F5D25E;
    --aura-gold-dark: #B8941E;
    --aura-size: 56px;
    --aura-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --aura-glow: 0 0 20px rgba(223, 184, 55, 0.3);
    --aura-text: #ffffff;
    --aura-text-muted: #a1a1aa;
    --aura-border: rgba(255, 255, 255, 0.08);
    --aura-panel-bg: rgba(24, 24, 27, 0.95);
}

/* ========== AURA CONTAINER ========== */
.aura-widget {
    position: fixed;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    pointer-events: none;
}

.aura-widget * {
    box-sizing: border-box;
}

.aura-widget.bottom-right {
    bottom: var(--aura-margin-y, 24px);
    right: var(--aura-margin-x, 24px);
}

.aura-widget.bottom-left {
    bottom: var(--aura-margin-y, 24px);
    left: var(--aura-margin-x, 24px);
}

/* ========== ORB STYLES ========== */
.aura-orb {
    width: var(--aura-size);
    height: var(--aura-size);
    position: relative;
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.3s ease;
}

.aura-orb:hover {
    transform: scale(1.08);
}

.aura-orb:active {
    transform: scale(0.96);
}

/* The glass sphere */
.aura-orb-core {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    border-radius: 50%;
    background: radial-gradient(ellipse at 35% 35%,
            #3a3a42 0%,
            #1a1a1e 40%,
            #0a0a0c 100%);
    box-shadow:
        inset 0 -4px 12px rgba(0, 0, 0, 0.5),
        var(--aura-shadow);
}

/* Glass highlight reflection */
.aura-orb-highlight {
    position: absolute;
    top: 28%;
    left: 25%;
    width: 35%;
    height: 22%;
    background: radial-gradient(ellipse at center,
            rgba(255, 255, 255, 0.3) 0%,
            transparent 70%);
    border-radius: 50%;
    transform: rotate(-20deg);
}

/* A-shaped eye slit */
.aura-orb-eye {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    opacity: 0.7;
}

.aura-orb-eye svg {
    width: 100%;
    height: 100%;
}

/* Gold halo ring */
.aura-halo {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    transform: translate(-50%, -50%);
    border: 2.5px solid transparent;
    border-radius: 50%;
    background: linear-gradient(var(--aura-bg), var(--aura-bg)) padding-box,
        linear-gradient(135deg, var(--aura-gold-light), var(--aura-gold), var(--aura-gold-dark)) border-box;
    animation: aura-halo-orbit 8s linear infinite;
    box-shadow: var(--aura-glow);
}

.aura-orb:hover .aura-halo {
    animation-duration: 4s;
}

/* Inner subtle ring */
.aura-halo-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 68%;
    height: 68%;
    transform: translate(-50%, -50%);
    border: 0.5px solid var(--aura-gold);
    border-radius: 50%;
    opacity: 0.3;
}

/* ========== ANIMATIONS ========== */

/* Premium multi-layer aura glow animation for outer ring */
@keyframes aura-halo-orbit {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        box-shadow:
            0 0 15px rgba(223, 184, 55, 0.4),
            0 0 30px rgba(223, 184, 55, 0.2),
            0 0 60px rgba(223, 184, 55, 0.1);
    }

    25% {
        box-shadow:
            0 0 20px rgba(245, 210, 94, 0.5),
            0 0 45px rgba(223, 184, 55, 0.3),
            0 0 80px rgba(223, 184, 55, 0.15);
    }

    50% {
        box-shadow:
            0 0 30px rgba(245, 210, 94, 0.6),
            0 0 60px rgba(223, 184, 55, 0.35),
            0 0 100px rgba(223, 184, 55, 0.2),
            0 0 140px rgba(184, 148, 30, 0.1);
    }

    75% {
        box-shadow:
            0 0 20px rgba(245, 210, 94, 0.5),
            0 0 45px rgba(223, 184, 55, 0.3),
            0 0 80px rgba(223, 184, 55, 0.15);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        box-shadow:
            0 0 15px rgba(223, 184, 55, 0.4),
            0 0 30px rgba(223, 184, 55, 0.2),
            0 0 60px rgba(223, 184, 55, 0.1);
    }
}

/* Premium shimmer pulse effect */
@keyframes aura-glow-pulse {

    0%,
    100% {
        filter: drop-shadow(0 0 10px rgba(223, 184, 55, 0.35)) drop-shadow(0 0 25px rgba(223, 184, 55, 0.15));
    }

    33% {
        filter: drop-shadow(0 0 15px rgba(245, 210, 94, 0.5)) drop-shadow(0 0 35px rgba(223, 184, 55, 0.25));
    }

    66% {
        filter: drop-shadow(0 0 20px rgba(245, 210, 94, 0.55)) drop-shadow(0 0 45px rgba(223, 184, 55, 0.3)) drop-shadow(0 0 70px rgba(184, 148, 30, 0.15));
    }
}

.aura-orb {
    animation: aura-glow-pulse 4s ease-in-out infinite;
}

/* Organic breathing animation for inner core */
@keyframes aura-breathing {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.88;
        box-shadow:
            inset 0 -4px 12px rgba(0, 0, 0, 0.5),
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 20px rgba(223, 184, 55, 0.08);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.04);
        opacity: 1;
        box-shadow:
            inset 0 -4px 12px rgba(0, 0, 0, 0.5),
            0 8px 32px rgba(0, 0, 0, 0.4),
            0 0 35px rgba(223, 184, 55, 0.18);
    }
}

.aura-orb-core {
    animation: aura-breathing 3.5s ease-in-out infinite;
}

/* Subtle highlight shimmer */
@keyframes aura-highlight-shimmer {

    0%,
    100% {
        opacity: 0.3;
        transform: rotate(-20deg) scale(1);
    }

    50% {
        opacity: 0.45;
        transform: rotate(-18deg) scale(1.05);
    }
}

.aura-orb-highlight {
    animation: aura-highlight-shimmer 5s ease-in-out infinite;
}

/* Eye pulse for awareness indicator */
@keyframes aura-eye-pulse {

    0%,
    100% {
        opacity: 0.7;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

.aura-orb-eye {
    animation: aura-eye-pulse 3s ease-in-out infinite;
}

/* Nudge animation for triggers */
@keyframes aura-nudge {

    0%,
    100% {
        transform: scale(1);
    }

    10% {
        transform: scale(1.15);
    }

    20% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.1);
    }

    40% {
        transform: scale(1);
    }
}

.aura-orb.nudge {
    animation: aura-nudge 1s ease-in-out;
}

/* ========== TOOLTIP ========== */
.aura-tooltip {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    background: var(--aura-panel-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--aura-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--aura-text);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.2s ease;
    pointer-events: none;
    box-shadow: var(--aura-shadow);
}

.aura-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--aura-panel-bg);
}

.aura-orb:hover .aura-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ========== PANEL ========== */
.aura-panel {
    position: absolute;
    bottom: calc(100% + 16px);
    right: 0;
    width: 280px;
    background: var(--aura-panel-bg);
    backdrop-filter: blur(24px);
    border: 1px solid var(--aura-border);
    border-radius: 16px;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.95);
    transform-origin: bottom right;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    box-shadow:
        var(--aura-shadow),
        0 0 40px rgba(223, 184, 55, 0.1);
}

.aura-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Panel close button */
.aura-panel-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--aura-border);
    border-radius: 50%;
    color: var(--aura-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.aura-panel-close:hover {
    background: rgba(223, 184, 55, 0.1);
    border-color: rgba(223, 184, 55, 0.3);
    color: var(--aura-gold);
}

.aura-panel-close svg {
    width: 14px;
    height: 14px;
}

/* Panel header */
.aura-panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.aura-panel-logo {
    width: 32px;
    height: 32px;
}

.aura-panel-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--aura-gold);
    letter-spacing: 0.05em;
}

/* Panel content */
.aura-panel-primary {
    font-size: 15px;
    font-weight: 600;
    color: var(--aura-text);
    margin-bottom: 6px;
}

.aura-panel-secondary {
    font-size: 13px;
    color: var(--aura-text-muted);
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Panel buttons */
.aura-panel-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.aura-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.aura-btn-primary {
    background: var(--aura-gold);
    color: #0a0a0c;
}

.aura-btn-primary:hover {
    background: var(--aura-gold-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(223, 184, 55, 0.3);
}

.aura-btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--aura-text);
    border: 1px solid var(--aura-border);
}

.aura-btn-secondary:hover {
    background: rgba(223, 184, 55, 0.1);
    border-color: rgba(223, 184, 55, 0.3);
}

.aura-btn svg {
    width: 16px;
    height: 16px;
}

/* ========== HIDDEN STATE ========== */
.aura-widget.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* ========== MINIMIZED STATE ========== */
.aura-widget.minimized {
    --aura-size: 36px;
}

.aura-widget.minimized .aura-orb {
    transform: scale(0.65);
    opacity: 0.85;
}

.aura-widget.minimized .aura-orb:hover {
    transform: scale(0.72);
    opacity: 1;
}

.aura-widget.minimized .aura-halo {
    animation: none;
    opacity: 0.5;
}

.aura-widget.minimized .aura-panel,
.aura-widget.minimized .aura-tooltip,
.aura-widget.minimized .aura-offer {
    display: none !important;
}

/* ========== OFFER SURFACE ========== */
.aura-offer {
    position: absolute;
    bottom: calc(100% + 12px);
    right: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(223, 184, 55, 0.2);
    border-radius: 24px;
    padding: 10px 16px;
    max-width: 280px;
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(223, 184, 55, 0.1);
    pointer-events: all;
    animation: aura-offer-slide-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.aura-offer.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
}

.aura-offer-content {
    flex: 1;
    min-width: 0;
}

.aura-offer-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--aura-text);
    line-height: 1.4;
    display: block;
    transition: opacity 0.25s ease;
}

.aura-offer-text.fade-out {
    opacity: 0;
}

.aura-offer-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--aura-text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.aura-offer-close:hover {
    background: rgba(223, 184, 55, 0.15);
    border-color: rgba(223, 184, 55, 0.3);
    color: var(--aura-gold);
}

.aura-offer-close svg {
    width: 10px;
    height: 10px;
}

/* Offer slide-in animation */
@keyframes aura-offer-slide-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== REDUCED MOTION ========== */
@media (prefers-reduced-motion: reduce) {

    .aura-halo,
    .aura-orb,
    .aura-orb-core,
    .aura-orb-highlight,
    .aura-orb-eye {
        animation: none;
    }

    .aura-orb:hover .aura-halo {
        animation: none;
    }

    .aura-panel,
    .aura-tooltip,
    .aura-btn,
    .aura-offer {
        transition: opacity 0.1s ease;
        animation: none;
    }

    .aura-offer-text {
        transition: opacity 0.1s ease;
    }

    .aura-widget.minimized .aura-orb {
        transition: none;
    }
}

/* ========== MOBILE ADJUSTMENTS ========== */
@media (max-width: 480px) {
    .aura-panel {
        width: calc(100vw - 48px);
        right: 0;
    }

    :root {
        --aura-size: 48px;
    }

    .aura-offer {
        max-width: calc(100vw - 80px);
        right: 0;
        font-size: 12px;
        padding: 8px 12px;
    }

    .aura-widget.minimized {
        --aura-size: 32px;
    }
}