/* ============================================
   SignalMatrix AI — Chat Modal + FAB Styles
   ============================================ */

/* ─── Chat Modal Overlay ─── */
.sm-chat-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sm-chat-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* ─── Chat Modal ─── */
.sm-chat-modal {
    background: #12121a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    width: 95%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: transform 0.3s ease;
    overflow: hidden;
}
.sm-chat-overlay.active .sm-chat-modal {
    transform: translateY(0);
}

/* ─── Chat Header ─── */
.sm-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(135deg, rgba(0,255,136,0.05), rgba(0,212,255,0.05));
    flex-shrink: 0;
}
.sm-chat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #000;
    flex-shrink: 0;
}
.sm-chat-header-info {
    flex: 1;
    min-width: 0;
}
.sm-chat-header-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sm-chat-header-status {
    font-size: 0.75rem;
    color: #00ff88;
    margin: 0;
}
.sm-chat-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(255,255,255,0.08);
    color: #a0a0b0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.2s;
    flex-shrink: 0;
}
.sm-chat-close:hover {
    background: rgba(255,68,68,0.2);
    color: #ff4444;
}

/* ─── HIPAA Disclaimer ─── */
.sm-chat-disclaimer {
    padding: 8px 20px;
    background: rgba(0,255,136,0.05);
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 0.7rem;
    color: #808090;
    text-align: center;
    flex-shrink: 0;
}

/* ─── Chat Messages Area ─── */
.sm-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 250px;
    max-height: 50vh;
}

/* ─── Message Bubbles ─── */
.sm-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.5;
    word-wrap: break-word;
}
.sm-chat-msg-user {
    align-self: flex-end;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: #000;
    border-bottom-right-radius: 4px;
}
.sm-chat-msg-assistant {
    align-self: flex-start;
    background: rgba(255,255,255,0.06);
    color: #e0e0e8;
    border-bottom-left-radius: 4px;
}

/* ─── Typing Indicator ─── */
.sm-chat-typing {
    display: none;
    align-self: flex-start;
    padding: 12px 16px;
    background: rgba(255,255,255,0.06);
    border-radius: 12px;
    border-bottom-left-radius: 4px;
}
.sm-chat-typing.active {
    display: flex;
    gap: 4px;
    align-items: center;
}
.sm-chat-typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #a0a0b0;
    animation: smTypingBounce 1.4s infinite ease-in-out;
}
.sm-chat-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.sm-chat-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes smTypingBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* ─── Starter Questions ─── */
.sm-chat-starters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 20px 12px;
    flex-shrink: 0;
}
.sm-chat-starter {
    padding: 6px 12px;
    background: rgba(0,255,136,0.08);
    border: 1px solid rgba(0,255,136,0.2);
    border-radius: 20px;
    color: #00ff88;
    font-size: 0.78rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}
.sm-chat-starter:hover {
    background: rgba(0,255,136,0.15);
    border-color: rgba(0,255,136,0.4);
}

/* ─── Chat Input ─── */
.sm-chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 12px 20px 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: #0e0e16;
    flex-shrink: 0;
}
.sm-chat-input {
    flex: 1;
    padding: 10px 14px;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 0.88rem;
    outline: none;
    font-family: 'Inter', sans-serif;
    resize: none;
    min-height: 40px;
    max-height: 80px;
}
.sm-chat-input:focus {
    border-color: #00ff88;
    box-shadow: 0 0 0 2px rgba(0,255,136,0.1);
}
.sm-chat-input::placeholder {
    color: #606070;
}
.sm-chat-send {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
    flex-shrink: 0;
    align-self: flex-end;
}
.sm-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(0,255,136,0.3);
}
.sm-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ─── Lead Capture Form ─── */
.sm-chat-lead {
    display: none;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,255,136,0.03);
    flex-shrink: 0;
}
.sm-chat-lead.active {
    display: block;
}
.sm-chat-lead-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}
.sm-chat-lead-fields {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}
.sm-chat-lead-input {
    flex: 1;
    padding: 8px 10px;
    background: #1a1a2e;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 0.82rem;
    outline: none;
    font-family: 'Inter', sans-serif;
}
.sm-chat-lead-input:focus {
    border-color: #00ff88;
}
.sm-chat-lead-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.sm-chat-lead-btn {
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-family: 'Inter', sans-serif;
}
.sm-chat-lead-submit {
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: #000;
}
.sm-chat-lead-skip {
    background: transparent;
    color: #a0a0b0;
    border: 1px solid rgba(255,255,255,0.1);
}

/* ─── Session End CTA ─── */
.sm-chat-end {
    display: none;
    padding: 16px 20px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,255,136,0.03);
    flex-shrink: 0;
}
.sm-chat-end.active {
    display: block;
}
.sm-chat-end-text {
    font-size: 0.85rem;
    color: #a0a0b0;
    margin-bottom: 12px;
}
.sm-chat-end-cta {
    display: inline-block;
    padding: 10px 24px;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: #000;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.2s;
}
.sm-chat-end-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(0,255,136,0.3);
    color: #000;
}
.sm-chat-end-phone {
    display: block;
    margin-top: 8px;
    font-size: 0.82rem;
    color: #00ff88;
}

/* ─── Floating Action Button (FAB) ─── */
.sm-chat-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #00ff88, #00d4ff);
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: 0 4px 20px rgba(0,255,136,0.35);
    transition: all 0.3s ease;
}
.sm-chat-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0,255,136,0.5);
}
.sm-chat-fab i {
    font-size: 1.2rem;
}
.sm-chat-fab-label {
    transition: all 0.3s;
}

/* ─── Mobile Responsive ─── */
@media (max-width: 576px) {
    .sm-chat-modal {
        width: 100%;
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
    }
    .sm-chat-messages {
        max-height: calc(100vh - 250px);
    }
    .sm-chat-fab {
        bottom: 16px;
        right: 16px;
        padding: 12px 16px;
        font-size: 0.85rem;
    }
    .sm-chat-fab.collapsed {
        padding: 14px;
        border-radius: 50%;
    }
    .sm-chat-fab.collapsed .sm-chat-fab-label {
        display: none;
    }
    .sm-chat-lead-fields {
        flex-direction: column;
    }
}
