/* ==========================================================================
   MIST JARVIS AI ASSISTANT - APPLE VISIONOS & DYNAMIC ISLAND FLOATING WIDGET
   ========================================================================== */

/* Container */
#mist-jarvis-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    font-family: 'Space Grotesk', 'Inter', -apple-system, sans-serif;
    color: #F5F1E8;
    pointer-events: none;
}

#mist-jarvis-widget * {
    box-sizing: border-box;
}

/* Floating Apple Siri Intelligence Trigger */
#mist-jarvis-orb {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 7px 22px 7px 8px;
    border-radius: 9999px;
    background: rgba(10, 10, 14, 0.85);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 25px rgba(0, 195, 255, 0.15), 0 0 35px rgba(255, 120, 0, 0.12), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    cursor: pointer;
    pointer-events: auto;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.35s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

#mist-jarvis-orb:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(0, 210, 255, 0.3), 0 0 45px rgba(255, 120, 0, 0.25), inset 0 1px 2px rgba(255, 255, 255, 0.4);
}

#mist-jarvis-orb:active {
    transform: scale(0.96);
}

/* Apple Siri Chromatic Glowing Ring */
.siri-ring-container {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.siri-header-ring {
    width: 26px;
    height: 26px;
}

/* Ambient Ring Glow */
.siri-ring-ambient {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        #00F2FE 0deg,
        #4FACFE 60deg,
        #8A2BE2 120deg,
        #FF1493 180deg,
        #FF5500 240deg,
        #FFD700 300deg,
        #00F2FE 360deg
    );
    filter: blur(6px);
    opacity: 0.75;
    animation: siriRingSpin 4s linear infinite;
    pointer-events: none;
}

/* Sharp Iridescent Border Ring */
.siri-ring-border {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg at 50% 50%,
        #00F2FE 0deg,
        #4FACFE 50deg,
        #7B2CBF 110deg,
        #FF007F 170deg,
        #FF6B00 230deg,
        #FFD700 290deg,
        #00F2FE 360deg
    );
    animation: siriRingSpin 3.5s linear infinite;
}

@keyframes siriRingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Center Cut-out / Hollow Dark Core */
.siri-ring-inner {
    position: absolute;
    inset: 2.5px;
    border-radius: 50%;
    background: #08080C;
    box-shadow: 
        inset 0 0 4px rgba(255, 120, 0, 0.4),
        inset 0 0 3px rgba(0, 210, 255, 0.35);
    z-index: 2;
}

/* Siri Trigger Typography */
.siri-trigger-text {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Space Grotesk", 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 500;
    color: #FFFFFF;
    letter-spacing: -0.01em;
    white-space: nowrap;
    padding-right: 4px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Dynamic Page Awareness Tooltip Bubble */
#mist-jarvis-tooltip {
    position: absolute;
    bottom: 74px;
    right: 0;
    background: rgba(18, 18, 22, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 204, 0, 0.35);
    border-radius: 18px;
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(255, 204, 0, 0.15);
    pointer-events: auto;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transform-origin: bottom right;
    opacity: 0;
    transform: scale(0.85) translateY(10px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#mist-jarvis-tooltip.active {
    opacity: 1;
    transform: scale(1) translateY(0);
}

#mist-jarvis-tooltip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 12px;
    height: 12px;
    background: rgba(18, 18, 22, 0.92);
    border-right: 1px solid rgba(255, 204, 0, 0.35);
    border-bottom: 1px solid rgba(255, 204, 0, 0.35);
    transform: rotate(45deg);
}

/* Glassmorphic Chat Panel */
#mist-jarvis-panel {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 385px;
    height: 580px;
    max-height: calc(100vh - 40px);
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(22, 22, 26, 0.88) 0%, rgba(10, 10, 12, 0.94) 100%);
    backdrop-filter: blur(35px);
    -webkit-backdrop-filter: blur(35px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 60px rgba(255, 204, 0, 0.12);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transform: scale(0.88) translateY(30px);
    transform-origin: bottom right;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#mist-jarvis-panel.open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Panel Header */
.jarvis-header {
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    items-center: center;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.jarvis-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.jarvis-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1C1C20 0%, #0A0A0C 100%);
    border: 1px solid rgba(255, 204, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.25);
    position: relative;
}

.jarvis-avatar svg {
    width: 20px;
    height: 20px;
}

.jarvis-title-group h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #FFFFFF;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.jarvis-title-group p {
    margin: 2px 0 0;
    font-size: 11px;
    color: #8A8A8A;
    display: flex;
    align-items: center;
    gap: 5px;
}

.jarvis-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00FF88;
    box-shadow: 0 0 8px #00FF88;
}

.jarvis-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.jarvis-btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #A1A1AA;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.jarvis-btn-icon:hover {
    background: rgba(255, 204, 0, 0.15);
    color: #FFCC00;
    border-color: rgba(255, 204, 0, 0.3);
}

/* Quick Action Chips */
.jarvis-quick-actions {
    padding: 10px 16px;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
    scrollbar-width: none;
}
.jarvis-quick-actions::-webkit-scrollbar {
    display: none;
}

.jarvis-chip {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #D4D4D8;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.jarvis-chip:hover {
    background: rgba(255, 204, 0, 0.12);
    border-color: rgba(255, 204, 0, 0.4);
    color: #FFCC00;
    transform: translateY(-1px);
}

/* Messages Area */
.jarvis-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.jarvis-messages::-webkit-scrollbar {
    width: 4px;
}
.jarvis-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Message Bubble */
.jarvis-msg {
    max-width: 86%;
    padding: 11px 15px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.5;
    animation: jarvisMsgFade 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    word-break: break-word;
}

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

.jarvis-msg.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #F4F4F5;
    border-bottom-left-radius: 4px;
}

.jarvis-msg.ai strong {
    color: #FFCC00;
    font-weight: 700;
}

.jarvis-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #FFCC00 0%, #D4AF37 100%);
    color: #000000;
    font-weight: 600;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(255, 204, 0, 0.25);
}

.jarvis-msg-time {
    font-size: 9px;
    color: #71717A;
    margin-top: 4px;
    display: block;
    text-align: right;
}

.jarvis-cta-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: #FFCC00;
    color: #000000;
    font-size: 11px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.3);
}

.jarvis-cta-btn:hover {
    background: #FFE270;
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.5);
}

/* Typing Indicator */
.jarvis-typing {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 10px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.jarvis-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FFCC00;
    animation: jarvisDotBounce 1.4s infinite ease-in-out both;
}

.jarvis-typing span:nth-child(1) { animation-delay: -0.32s; }
.jarvis-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes jarvisDotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* Input Form */
.jarvis-input-area {
    padding: 12px 16px 16px;
    background: rgba(10, 10, 12, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 8px;
}

.jarvis-input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.jarvis-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 11px 16px;
    font-size: 13px;
    color: #FFFFFF;
    outline: none;
    font-family: inherit;
    transition: all 0.2s ease;
}

.jarvis-input::placeholder {
    color: #71717A;
    font-size: 12px;
}

.jarvis-input:focus {
    border-color: rgba(255, 204, 0, 0.5);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.15);
}

.jarvis-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #FFCC00;
    border: none;
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.35);
}

.jarvis-send-btn:hover {
    background: #FFE270;
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(255, 204, 0, 0.55);
}

.jarvis-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Mobile Responsive Adjustments (< 640px) */
@media (max-width: 640px) {
    #mist-jarvis-widget {
        bottom: 18px;
        right: 18px;
    }

    #mist-jarvis-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100vw;
        height: 85vh;
        max-height: 85vh;
        border-radius: 28px 28px 0 0;
        transform: translateY(100%);
    }

    #mist-jarvis-panel.open {
        transform: translateY(0);
    }
}

