/* =====================================================================
   Bug Reporter v2 - Widget flottant bottom-right (Intercom/Crisp pattern)
   Compact par défaut, s'étend en mini-form au clic.
   Capture : URL + scroll + élément visible au centre du viewport.
   ===================================================================== */

.bug-reporter {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Bouton compact (état par défaut) */
.bug-reporter__btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1A365D;
    color: #fff;
    border: none;
    border-radius: 999px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    transition: all 0.2s ease;
    line-height: 1;
}
.bug-reporter__btn:hover {
    background: #C9A227;
    color: #1A365D;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
}
.bug-reporter__btn-icon {
    font-size: 18px;
    line-height: 1;
}

/* Carte étendue (état ouvert) */
.bug-reporter__card {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 320px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    padding: 16px;
    display: none;
}
.bug-reporter.bug-reporter--open .bug-reporter__btn { display: none; }
.bug-reporter.bug-reporter--open .bug-reporter__card { display: block; }

.bug-reporter__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.bug-reporter__title {
    font-size: 14px;
    font-weight: 700;
    color: #1A365D;
    margin: 0;
}
.bug-reporter__close {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    font-size: 20px;
    line-height: 1;
    padding: 4px;
}
.bug-reporter__close:hover { color: #1A365D; }

.bug-reporter__hint {
    font-size: 11px;
    color: #64748b;
    margin-bottom: 8px;
    line-height: 1.4;
}

.bug-reporter__textarea {
    width: 100%;
    min-height: 80px;
    padding: 8px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    box-sizing: border-box;
    color: #1A202C;
    background: #fff;
}
.bug-reporter__textarea:focus {
    outline: none;
    border-color: #C9A227;
}

.bug-reporter__category {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 12px;
    margin-top: 8px;
    box-sizing: border-box;
    background: #fff;
    color: #1A202C;
}

.bug-reporter__submit {
    margin-top: 10px;
    width: 100%;
    background: #C9A227;
    color: #1A365D;
    border: none;
    padding: 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.2s;
}
.bug-reporter__submit:hover { background: #b88f1f; }
.bug-reporter__submit:disabled { opacity: 0.6; cursor: not-allowed; }

.bug-reporter__result {
    margin-top: 8px;
    font-size: 12px;
    text-align: center;
    display: none;
}
.bug-reporter__result--ok { color: #166534; display: block; }
.bug-reporter__result--err { color: #b91c1c; display: block; }

.bug-reporter__context {
    margin-top: 10px;
    padding: 8px;
    background: #f1f5f9;
    border-radius: 6px;
    font-size: 11px;
    color: #475569;
    line-height: 1.5;
    word-break: break-word;
    border: 1px dashed #cbd5e0;
}
.bug-reporter__context-label {
    font-weight: 700;
    color: #1A365D;
}

/* Dark mode */
[data-theme="dark"] .bug-reporter__card {
    background: #1A202C;
    border-color: #334155;
}
[data-theme="dark"] .bug-reporter__title { color: #F7FAFC; }
[data-theme="dark"] .bug-reporter__hint { color: #94a3b8; }
[data-theme="dark"] .bug-reporter__textarea,
[data-theme="dark"] .bug-reporter__category {
    background: #0F172A;
    border-color: #334155;
    color: #F7FAFC;
}
[data-theme="dark"] .bug-reporter__context {
    background: #0F172A;
    color: #94a3b8;
    border-color: #334155;
}
[data-theme="dark"] .bug-reporter__context-label { color: #C9A227; }

/* Mobile */
@media (max-width: 480px) {
    .bug-reporter { bottom: 12px; right: 12px; }
    .bug-reporter__btn { padding: 8px 12px; font-size: 12px; }
    .bug-reporter__card { width: calc(100vw - 24px); right: 0; }
}
