/* =====================================================
 * DEVEDGE AI ASSISTANT - SITE-WIDE FLOATING WIDGET & CHAT
 * ===================================================== */

/* Back to Top button coexistence */
#backToTop {
    bottom: 84px !important;
    right: 28px !important;
    z-index: 99 !important;
    width: 42px !important;
    height: 42px !important;
}

/* Floating Launcher Button */
.devedge-rag-launcher {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 100;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 20px;
    border-radius: 50px;
    background: var(--color-surface, #141719);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    color: var(--color-text, #eef0f2);
    font-family: 'Sora', sans-serif;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
}
.devedge-rag-launcher:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}
.devedge-rag-launcher-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-accent);
}
.devedge-rag-launcher-close {
    display: none;
    align-items: center;
    justify-content: center;
}
.devedge-rag-launcher.active .devedge-rag-launcher-icon {
    display: none;
}
.devedge-rag-launcher.active .devedge-rag-launcher-close {
    display: flex;
    color: var(--color-accent);
}
.devedge-rag-launcher.active {
    border-color: var(--color-accent);
    background: var(--color-surface, #141719);
}

/* Floating Chat Panel Window */
.devedge-rag-panel {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: 99999;
    width: 390px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 110px);
    border-radius: 16px;
    background: var(--color-bg, #0c0e10);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    animation: devedgeRagPanelPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes devedgeRagPanelPop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Chat Header */
.devedge-rag-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--color-surface, #141719);
    border-bottom: 1px solid var(--color-divider, rgba(255, 255, 255, 0.1));
}
.devedge-rag-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.devedge-rag-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-accent, #00e599);
    box-shadow: 0 0 8px var(--color-accent, #00e599);
    flex-shrink: 0;
}
.devedge-rag-header-info {
    display: flex;
    flex-direction: column;
}
.devedge-rag-header-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 13.5px;
    line-height: 1.2;
    color: var(--color-text, #fff);
}
.devedge-rag-header-sub {
    font-size: 11px;
    line-height: 1.3;
    color: color-mix(in srgb, var(--color-text, #fff) 55%, transparent);
}
.devedge-rag-header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.devedge-rag-action-btn {
    background: transparent;
    border: none;
    color: color-mix(in srgb, var(--color-text, #fff) 65%, transparent);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.devedge-rag-action-btn:hover {
    color: var(--color-text, #fff);
    background: rgba(255, 255, 255, 0.08);
}

/* Chat Messages Scroll Container */
#devedge-rag-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
}

/* Message Bubbles */
.devedge-rag-message {
    padding: 12px 15px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.55;
    max-width: 86%;
    word-break: break-word;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}
.devedge-rag-message.user {
    align-self: flex-end;
    background: var(--color-accent);
    color: var(--color-bg, #0c0e10);
    border-bottom-right-radius: 2px;
    font-weight: 450;
}
.devedge-rag-message.assistant {
    align-self: flex-start;
    background: var(--color-surface, #141719);
    color: var(--color-text, #eef0f2);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.1));
    border-bottom-left-radius: 2px;
}
.devedge-rag-message.assistant.typing {
    color: color-mix(in srgb, var(--color-text, #fff) 60%, transparent);
    font-style: italic;
}

/* Links inside assistant responses */
.devedge-rag-message a,
.devedge-rag-link {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2.5px;
    font-weight: 500;
    transition: opacity 0.2s ease;
}
.devedge-rag-message a:hover,
.devedge-rag-link:hover {
    opacity: 0.8;
}

/* Clickable Starter Question Pills */
.devedge-rag-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 2px;
    margin-bottom: 4px;
    align-self: flex-start;
    max-width: 98%;
    animation: devedgeRagFadeIn 0.3s ease-out;
}
.devedge-rag-starter-pill {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface, #141719);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    color: var(--color-text, #eef0f2);
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    line-height: 1.4;
    padding: 7px 13px;
    border-radius: 20px;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.devedge-rag-starter-pill:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: color-mix(in srgb, var(--color-accent) 10%, var(--color-surface, #141719));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}
.devedge-rag-starter-pill:active {
    transform: translateY(0);
}
@keyframes devedgeRagFadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Area */
.devedge-rag-input-area {
    display: flex;
    align-items: center;
    border-top: 1px solid var(--color-divider, rgba(255, 255, 255, 0.1));
    padding: 12px 14px;
    background: var(--color-surface, #141719);
    gap: 8px;
}
#devedge-rag-input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    background: var(--color-bg, #0c0e10);
    color: var(--color-text, #fff);
    font-size: 13.5px;
    outline: none;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s ease;
}
#devedge-rag-input:focus {
    border-color: var(--color-accent);
}
#devedge-rag-send {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--color-accent);
    color: var(--color-bg, #0c0e10);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.2s ease, transform 0.1s ease;
}
#devedge-rag-send:hover {
    opacity: 0.9;
    transform: scale(1.03);
}
#devedge-rag-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

/* Email Gate View */
#devedge-rag-email-gate {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    height: 100%;
    text-align: center;
    background: transparent;
    margin: auto 0;
}
#devedge-rag-email-gate h3 {
    margin: 0 0 10px;
    font-size: 17px;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    color: var(--color-text, #fff);
}
#devedge-rag-email-gate p {
    font-size: 13px;
    color: color-mix(in srgb, var(--color-text, #fff) 65%, transparent);
    margin: 0 0 20px;
    line-height: 1.55;
    max-width: 260px;
}
#devedge-rag-email-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 280px;
}
#devedge-rag-email-input {
    padding: 11px 14px;
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.15));
    border-radius: 8px;
    background: var(--color-surface, #141719);
    color: var(--color-text, #fff);
    outline: none;
    font-size: 13.5px;
    transition: border-color 0.2s;
}
#devedge-rag-email-input:focus {
    border-color: var(--color-accent);
}
#devedge-rag-email-submit {
    padding: 11px 16px;
    background: var(--color-accent);
    color: var(--color-bg, #0c0e10);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 13.5px;
    transition: opacity 0.2s ease;
}
#devedge-rag-email-submit:hover {
    opacity: 0.9;
}

/* Inline Trigger Card (rendered by shortcode [devedge_rag_chat]) */
.devedge-rag-inline-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
    background: var(--color-surface, #141719);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    user-select: none;
    box-sizing: border-box;
    width: 100%;
}
.devedge-rag-inline-card:hover {
    border-color: var(--color-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.devedge-rag-inline-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}
.devedge-rag-inline-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: color-mix(in srgb, var(--color-accent) 12%, transparent);
    color: var(--color-accent);
    flex-shrink: 0;
}
.devedge-rag-inline-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.devedge-rag-inline-title {
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text, #fff);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.devedge-rag-inline-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    color: color-mix(in srgb, var(--color-text, #fff) 60%, transparent);
    line-height: 1.2;
}
.devedge-rag-inline-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-accent, #00e599);
    box-shadow: 0 0 6px var(--color-accent, #00e599);
    flex-shrink: 0;
}
.devedge-rag-inline-desc {
    margin: 0;
    font-size: 12.5px;
    color: color-mix(in srgb, var(--color-text, #fff) 70%, transparent);
    line-height: 1.45;
}
.devedge-rag-inline-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--color-accent);
    color: var(--color-bg, #0c0e10);
    border: none;
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.1s ease;
    pointer-events: none;
}
.devedge-rag-inline-card:hover .devedge-rag-inline-btn {
    opacity: 0.95;
    transform: translateY(-1px);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .devedge-rag-panel {
        bottom: 0;
        right: 0;
        left: 0;
        width: 100vw;
        max-width: 100vw;
        height: 82vh;
        max-height: 82vh;
        border-radius: 20px 20px 0 0;
    }
    .devedge-rag-launcher {
        bottom: 18px;
        right: 18px;
        padding: 10px 16px;
        font-size: 12.5px;
    }
    #backToTop {
        bottom: 76px !important;
        right: 20px !important;
    }
}
/* Assistant Answer Feedback Bar (Thumbs Up / Down) */
.devedge-rag-feedback {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid var(--color-divider, rgba(255, 255, 255, 0.08));
    font-size: 11px;
    color: color-mix(in srgb, var(--color-text, #fff) 50%, transparent);
}

.devedge-rag-feedback-label {
    margin-right: 2px;
    user-select: none;
    font-size: 11px;
    letter-spacing: 0.02em;
}

.devedge-rag-feedback-btn {
    background: transparent;
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.14));
    border-radius: 6px;
    padding: 3px 7px;
    color: color-mix(in srgb, var(--color-text, #fff) 65%, transparent);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    line-height: 1;
}

.devedge-rag-feedback-btn:hover {
    color: var(--color-text, #fff);
    border-color: var(--color-accent, #62D1DB);
    background: color-mix(in srgb, var(--color-accent, #62D1DB) 12%, transparent);
}

.devedge-rag-feedback.voted-up .devedge-rag-btn-up {
    color: var(--color-accent, #62D1DB);
    border-color: var(--color-accent, #62D1DB);
    background: color-mix(in srgb, var(--color-accent, #62D1DB) 18%, transparent);
}

.devedge-rag-feedback.voted-down .devedge-rag-btn-down {
    color: #e5625c;
    border-color: #e5625c;
    background: rgba(229, 98, 92, 0.18);
}

.devedge-rag-feedback.voted-up .devedge-rag-btn-down,
.devedge-rag-feedback.voted-down .devedge-rag-btn-up {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

.devedge-rag-feedback.voted-up .devedge-rag-btn-up,
.devedge-rag-feedback.voted-down .devedge-rag-btn-down {
    cursor: default;
}

.devedge-rag-feedback-thanks {
    font-size: 11px;
    color: var(--color-accent, #62D1DB);
    margin-left: 4px;
    animation: devedgeFadeIn 0.2s ease-in;
}

@keyframes devedgeFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Thumbs down detail selector */
.devedge-rag-down-detail {
    margin-top: 6px;
    padding: 8px 10px;
    background: color-mix(in srgb, var(--color-surface, #141719) 92%, #000);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.12));
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: devedgeFadeIn 0.2s ease-in;
}

.devedge-rag-down-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.devedge-rag-down-pill {
    background: var(--color-surface, #141719);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.15));
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    color: color-mix(in srgb, var(--color-text, #fff) 80%, transparent);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.devedge-rag-down-pill:hover,
.devedge-rag-down-pill.active {
    background: rgba(229, 98, 92, 0.2);
    border-color: #e5625c;
    color: #fff;
}

.devedge-rag-down-note-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.devedge-rag-down-note-input {
    flex: 1;
    background: var(--color-surface, #141719);
    border: 1px solid var(--color-divider, rgba(255, 255, 255, 0.15));
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 11.5px;
    color: var(--color-text, #fff);
    outline: none;
    font-family: inherit;
}

.devedge-rag-down-note-input:focus {
    border-color: #e5625c;
}

.devedge-rag-down-note-submit {
    background: #e5625c;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    font-family: 'Sora', sans-serif;
    transition: opacity 0.15s ease;
}

.devedge-rag-down-note-submit:hover {
    opacity: 0.9;
}