/* ─── Trigger bar (search-like input + Go button) ─────────────────────────── */

.fchat-trigger {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 500px;
}

.fchat-search-input {
    flex: 1;
    padding: 10px 14px;
    font-size: 15px;
    border: 2px solid #ccc;
    border-right: none;
    border-radius: 6px 0 0 6px;
    outline: none;
    transition: border-color 0.2s;
}

.fchat-search-input:focus {
    border-color: #808080;
}

.fchat-go-btn {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    background: #808080;
    color: #fff;
    border: 2px solid #808080;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: background 0.2s;
}

.fchat-go-btn:hover {
    background: #666;
    border-color: #666;
}

/* ─── Dialog / Popup ──────────────────────────────────────────────────────── */

.fchat-dialog {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
    width: 90vw;
    max-width: 1000px;
    height: 80vh;
    max-height: 700px;
}

.fchat-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.fchat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */

.fchat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #2b2c34;
    color: #d9d9d9;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.fchat-title {
    font-weight: 600;
    font-size: 16px;
}

.fchat-close-btn {
    background: none;
    border: none;
    color: #d9d9d9;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.fchat-close-btn:hover {
    color: #fff;
}

/* ─── Messages area ───────────────────────────────────────────────────────── */

.fchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #fafafa;
    min-height: 0;
}

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

.fchat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

/* ─── Message bubbles ─────────────────────────────────────────────────────── */

.fchat-msg {
    display: flex;
    align-items: flex-start;
    margin-bottom: 12px;
}

.fchat-msg--right {
    flex-direction: row-reverse;
}

.fchat-msg-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    flex-shrink: 0;
}

.fchat-msg-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 12px;
    margin: 0 10px;
    line-height: 1.5;
    font-size: 14px;
}

.fchat-msg--left .fchat-msg-bubble {
    background: #f0f0f0;
    color: #333;
}

.fchat-msg--right .fchat-msg-bubble {
    background: #808080;
    color: #fff;
}

.fchat-msg-info-name {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
}

.fchat-msg-text {
    word-wrap: break-word;
}

.fchat-msg-text ol,
.fchat-msg-text ul {
    margin-left: 1.5em;
    list-style: revert;
}

.fchat-msg-text pre {
    white-space: pre-wrap;
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 10px;
    border-radius: 6px;
    margin: 8px 0;
    overflow-x: auto;
    font-size: 13px;
}

.fchat-msg-text code {
    font-size: 13px;
}

.fchat-msg-text p {
    margin: 0 0 8px 0;
}

.fchat-msg-text p:last-child {
    margin-bottom: 0;
}

/* ─── Typing indicator ────────────────────────────────────────────────────── */

.fchat-typing {
    animation: fchat-blink 1s infinite;
}

@keyframes fchat-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── Input area ──────────────────────────────────────────────────────────── */

.fchat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px 4px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.fchat-input {
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    outline: none;
    resize: none;
    max-height: 150px;
    line-height: 1.4;
    font-family: inherit;
    transition: border-color 0.2s;
}

.fchat-input:focus {
    border-color: #808080;
}

.fchat-send-btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    background: #808080;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.fchat-send-btn:hover {
    background: #666;
}

.fchat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Character count ─────────────────────────────────────────────────────── */

.fchat-char-count {
    text-align: right;
    font-size: 11px;
    color: #999;
    padding: 0 16px 10px;
    background: #fff;
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.fchat-limit-exceeded {
    color: #dc2626;
    font-weight: 600;
}
