/* ── Plex AI floating widget — liquiplex.com ────────────────────────────── */

#plex-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Trigger button */
#plex-trigger {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 99999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px 10px 14px;
    background: #111827;
    border: 1px solid #575afd;
    border-radius: 50px;
    color: #e5e7eb;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(87, 90, 253, 0.35);
    transition: box-shadow 0.2s ease, transform 0.15s ease;
    user-select: none;
}

#plex-trigger:hover {
    box-shadow: 0 6px 32px rgba(87, 90, 253, 0.55);
    transform: translateY(-2px);
}

/* Panel */
#plex-panel {
    position: fixed;
    bottom: 90px;
    right: 28px;
    z-index: 99999;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: 560px;
    background: #0d1321;
    border: 1px solid #1f2937;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(87, 90, 253, 0.15);
    animation: plexSlideUp 0.2s ease;
}

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

/* Header */
#plex-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: #111827;
    border-bottom: 1px solid #1f2937;
    flex-shrink: 0;
}

#plex-header-text {
    flex: 1;
    display: flex;
    flex-direction: column;
}

#plex-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f9fafb;
}

#plex-sub {
    font-size: 0.72rem;
    color: #6b7280;
    margin-top: 1px;
}

#plex-close {
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

#plex-close:hover { color: #f9fafb; }

/* Messages */
#plex-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: #1f2937 transparent;
}

.plex-msg {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.plex-msg-user {
    flex-direction: row-reverse;
}

.plex-msg-user .plex-bubble {
    background: #575afd;
    color: #fff;
    border-radius: 14px 14px 2px 14px;
    margin-left: auto;
}

.plex-msg-plex .plex-bubble {
    background: #1f2937;
    color: #e5e7eb;
    border-radius: 2px 14px 14px 14px;
}

.plex-avatar {
    width: 26px;
    height: 26px;
    background: linear-gradient(135deg, #575afd, #7783ff);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
    margin-top: 2px;
    text-align: center;
    line-height: 26px;
}

.plex-bubble {
    max-width: 80%;
    padding: 9px 13px;
    font-size: 0.84rem;
    line-height: 1.55;
}

.plex-bubble p { margin: 0 0 4px; }
.plex-bubble p:last-child { margin: 0; }
.plex-bubble a { color: #93c5fd; text-decoration: underline; }
.plex-bubble strong { color: #f9fafb; font-weight: 700; }

/* Typing indicator */
.plex-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.plex-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #575afd;
    animation: plexBounce 1.2s infinite;
    display: inline-block;
}

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

@keyframes plexBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Input row */
#plex-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #1f2937;
    background: #111827;
    flex-shrink: 0;
}

#plex-input {
    flex: 1;
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 10px;
    color: #f9fafb;
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 8px 12px;
    resize: none;
    outline: none;
    min-height: 36px;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

#plex-input::placeholder { color: #6b7280; }
#plex-input:focus { border-color: #575afd; }
#plex-input:disabled { opacity: 0.5; }

#plex-send {
    width: 36px;
    height: 36px;
    background: #575afd;
    border: none;
    border-radius: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, opacity 0.15s;
    padding: 0;
}

#plex-send:hover:not(:disabled) { background: #7783ff; }
#plex-send:disabled { opacity: 0.4; cursor: not-allowed; }

/* Disclaimer */
#plex-disclaimer {
    text-align: center;
    font-size: 0.68rem;
    color: #4b5563;
    padding: 4px 14px 8px;
    margin: 0;
    background: #111827;
}

/* Mobile */
@media (max-width: 480px) {
    #plex-panel {
        bottom: 80px;
        right: 12px;
        width: calc(100vw - 24px);
        max-height: 70vh;
    }

    #plex-trigger {
        bottom: 20px;
        right: 16px;
        padding: 9px 14px 9px 12px;
    }
}
