/* ============================================================
   Seb Troc Chatbot Widget
   ============================================================ */

.sebt-chatbot {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: inherit;
}

/* ── Bouton toggle ── */
.sebt-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5C3D2E 0%, #3D2B1F 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(61,43,31,.45);
    position: relative;
    transition: transform .2s, box-shadow .2s;
    color: #DBC895;
}
.sebt-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(61,43,31,.55);
}

.sebt-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #e53e3e;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    border: 2px solid #fff;
    pointer-events: none;
}
.sebt-badge.sebt-visible { display: flex; }

/* ── Panel ── */
.sebt-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-height: 530px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.14), 0 4px 16px rgba(0,0,0,.07);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.88) translateY(16px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
    transform-origin: bottom right;
}
.sebt-panel.sebt-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: all;
}

/* ── Header ── */
.sebt-header {
    background: linear-gradient(135deg, #3D2B1F 0%, #5C3D2E 100%);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.sebt-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sebt-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #DBC895;
    color: #3D2B1F;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}
.sebt-header-info strong {
    display: block;
    color: #DBC895;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 600;
}
.sebt-status {
    font-size: 11px;
    color: rgba(219,200,149,.75);
    display: flex;
    align-items: center;
    gap: 5px;
}
.sebt-status::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #48BB78;
    display: inline-block;
    flex-shrink: 0;
}
.sebt-close {
    background: none;
    border: none;
    color: rgba(219,200,149,.7);
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    transition: color .15s;
    border-radius: 4px;
}
.sebt-close:hover { color: #DBC895; }

/* ── Messages ── */
.sebt-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #faf8f5;
    scroll-behavior: smooth;
}
.sebt-messages::-webkit-scrollbar { width: 4px; }
.sebt-messages::-webkit-scrollbar-track { background: transparent; }
.sebt-messages::-webkit-scrollbar-thumb { background: #DBC895; border-radius: 4px; }

.sebt-msg { display: flex; }
.sebt-msg--bot  { justify-content: flex-start; }
.sebt-msg--user { justify-content: flex-end; }

.sebt-bubble {
    max-width: 84%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.55;
    word-break: break-word;
}
.sebt-msg--bot .sebt-bubble {
    background: #fff;
    color: #2d2d2d;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}
.sebt-msg--user .sebt-bubble {
    background: linear-gradient(135deg, #5C3D2E 0%, #3D2B1F 100%);
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ── Typing indicator ── */
.sebt-typing .sebt-bubble {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
}
.sebt-typing .sebt-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #DBC895;
    animation: sebt-blink 1.3s infinite;
    display: inline-block;
}
.sebt-typing .sebt-bubble span:nth-child(2) { animation-delay: .2s; }
.sebt-typing .sebt-bubble span:nth-child(3) { animation-delay: .4s; }

@keyframes sebt-blink {
    0%, 80%, 100% { opacity: .25; transform: scale(.8); }
    40%           { opacity: 1;   transform: scale(1);   }
}

/* ── Input area ── */
.sebt-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 12px;
    border-top: 1px solid #f0ebe3;
    background: #fff;
    flex-shrink: 0;
}
.sebt-input-area input {
    flex: 1;
    border: 1.5px solid #e8e0d4;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 16px;
    outline: none;
    background: #faf8f5;
    transition: border-color .2s;
    font-family: inherit;
}
.sebt-input-area input:focus { border-color: #DBC895; }

.sebt-input-area button {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5C3D2E 0%, #3D2B1F 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #DBC895;
    transition: transform .15s, opacity .15s;
}
.sebt-input-area button:hover   { transform: scale(1.08); }
.sebt-input-area button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Hint upload ── */
.sebt-upload-hint {
    margin: 0;
    padding: 5px 14px 4px;
    font-size: 11px;
    color: #a89070;
    background: #fff;
    border-top: 1px solid #f0ebe3;
    text-align: center;
    letter-spacing: .01em;
}

/* ── Bouton photo ── */
.sebt-file-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1ece5;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #5C3D2E;
    transition: background .15s;
}
.sebt-file-btn:hover { background: #e4d8cc; }

/* ── PDF dans le chat ── */
.sebt-bubble--pdf {
    display: flex !important;
    align-items: center;
    gap: 8px;
    padding: 10px 14px !important;
    font-size: 13px;
    background: linear-gradient(135deg, #5C3D2E 0%, #3D2B1F 100%) !important;
    color: #DBC895 !important;
    border-bottom-right-radius: 4px;
    max-width: 84%;
}
.sebt-bubble--pdf svg { flex-shrink: 0; stroke: #DBC895; }
.sebt-bubble--pdf span { word-break: break-all; line-height: 1.4; }

/* ── Image dans le chat ── */
.sebt-bubble--img {
    padding: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    position: relative;
}
.sebt-chat-img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 10px;
    display: block;
    object-fit: cover;
}
.sebt-img-pending .sebt-chat-img { opacity: .5; }
.sebt-img-pending::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 22px;
    height: 22px;
    margin: -11px 0 0 -11px;
    border: 3px solid rgba(255,255,255,.4);
    border-top-color: #DBC895;
    border-radius: 50%;
    animation: sebt-spin .8s linear infinite;
}
@keyframes sebt-spin { to { transform: rotate(360deg); } }

/* ── Mobile ── */
@media (max-width: 480px) {
    .sebt-chatbot { bottom: 16px; right: 16px; }
    .sebt-panel   { width: calc(100vw - 32px); right: -16px; bottom: 68px; }
}
