/* ============================================================
   PM4U Modern AI Chatbot Styles - Brand Logo Theme
   Primary Navy: #0b3a75 | Growth Green: #16a34a / #22c55e
   ============================================================ */

/* Floating Toggle Button */
#pm4u-chatbot-launcher {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: auto;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b3a75 0%, #16a34a 100%);
    box-shadow: 0 8px 24px rgba(11, 58, 117, 0.4), 0 0 15px rgba(22, 163, 74, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    cursor: pointer;
    z-index: 99999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#pm4u-chatbot-launcher:hover {
    transform: scale(1.08) rotate(4deg);
    box-shadow: 0 12px 30px rgba(11, 58, 117, 0.6), 0 0 25px rgba(22, 163, 74, 0.5);
}

#pm4u-chatbot-launcher img.pm4u-launcher-img {
    width: 36px;
    height: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

#pm4u-chatbot-launcher .badge-pulse {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background-color: #22c55e;
    border: 2px solid #ffffff;
    border-radius: 50%;
    animation: pm4u-pulse 1.8s infinite;
}

@keyframes pm4u-pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Chatbot Modal Container */
#pm4u-chatbot-modal {
    position: fixed;
    bottom: 95px;
    left: 24px;
    right: auto;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: rgba(10, 22, 38, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(22, 163, 74, 0.25);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55), 0 0 30px rgba(22, 163, 74, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 99999;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

#pm4u-chatbot-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.pm4u-chat-header {
    background: linear-gradient(135deg, #07172b 0%, #0d2847 100%);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(22, 163, 74, 0.2);
}

.pm4u-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pm4u-chat-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    border: 2px solid #22c55e;
    box-shadow: 0 2px 10px rgba(34, 197, 94, 0.3);
}

.pm4u-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.pm4u-chat-header-text h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.pm4u-chat-header-text span {
    font-size: 11.5px;
    color: #4ade80;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
}

.pm4u-chat-header-text span::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    background-color: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 6px #22c55e;
}

.pm4u-chat-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 18px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.pm4u-chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* Chat Body / Messages Area */
.pm4u-chat-body {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

.pm4u-chat-body::-webkit-scrollbar {
    width: 5px;
}

.pm4u-chat-body::-webkit-scrollbar-thumb {
    background: rgba(22, 163, 74, 0.3);
    border-radius: 10px;
}

/* Message Bubble Styling */
.pm4u-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: pm4u-fade-in 0.25s ease-out;
}

@keyframes pm4u-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.pm4u-msg.user {
    align-self: flex-end;
}

.pm4u-msg.bot {
    align-self: flex-start;
}

.pm4u-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.5;
    word-break: break-word;
}

.pm4u-msg.user .pm4u-msg-bubble {
    background: linear-gradient(135deg, #0b3a75 0%, #15803d 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 14px rgba(11, 58, 117, 0.3);
}

.pm4u-msg.bot .pm4u-msg-bubble {
    background: #0f2744;
    color: #f1f5f9;
    border: 1px solid rgba(22, 163, 74, 0.15);
    border-bottom-left-radius: 4px;
}

.pm4u-msg-bubble p {
    margin: 0 0 8px 0;
}
.pm4u-msg-bubble p:last-child {
    margin-bottom: 0;
}

.pm4u-msg-bubble ul, .pm4u-msg-bubble ol {
    margin: 6px 0;
    padding-left: 18px;
}

.pm4u-msg-bubble a {
    color: #4ade80;
    text-decoration: underline;
    font-weight: 600;
}

.pm4u-msg-bubble a:hover {
    color: #86efac;
}

.pm4u-msg-time {
    font-size: 10px;
    color: #64748b;
    margin-top: 4px;
}
.pm4u-msg.user .pm4u-msg-time {
    text-align: right;
}

/* Typing Indicator */
.pm4u-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 16px;
    background: #0f2744;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    border: 1px solid rgba(22, 163, 74, 0.2);
}

.pm4u-typing span {
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pm4u-dots 1.4s infinite ease-in-out both;
}

.pm4u-typing span:nth-child(1) { animation-delay: -0.32s; }
.pm4u-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes pm4u-dots {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

/* Quick Suggestion Chips */
.pm4u-chat-chips {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 16px;
    background: rgba(7, 23, 43, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.pm4u-chat-chips::-webkit-scrollbar {
    display: none;
}

.pm4u-chip {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(22, 163, 74, 0.3);
    color: #cbd5e1;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pm4u-chip:hover {
    background: linear-gradient(135deg, #0b3a75, #16a34a);
    color: #ffffff;
    border-color: #22c55e;
}

/* Footer / Input Area */
.pm4u-chat-footer {
    padding: 12px 16px;
    background: #07172b;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pm4u-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #0f2744;
    border: 1px solid rgba(22, 163, 74, 0.25);
    border-radius: 25px;
    padding: 4px 6px 4px 16px;
    transition: border-color 0.2s ease;
}

.pm4u-chat-input-row:focus-within {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.pm4u-chat-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 13px;
}

.pm4u-chat-input::placeholder {
    color: #64748b;
}

.pm4u-chat-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0b3a75, #16a34a);
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.pm4u-chat-send-btn:hover {
    transform: scale(1.06);
    background: linear-gradient(135deg, #0f4c81, #22c55e);
}

/* Pre-Chat Lead Capture Form */
.pm4u-lead-form-wrap {
    padding: 20px;
    background: #091526;
    flex: 1;
    overflow-y: auto;
}

.pm4u-lead-header {
    text-align: center;
    margin-bottom: 18px;
}

.pm4u-lead-header h3 {
    margin: 0 0 6px 0;
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
}

.pm4u-lead-header p {
    margin: 0;
    font-size: 12.5px;
    color: #94a3b8;
    line-height: 1.4;
}

.pm4u-lead-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pm4u-form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pm4u-form-group label {
    font-size: 12px;
    font-weight: 600;
    color: #cbd5e1;
}

.pm4u-form-group label span.req {
    color: #ef4444;
}

.pm4u-form-group input,
.pm4u-form-group select {
    width: 100%;
    padding: 10px 14px;
    background: #0f2744;
    border: 1px solid rgba(22, 163, 74, 0.3);
    border-radius: 8px;
    color: #ffffff;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
}

.pm4u-form-group select option {
    background: #0f2744;
    color: #ffffff;
}

.pm4u-form-group input:focus,
.pm4u-form-group select:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.pm4u-lead-submit-btn {
    margin-top: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #0b3a75 0%, #16a34a 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(11, 58, 117, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pm4u-lead-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.4);
}

/* Inline Lead Capture Card Bubble */
.pm4u-card-bubble {
    background: linear-gradient(135deg, #091a2e 0%, #0c2b18 100%) !important;
    border: 1px solid rgba(34, 197, 94, 0.4) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    padding: 16px !important;
    max-width: 92% !important;
}

.pm4u-card-header strong {
    font-size: 14.5px;
    color: #ffffff;
    display: block;
    margin-bottom: 4px;
}

.pm4u-card-header p {
    font-size: 12px;
    color: #94a3b8;
    margin: 0 0 12px 0;
    line-height: 1.35;
}

.pm4u-card-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pm4u-card-group input,
.pm4u-card-group select {
    width: 100%;
    padding: 8px 12px;
    background: #0f2744;
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 6px;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}

.pm4u-card-group select option {
    background: #0f2744;
    color: #ffffff;
}

.pm4u-card-group input:focus,
.pm4u-card-group select:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.2);
}

.pm4u-card-submit-btn {
    margin-top: 4px;
    padding: 10px;
    background: linear-gradient(135deg, #0b3a75, #16a34a);
    border: none;
    border-radius: 8px;
    color: #ffffff;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.pm4u-card-submit-btn:hover {
    transform: scale(1.02);
    background: linear-gradient(135deg, #0f4c81, #22c55e);
}

@media (max-width: 480px) {
    #pm4u-chatbot-modal {
        bottom: 85px;
        right: 16px;
        left: 16px;
        width: auto;
        height: 500px;
    }
    #pm4u-chatbot-launcher {
        bottom: 16px;
        left: 16px;
        right: auto;
        width: 54px;
        height: 54px;
        font-size: 22px;
    }
}
