/*
 * ==========================================================
 * COMUNIK CO-PILOT IA - Suggested replies UI
 * ==========================================================
 *
 * Panneau au-dessus du chat editor (cote agent) qui propose
 * 3 reponses suggerees par OpenAI + KB.
 *
 */

.sb-copilot-suggestions {
    display: block;
    margin: 8px 12px 4px 12px;
    padding: 10px 12px;
    background: #f7f9fc;
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    font-size: 13px;
    color: #1f2937;
    box-sizing: border-box;
    position: relative;
}

.sb-copilot-suggestions .sb-copilot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    user-select: none;
    cursor: pointer;
}
.sb-copilot-suggestions.sb-copilot-collapsed .sb-copilot-header {
    margin-bottom: 0;
}
.sb-copilot-suggestions.sb-copilot-collapsed {
    padding: 8px 14px;
}

.sb-copilot-suggestions .sb-copilot-title {
    font-weight: 600;
    font-size: 12px;
    color: #4b5563;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sb-copilot-suggestions .sb-copilot-title:before {
    content: "\2728"; /* sparkles */
    font-size: 14px;
}

.sb-copilot-suggestions .sb-copilot-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sb-copilot-suggestions .sb-copilot-btn {
    background: transparent;
    border: 1px solid transparent;
    color: #6b7280;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background .15s, color .15s, border-color .15s;
    line-height: 1;
}

.sb-copilot-suggestions .sb-copilot-btn:hover {
    background: #eef2f7;
    color: #111827;
    border-color: #d1d5db;
}

.sb-copilot-suggestions .sb-copilot-toggle {
    color: #6b7280;
}

.sb-copilot-suggestions.sb-copilot-collapsed .sb-copilot-list,
.sb-copilot-suggestions.sb-copilot-collapsed .sb-copilot-kb {
    display: none;
}

.sb-copilot-suggestions .sb-copilot-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sb-copilot-suggestions .sb-copilot-card {
    background: #ffffff;
    border: 1px solid #e3e8ef;
    border-radius: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .05s;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.4;
}

.sb-copilot-suggestions .sb-copilot-card:hover {
    border-color: #25d366;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.12);
}

.sb-copilot-suggestions .sb-copilot-card:active {
    transform: translateY(1px);
}

.sb-copilot-suggestions .sb-copilot-card-num {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #25d366;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sb-copilot-suggestions .sb-copilot-card-text {
    flex: 1 1 auto;
    color: #111827;
    font-size: 13px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.sb-copilot-suggestions .sb-copilot-loading,
.sb-copilot-suggestions .sb-copilot-empty,
.sb-copilot-suggestions .sb-copilot-error {
    color: #6b7280;
    font-size: 12px;
    padding: 6px 0;
    font-style: italic;
}

.sb-copilot-suggestions .sb-copilot-spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid #d1d5db;
    border-top-color: #25d366;
    border-radius: 50%;
    animation: sb-copilot-spin .8s linear infinite;
    vertical-align: -2px;
    margin-right: 6px;
}

@keyframes sb-copilot-spin {
    to { transform: rotate(360deg); }
}

.sb-copilot-suggestions .sb-copilot-kb {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #e3e8ef;
    font-size: 11px;
    color: #6b7280;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.sb-copilot-suggestions .sb-copilot-kb-tag {
    background: #eef9f3;
    color: #15803d;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
}

.sb-copilot-suggestions .sb-copilot-cached {
    font-size: 10px;
    color: #9ca3af;
    margin-left: 6px;
    text-transform: lowercase;
}

/* Dark mode (Support Board ajoute la classe sb-dark-mode sur body ou .sb-main) */
body.sb-dark-mode .sb-copilot-suggestions,
.sb-dark-mode .sb-copilot-suggestions {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-title,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-title {
    color: #9ca3af;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card {
    background: #111827;
    border-color: #374151;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card:hover,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card:hover {
    border-color: #25d366;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card-text,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-card-text {
    color: #f3f4f6;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-btn:hover,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-btn:hover {
    background: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-kb,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-kb {
    border-top-color: #374151;
    color: #9ca3af;
}

body.sb-dark-mode .sb-copilot-suggestions .sb-copilot-kb-tag,
.sb-dark-mode .sb-copilot-suggestions .sb-copilot-kb-tag {
    background: #064e3b;
    color: #86efac;
}

/* Responsive : sur petits ecrans on collapse par defaut + design plus compact */
@media (max-width: 500px) {
    .sb-copilot-suggestions {
        margin: 4px 6px 2px 6px;
        padding: 6px 8px;
    }
    .sb-copilot-suggestions .sb-copilot-card {
        padding: 6px 8px;
        font-size: 12px;
    }
    .sb-copilot-suggestions .sb-copilot-card-num {
        width: 18px;
        height: 18px;
        font-size: 10px;
    }
}
