/* ── Floating Chat Drawer — Premium UI & Colors ── */
:root {
    --fc-bg: rgba(10, 14, 26, 0.97);
    --fc-border: #1e293b;
    --fc-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    --fc-glow-outer: rgba(255, 255, 255, 0.04);
    --fc-glow-inner: rgba(255, 255, 255, 0.06);
    --fc-header-bg: linear-gradient(90deg, rgba(34, 197, 94, 0.12) 0%, rgba(34, 197, 94, 0.06) 100%);
    --fc-header-border: #1e293b;
    --fc-header-title-color: #ffffff;
    --fc-txt: #cbd5e1;
    --fc-txt-muted: #64748b;
    --fc-input-bg: rgba(30, 41, 59, 0.7);
    --fc-input-border: #1e293b;
    --fc-input-color: #e2e8f0;
    --fc-item-border: rgba(30, 41, 59, 0.3);
    --fc-list-bg: #0b0f19;
    --fc-bubble-sent-bg: #005c4b;
    --fc-bubble-sent-txt: #e9edef;
    --fc-bubble-recv-bg: #202c33;
    --fc-bubble-recv-txt: #e9edef;
    --fc-bubble-meta: #8696a0;
    --fc-close-btn-bg: rgba(255, 255, 255, 0.06);
    --fc-close-btn-border: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="light"],
body[data-bs-theme="light"],
[data-bs-theme="light"] {
    --fc-bg: rgba(255, 255, 255, 0.96);
    --fc-border: #cbd5e1;
    --fc-shadow: 0 24px 60px rgba(0, 0, 0, 0.12);
    --fc-glow-outer: rgba(0, 0, 0, 0.04);
    --fc-glow-inner: rgba(255, 255, 255, 0.8);
    --fc-header-bg: linear-gradient(90deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.04) 100%);
    --fc-header-border: #cbd5e1;
    --fc-header-title-color: #0f172a;
    --fc-txt: #334155;
    --fc-txt-muted: #64748b;
    --fc-input-bg: #ffffff;
    --fc-input-border: #cbd5e1;
    --fc-input-color: #0f172a;
    --fc-item-border: rgba(203, 213, 225, 0.5);
    --fc-list-bg: #f8fafc;
    --fc-bubble-sent-bg: #e1fad6;
    --fc-bubble-sent-txt: #111b21;
    --fc-bubble-recv-bg: #ffffff;
    --fc-bubble-recv-txt: #111b21;
    --fc-bubble-meta: #667781;
    --fc-close-btn-bg: rgba(0, 0, 0, 0.04);
    --fc-close-btn-border: rgba(0, 0, 0, 0.06);
}

#fc-toggle {
    position: fixed;
    bottom: 24px;
    right: 88px;
    z-index: 9000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.4);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

#fc-toggle:hover {
    transform: scale(1.12);
    box-shadow: 0 8px 36px rgba(34, 197, 94, 0.6);
}

.fc-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #0f172a;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#fc-panel {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: 8999;
    width: 460px;
    height: 600px;
    max-height: 90vh;
    min-height: 340px;
    border-radius: 18px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--fc-border);
    background: var(--fc-bg);
    box-shadow: var(--fc-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    transition: opacity .2s ease, transform .2s cubic-bezier(.34,1.56,.64,1);
    color: var(--fc-txt);
    font-family: Inter, sans-serif;
    box-sizing: border-box !important;
}

#fc-panel * {
    box-sizing: border-box !important;
}

#fc-panel.fc-open {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Header */
.fc-header {
    padding: 16px;
    border-bottom: 1px solid var(--fc-header-border);
    background: var(--fc-header-bg);
    display: flex;
    align-items: center;
    gap: 12px;
}

.fc-header-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--fc-header-title-color);
    flex-grow: 1;
}

.fc-close-btn, .fc-back-btn {
    background: var(--fc-close-btn-bg);
    border: 1px solid var(--fc-close-btn-border);
    color: var(--fc-txt);
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 10px;
}

.fc-close-btn:hover, .fc-back-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: var(--fc-header-title-color);
}

/* Search bar / New Chat Row */
.fc-search-row {
    padding: 12px 16px;
    border-bottom: 1px solid var(--fc-border);
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
}

.fc-search-input {
    flex-grow: 1;
    background: var(--fc-input-bg);
    border: 1px solid var(--fc-input-border);
    border-radius: 20px;
    padding: 6px 16px;
    color: var(--fc-input-color);
    font-size: 12px;
    outline: none;
}

.fc-search-input::placeholder {
    color: var(--fc-txt-muted);
}

.fc-new-chat-btn {
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.fc-new-chat-btn:hover {
    background: #1d4ed8;
}

/* Scrollable Container */
.fc-body {
    flex-grow: 1;
    overflow-y: auto;
    position: relative;
    background: var(--fc-list-bg);
}

/* Chat Items */
.fc-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--fc-item-border);
    cursor: pointer;
    transition: background 0.15s ease;
}

.fc-item:hover {
    background: rgba(148, 163, 184, 0.08);
}

.fc-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #3b82f6;
    color: white;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
    flex-shrink: 0;
}

.fc-item-details {
    flex-grow: 1;
    min-width: 0;
}

.fc-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 2px;
}

.fc-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--fc-header-title-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-item-time {
    font-size: 10px;
    color: var(--fc-txt-muted);
}

.fc-item-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.fc-item-msg {
    font-size: 11px;
    color: var(--fc-txt-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
}

.fc-item-unread {
    background: #22c55e;
    color: white;
    font-size: 9px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    flex-shrink: 0;
}

/* Chat Room View */
#fc-room-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.fc-messages-area {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--fc-list-bg);
}

.fc-bubble {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.fc-bubble-sent {
    align-self: flex-end;
    background-color: var(--fc-bubble-sent-bg);
    color: var(--fc-bubble-sent-txt);
    border-top-right-radius: 0;
}

.fc-bubble-received {
    align-self: flex-start;
    background-color: var(--fc-bubble-recv-bg);
    color: var(--fc-bubble-recv-txt);
    border-top-left-radius: 0;
    border: 1px solid var(--fc-border);
}

.fc-bubble-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    font-size: 9px;
    color: var(--fc-bubble-meta);
    margin-top: 4px;
    gap: 4px;
}

.fc-input-panel {
    padding: 10px 16px;
    border-top: 1px solid var(--fc-border);
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 8px;
    align-items: center;
}

.fc-input-textarea {
    flex-grow: 1;
    background: var(--fc-input-bg);
    border: 1px solid var(--fc-input-border);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--fc-input-color);
    font-size: 12px;
    outline: none;
    resize: none;
    height: 36px;
}

.fc-send-btn {
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
    height: 36px;
}

.fc-send-btn:hover {
    background: #16a34a;
}

/* User Selection View inside panel */
#fc-users-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.fc-users-list {
    flex-grow: 1;
    overflow-y: auto;
    background: var(--fc-list-bg);
}

/* Date separators */
.fc-date-separator {
    align-self: center;
    background: rgba(148, 163, 184, 0.12);
    color: var(--fc-txt-muted);
    font-size: 9.5px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    margin: 8px 0;
    text-transform: uppercase;
}
