/* ============================================
   NOVARA AI — Chat Widget Styles
   Floating pill + expandable chat window
   + live mockup integration for index.html
   ============================================ */

/* ── Floating Pill ── */
#novara-ai-pill {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: rgba(8, 8, 14, 0.95);
    border: 1px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    z-index: 99998;
    backdrop-filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    animation: novara-pill-enter 0.8s cubic-bezier(0.23, 1, 0.32, 1) 1s both;
    user-select: none;
    -webkit-user-select: none;
    overflow: visible;
}

/* Rotating gradient border */
#novara-ai-pill::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border-radius: 50px;
    background: conic-gradient(
        from var(--novara-pill-angle, 0deg),
        #00f0ff 0%,
        #8b5cf6 25%,
        #00f0ff 50%,
        #f472b6 75%,
        #00f0ff 100%
    );
    z-index: -2;
    animation: novara-border-rotate 4s linear infinite;
    opacity: 0.7;
}

/* Inner background to cover the gradient (creating border effect) */
#novara-ai-pill::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    bottom: 1px;
    border-radius: 50px;
    background: rgba(8, 8, 14, 0.95);
    z-index: -1;
}

@property --novara-pill-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}

@keyframes novara-border-rotate {
    0% { --novara-pill-angle: 0deg; }
    100% { --novara-pill-angle: 360deg; }
}

/* Outer glow aura */
#novara-ai-pill {
    box-shadow:
        0 0 15px rgba(0, 240, 255, 0.15),
        0 0 40px rgba(0, 240, 255, 0.08),
        0 0 80px rgba(139, 92, 246, 0.05),
        0 4px 30px rgba(0, 0, 0, 0.4);
    animation: novara-pill-enter 0.8s cubic-bezier(0.23, 1, 0.32, 1) 1s both,
               novara-pill-breathe 4s ease-in-out infinite 2s;
}

@keyframes novara-pill-enter {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes novara-pill-breathe {
    0%, 100% {
        box-shadow:
            0 0 15px rgba(0, 240, 255, 0.15),
            0 0 40px rgba(0, 240, 255, 0.08),
            0 0 80px rgba(139, 92, 246, 0.05),
            0 4px 30px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow:
            0 0 25px rgba(0, 240, 255, 0.25),
            0 0 60px rgba(0, 240, 255, 0.12),
            0 0 100px rgba(139, 92, 246, 0.08),
            0 4px 30px rgba(0, 0, 0, 0.4);
    }
}

#novara-ai-pill:hover {
    transform: translateY(-3px) scale(1.03);
    box-shadow:
        0 0 30px rgba(0, 240, 255, 0.3),
        0 0 60px rgba(0, 240, 255, 0.15),
        0 0 100px rgba(139, 92, 246, 0.1),
        0 8px 40px rgba(0, 0, 0, 0.5);
}

#novara-ai-pill:hover::before {
    opacity: 1;
    animation: novara-border-rotate 2s linear infinite;
}

#novara-ai-pill:active {
    transform: translateY(0) scale(0.97);
}

/* Pill icon */
.novara-pill-icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.novara-pill-icon img {
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4));
    animation: novara-icon-pulse 3s ease-in-out infinite;
}

.novara-pill-icon svg {
    width: 18px;
    height: 18px;
    color: #00f0ff;
    filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.5));
    animation: novara-icon-pulse 3s ease-in-out infinite;
}

@keyframes novara-icon-pulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.4)); transform: scale(1); }
    50% { filter: drop-shadow(0 0 12px rgba(139, 92, 246, 0.7)); transform: scale(1.08); }
}

/* Pill text */
.novara-pill-text {
    font-family: 'Outfit', -apple-system, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #f0f0f5;
    white-space: nowrap;
    letter-spacing: 0.02em;
    background: linear-gradient(90deg, #f0f0f5 0%, #00f0ff 50%, #f0f0f5 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: novara-text-shimmer 6s linear infinite;
}

@keyframes novara-text-shimmer {
    0% { background-position: 200% center; }
    100% { background-position: -200% center; }
}

/* Pill live dot */
.novara-pill-dot {
    width: 7px;
    height: 7px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
    animation: novara-dot-pulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes novara-dot-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
    50% { opacity: 0.5; box-shadow: 0 0 4px rgba(34, 197, 94, 0.3); }
}

/* Hide pill when chat is open */
#novara-ai-pill.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    pointer-events: none;
}

/* ── Chat Window ── */
#novara-ai-window {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 400px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 80px);
    background: #0a0a0f;
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    box-shadow:
        0 25px 80px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(0, 240, 255, 0.08);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.35s cubic-bezier(0.23, 1, 0.32, 1),
                transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}

#novara-ai-window.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Window header */
.novara-ai-header {
    padding: 16px 20px;
    background: rgba(12, 12, 18, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

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

.novara-ai-header-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #00f0ff 0%, #8b5cf6 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.novara-ai-header-icon svg {
    width: 20px;
    height: 20px;
    color: #030305;
}

.novara-ai-header-info h3 {
    margin: 0;
    font-family: 'Syne', 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.novara-ai-header-info span {
    font-size: 0.7rem;
    color: #22c55e;
    display: flex;
    align-items: center;
    gap: 5px;
    font-family: 'JetBrains Mono', monospace;
}

.novara-ai-header-info span::before {
    content: '';
    width: 5px;
    height: 5px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
    display: inline-block;
}

.novara-ai-close {
    width: 32px;
    height: 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: rgba(10, 10, 15, 0.9);
    color: #00f0ff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 12px rgba(0, 240, 255, 0.15),
        0 0 25px rgba(139, 92, 246, 0.08);
    animation: novara-close-glow 3s ease-in-out infinite;
}

@keyframes novara-close-glow {
    0%, 100% {
        box-shadow:
            0 0 12px rgba(0, 240, 255, 0.15),
            0 0 25px rgba(139, 92, 246, 0.08);
    }
    50% {
        box-shadow:
            0 0 20px rgba(0, 240, 255, 0.3),
            0 0 40px rgba(139, 92, 246, 0.15);
    }
}

.novara-ai-close::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 8px;
    background: conic-gradient(
        from 0deg,
        rgba(0, 240, 255, 0.3) 0%,
        rgba(139, 92, 246, 0.3) 33%,
        rgba(244, 114, 182, 0.3) 66%,
        rgba(0, 240, 255, 0.3) 100%
    );
    z-index: -1;
    animation: novara-close-border-spin 4s linear infinite;
}

@keyframes novara-close-border-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.novara-ai-close svg {
    width: 16px;
    height: 16px;
    transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
    filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.5));
    animation: novara-close-x-spin 8s linear infinite;
}

@keyframes novara-close-x-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.novara-ai-close:hover {
    transform: scale(1.15);
    box-shadow:
        0 0 25px rgba(0, 240, 255, 0.4),
        0 0 50px rgba(139, 92, 246, 0.2);
}

.novara-ai-close:hover svg {
    animation: novara-close-x-spin 2s linear infinite;
    filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.8));
}

.novara-ai-close:active {
    transform: scale(0.9);
}

/* Messages area */
.novara-ai-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

.novara-ai-messages::-webkit-scrollbar { width: 4px; }
.novara-ai-messages::-webkit-scrollbar-track { background: transparent; }
.novara-ai-messages::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 10px; }

/* Message bubbles */
.novara-ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    line-height: 1.6;
    word-wrap: break-word;
    animation: novara-msg-in 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes novara-msg-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.novara-ai-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(0, 240, 255, 0.2);
    color: #f0f0f5;
    border-bottom-right-radius: 4px;
}

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

.novara-ai-msg.assistant strong { color: #00f0ff; }
.novara-ai-msg.assistant em { color: #9898a8; }

/* Welcome message */
.novara-ai-msg.welcome {
    align-self: flex-start;
    background: transparent;
    border: 1px dashed rgba(0, 240, 255, 0.15);
    color: #9898a8;
    max-width: 92%;
    font-size: 0.85rem;
}

/* Typing indicator */
.novara-ai-typing-indicator {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}

.novara-ai-typing-indicator span {
    width: 6px;
    height: 6px;
    background: #5a5a6a;
    border-radius: 50%;
    animation: novara-typing-bounce 1.4s ease-in-out infinite;
}

.novara-ai-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.novara-ai-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes novara-typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Error message */
.novara-ai-msg.error {
    align-self: center;
    background: rgba(255, 80, 80, 0.08);
    border: 1px solid rgba(255, 80, 80, 0.15);
    color: #ff6b6b;
    font-size: 0.82rem;
    text-align: center;
    max-width: 90%;
}

/* Input area */
.novara-ai-input-area {
    padding: 14px 16px;
    background: rgba(12, 12, 18, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 10px;
    align-items: flex-end;
    flex-shrink: 0;
}

.novara-ai-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #f0f0f5;
    font-family: 'Outfit', sans-serif;
    font-size: 0.88rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 42px;
    max-height: 100px;
    transition: border-color 0.3s ease;
}

.novara-ai-input-area textarea::placeholder {
    color: #5a5a6a;
}

.novara-ai-input-area textarea:focus {
    border-color: rgba(0, 240, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(0, 240, 255, 0.08);
}

.novara-ai-send {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #00f0ff 0%, #8b5cf6 100%);
    color: #030305;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.novara-ai-send:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.3);
}

.novara-ai-send:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.novara-ai-send svg {
    width: 18px;
    height: 18px;
}

/* Footer */
.novara-ai-footer {
    padding: 8px 16px;
    text-align: center;
    font-size: 0.68rem;
    color: #5a5a6a;
    background: rgba(12, 12, 18, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

/* ── Index Page: Live Mockup ── */
.ai-chat-live {
    display: flex;
    flex-direction: column;
    height: 280px;
}

.ai-chat-live .ai-chat-messages-live {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
    scroll-behavior: smooth;
}

.ai-chat-live .ai-chat-messages-live::-webkit-scrollbar { width: 3px; }
.ai-chat-live .ai-chat-messages-live::-webkit-scrollbar-track { background: transparent; }
.ai-chat-live .ai-chat-messages-live::-webkit-scrollbar-thumb { background: rgba(139, 92, 246, 0.2); border-radius: 10px; }

.ai-chat-live .ai-chat-input-live {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    padding-top: 10px;
    border-top: 1px solid rgba(139, 92, 246, 0.1);
    margin-top: 8px;
}

.ai-chat-live .ai-chat-input-live textarea {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 8px;
    color: #f0f0f5;
    font-family: 'Outfit', sans-serif;
    font-size: 0.82rem;
    line-height: 1.5;
    resize: none;
    outline: none;
    min-height: 38px;
    max-height: 80px;
    transition: border-color 0.3s ease;
}

.ai-chat-live .ai-chat-input-live textarea::placeholder {
    color: #5a5a6a;
}

.ai-chat-live .ai-chat-input-live textarea:focus {
    border-color: rgba(139, 92, 246, 0.4);
}

.ai-chat-live .ai-chat-send-live {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #8b5cf6, #00f0ff);
    color: #030305;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.ai-chat-live .ai-chat-send-live:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.ai-chat-live .ai-chat-send-live:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.ai-chat-live .ai-chat-send-live svg {
    width: 16px;
    height: 16px;
}

/* Live mockup message styles (reuse existing .ai-message) */
.ai-chat-live .ai-message {
    animation: novara-msg-in 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.ai-chat-live .ai-message.assistant strong { color: #8b5cf6; }

/* Live mockup typing */
.ai-chat-live .novara-ai-typing-indicator {
    align-self: flex-start;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    padding: 10px 14px;
}

/* ── Mobile Responsive ── */
@media (max-width: 480px) {
    #novara-ai-window {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        border: none;
    }

    #novara-ai-pill {
        bottom: 20px;
        right: 16px;
        padding: 10px 18px;
    }

    .novara-pill-text { font-size: 0.8rem; }

    .novara-ai-header { padding: 14px 16px; }
    .novara-ai-messages { padding: 16px 12px; }
    .novara-ai-input-area { padding: 12px; }
}

@media (max-width: 768px) {
    .ai-chat-live { height: 250px; }
}
