/* Dol-B Design chat — green/white theme matching site */

:root {
    --chat-green: #2ecc71;
    --chat-green-dark: #27ae60;
    --chat-bg: #ffffff;
    --chat-bubble-me: #2ecc71;
    --chat-bubble-me-text: #ffffff;
    --chat-bubble-them: #f1f3f5;
    --chat-bubble-them-text: #1f2937;
    --chat-meta: #6b7280;
    --chat-border: #e5e7eb;
    --chat-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

/* ===== Customer widget (bottom-right) ===== */

.chat-toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    border: none;
    background: var(--chat-green);
    color: #fff;
    border-radius: 28px;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: background .15s ease, transform .15s ease;
}
.chat-toggle:hover { background: var(--chat-green-dark); }
.chat-toggle.active { background: var(--chat-green-dark); }
.chat-toggle i { margin-right: 6px; }

.chat-panel {
    position: fixed;
    right: 24px;
    bottom: 84px;
    z-index: 9999;
    width: 360px;
    max-width: calc(100vw - 32px);
    height: 520px;
    max-height: calc(100vh - 110px);
    background: var(--chat-bg);
    border-radius: 12px;
    box-shadow: var(--chat-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--chat-border);
}
.chat-panel.open { display: flex; }

.chat-header {
    background: var(--chat-green);
    color: #fff;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.chat-header h4 { margin: 0; font-size: 16px; }
.chat-header small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.chat-header .chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 8px;
}

.chat-offline-banner {
    background: #fff8e6;
    color: #7a5b00;
    border-bottom: 1px solid #f0e4b8;
    padding: 10px 16px;
    font-size: 13px;
    line-height: 1.4;
}

.chat-messages {
    flex: 1 1 auto;
    padding: 14px 14px 4px;
    overflow-y: auto;
    background: #fafbfc;
}

.chat-msg {
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    max-width: 80%;
}
.chat-msg.from-me { align-self: flex-end; margin-left: auto; align-items: flex-end; }
.chat-msg.from-them, .chat-msg.from-admin { align-self: flex-start; margin-right: auto; align-items: flex-start; }

.chat-bubble {
    padding: 9px 13px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}
.from-me .chat-bubble {
    background: var(--chat-bubble-me);
    color: var(--chat-bubble-me-text);
    border-bottom-right-radius: 4px;
}
.from-them .chat-bubble, .from-admin .chat-bubble {
    background: var(--chat-bubble-them);
    color: var(--chat-bubble-them-text);
    border-bottom-left-radius: 4px;
}

.chat-meta {
    font-size: 11px;
    color: var(--chat-meta);
    margin-top: 3px;
    padding: 0 4px;
}

.chat-input-row {
    border-top: 1px solid var(--chat-border);
    padding: 10px;
    background: #fff;
    display: flex;
    gap: 8px;
}
.chat-input-row textarea {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid var(--chat-border);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    min-height: 36px;
    max-height: 90px;
    outline: none;
    background: #fff;
}
.chat-input-row textarea:focus { border-color: var(--chat-green); }
.chat-input-row button {
    background: var(--chat-green);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0 16px;
    font-weight: 600;
    cursor: pointer;
}
.chat-input-row button:hover { background: var(--chat-green-dark); }

.chat-empty {
    color: var(--chat-meta);
    text-align: center;
    padding: 24px 16px;
    font-size: 13px;
}

/* ===== Admin inbox (full-page) ===== */

.admin-chats-page {
    background: #f4f6f9;
    min-height: 100vh;
    padding: 24px;
}
.admin-chats-card {
    max-width: 1200px;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.admin-chats-head {
    background: var(--chat-green);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.admin-chats-head h2 { margin: 0; font-size: 20px; }
.admin-chats-body { display: flex; min-height: 600px; }

.user-list-pane {
    width: 280px;
    border-right: 1px solid var(--chat-border);
    background: #fafbfc;
    overflow-y: auto;
    max-height: 600px;
}
#user-list { list-style: none; padding: 0; margin: 0; }
#user-list li {
    padding: 14px 18px;
    border-bottom: 1px solid var(--chat-border);
    cursor: pointer;
    transition: background .12s ease;
    position: relative;
}
#user-list li:hover { background: #eef6f0; }
#user-list li.active { background: #e6f4ea; border-left: 3px solid var(--chat-green); padding-left: 15px; }
#user-list li.has-unread::after {
    content: "";
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--chat-green);
}
.user-list-name { font-weight: 600; color: #1f2937; font-size: 14px; }
.user-list-meta { font-size: 12px; color: var(--chat-meta); margin-top: 2px; }

.conversation-pane {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    max-height: 600px;
}
#conv-empty {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-meta);
    font-size: 14px;
    padding: 40px;
    text-align: center;
}
#conv-active { display: none; flex: 1 1 auto; flex-direction: column; }
.conv-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--chat-border);
    background: #fafbfc;
}
.conv-header h3 { margin: 0; font-size: 16px; color: #1f2937; }
#conv-messages {
    flex: 1 1 auto;
    padding: 16px 20px;
    overflow-y: auto;
    background: #fff;
}
.conv-loading, .conv-error {
    text-align: center;
    color: var(--chat-meta);
    padding: 24px;
}
