/* ===================================================================
   Matching-copiloot — chatpaneel (rechtsonder, inklapbaar)
   Alleen-lezen agent-widget. ItaQ-kleuren: #E97132 (accent) / #0E2841 (donker).
   =================================================================== */

:root {
    --copiloot-accent: #E97132;
    --copiloot-accent-dark: #c9591f;
    --copiloot-dark: #0E2841;
    --copiloot-dark-light: #16385c;
}

#copiloot-root {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: 'Outfit', sans-serif;
}

/* ---- Zwevende knop ---- */
.copiloot-fab {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--copiloot-accent) 0%, var(--copiloot-accent-dark) 100%);
    color: #fff;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(233, 113, 50, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.copiloot-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(233, 113, 50, 0.55);
}

.copiloot-fab .copiloot-fab-icon {
    font-size: 1.1rem;
    line-height: 1;
}

.copiloot-fab.hidden {
    display: none !important;
}

/* ---- Paneel ---- */
.copiloot-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 48px);
    display: flex;
    flex-direction: column;
    background: rgba(14, 40, 65, 0.97);
    border: 1px solid rgba(233, 113, 50, 0.3);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(14px);
    overflow: hidden;
}

.copiloot-panel.hidden {
    display: none !important;
}

/* ---- Header ---- */
.copiloot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, var(--copiloot-dark) 0%, var(--copiloot-dark-light) 100%);
    border-bottom: 1px solid rgba(233, 113, 50, 0.25);
    flex-shrink: 0;
}

.copiloot-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 800;
    font-size: 1rem;
}

.copiloot-header-title .copiloot-sparkle {
    color: var(--copiloot-accent);
}

.copiloot-header-sub {
    display: block;
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.72rem;
    font-weight: 400;
}

.copiloot-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: color 0.15s ease, background 0.15s ease;
    line-height: 1;
}

.copiloot-close-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* ---- Berichtenlijst ---- */
.copiloot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.copiloot-messages::-webkit-scrollbar {
    width: 6px;
}

.copiloot-messages::-webkit-scrollbar-thumb {
    background: rgba(233, 113, 50, 0.35);
    border-radius: 3px;
}

.copiloot-msg-row {
    display: flex;
    width: 100%;
}

.copiloot-msg-row.user {
    justify-content: flex-end;
}

.copiloot-msg-row.copiloot {
    justify-content: flex-start;
}

.copiloot-bubble {
    max-width: 84%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.copiloot-msg-row.user .copiloot-bubble {
    background: linear-gradient(135deg, var(--copiloot-accent) 0%, var(--copiloot-accent-dark) 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.copiloot-msg-row.copiloot .copiloot-bubble {
    background: rgba(255, 255, 255, 0.08);
    color: #f1f1f1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

.copiloot-msg-row.copiloot .copiloot-bubble.copiloot-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #fca5a5;
}

/* "geraadpleegd: ..." regel onder een copiloot-antwoord */
.copiloot-tools-used {
    margin-top: 8px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
}

.copiloot-retry-btn {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.copiloot-retry-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

/* ---- Typindicator (drie puntjes) ---- */
.copiloot-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 14px;
}

.copiloot-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.55);
    animation: copiloot-bounce 1.2s infinite ease-in-out;
}

.copiloot-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.copiloot-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes copiloot-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
        opacity: 0.5;
    }

    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* ---- Voorbeeldvragen (chips) ---- */
.copiloot-suggestions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 4px 2px;
}

.copiloot-suggestions-label {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.copiloot-chip {
    text-align: left;
    background: rgba(233, 113, 50, 0.12);
    border: 1px solid rgba(233, 113, 50, 0.35);
    color: #fce4d6;
    padding: 9px 12px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.82rem;
    line-height: 1.4;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.copiloot-chip:hover {
    background: rgba(233, 113, 50, 0.22);
    border-color: rgba(233, 113, 50, 0.55);
}

/* ---- Invoer ---- */
.copiloot-input-area {
    flex-shrink: 0;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.15);
}

.copiloot-input-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.copiloot-input {
    flex: 1;
    resize: none;
    max-height: 90px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.15s ease;
}

.copiloot-input:focus {
    border-color: var(--copiloot-accent);
}

.copiloot-input::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.copiloot-send-btn {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--copiloot-accent) 0%, var(--copiloot-accent-dark) 100%);
    color: #fff;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.copiloot-send-btn:hover {
    transform: translateY(-1px);
}

.copiloot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- Disclaimer ---- */
.copiloot-disclaimer {
    padding: 8px 14px 12px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    line-height: 1.4;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.copiloot-disclaimer i {
    margin-right: 4px;
}

/* ---- Smalle schermen ---- */
@media (max-width: 480px) {
    #copiloot-root {
        right: 12px;
        bottom: 12px;
    }

    .copiloot-panel {
        right: 12px;
        bottom: 12px;
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        max-height: none;
        border-radius: 14px;
    }
}
