/**
 * Quote Me Go - Custom Built-in Floating Chatbot CSS
 */

#qmg-chatbot-root {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99999;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Floating Toggle Button */
#qmg-chat-toggle-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 10px 25px -5px rgba(37, 99, 235, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#qmg-chat-toggle-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 14px 30px -5px rgba(37, 99, 235, 0.6);
}

.badge-online {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
}

/* Chat Main Container */
#qmg-chat-box {
    position: absolute;
    bottom: 75px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 540px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.25);
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: qmgSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes qmgSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.qmg-chat-header {
    background: #0f172a;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.qmg-chat-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.qmg-agent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-weight: 700;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qmg-agent-name {
    font-size: 15px;
    font-weight: 600;
}

.qmg-agent-status {
    font-size: 12px;
    color: #94a3b8;
}

.qmg-chat-btn-end {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.qmg-chat-btn-end:hover {
    background: #ef4444;
    color: #ffffff;
}

/* Panes */
.qmg-chat-pane {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#qmg-chat-pane-messages {
    padding: 0;
}

/* Pre-Chat Lead Form */
.qmg-chat-welcome {
    margin-bottom: 16px;
}

.qmg-chat-welcome h4 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #0f172a;
}

.qmg-chat-welcome p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.4;
}

.qmg-chat-field {
    margin-bottom: 14px;
}

.qmg-chat-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 4px;
}

.qmg-chat-field input,
.qmg-chat-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    box-sizing: border-box;
    outline: none;
}

.qmg-chat-field input:focus,
.qmg-chat-field textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.qmg-chat-btn-primary {
    width: 100%;
    padding: 12px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.qmg-chat-btn-primary:hover {
    background: #1d4ed8;
}

.qmg-chat-divider {
    text-align: center;
    margin: 16px 0;
    position: relative;
}

.qmg-chat-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: #e2e8f0;
}

.qmg-chat-divider span {
    position: relative;
    background: #ffffff;
    padding: 0 10px;
    font-size: 11px;
    font-weight: 700;
    color: #94a3b8;
}

.qmg-chat-quick-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qmg-chat-quick-options button {
    padding: 10px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.qmg-chat-quick-options button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
}

/* Messaging Pane */
.qmg-chat-msg-list {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
}

.qmg-chat-msg {
    max-width: 82%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.msg-user {
    align-self: flex-end;
    background: #2563eb;
    color: #ffffff;
    border-bottom-right-radius: 2px;
}

.msg-agent {
    align-self: flex-start;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.qmg-attachment-link {
    display: inline-block;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

/* Controls Bar */
.qmg-chat-input-bar {
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
    padding: 10px 12px;
}

#qmg-upload-preview {
    font-size: 12px;
    color: #2563eb;
    background: #eff6ff;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.qmg-chat-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qmg-btn-paperclip {
    cursor: pointer;
    font-size: 18px;
    padding: 6px;
    user-select: none;
}

#qmg-chat-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    padding: 8px 14px;
    font-size: 13px;
    outline: none;
}

#qmg-chat-input:focus {
    border-color: #2563eb;
}

.qmg-btn-send {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Star Rating */
.qmg-star-rating {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 32px;
    cursor: pointer;
    margin: 16px 0;
}

.qmg-star-rating span {
    color: #cbd5e1;
    transition: color 0.15s;
}

.qmg-star-rating span.active,
.qmg-star-rating span:hover {
    color: #f59e0b;
}
