/**
 * SiteMind Chat Widget — Frontend Styles
 *
 * Floating chat bubble and window for [sitemind_chat] shortcode.
 */

/* =============================================
   CSS Custom Property: --smc-color (set by JS)
   Default fallback: #085DA8
   ============================================= */

/* ---------- Container ---------- */
.smc-widget-container {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
}

.smc-widget-right {
    right: 20px;
}

.smc-widget-left {
    left: 20px;
    align-items: flex-start;
}

/* ---------- Bubble Button ---------- */
.smc-widget-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--smc-color, #085DA8);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
    border: none;
    padding: 0;
    outline: none;
}

.smc-widget-bubble:hover {
    transform: scale(1.1);
}

.smc-widget-bubble svg {
    width: 28px;
    height: 28px;
    fill: white;
}

/* ---------- Chat Window ---------- */
.smc-widget-window {
    display: none;
    width: 380px;
    max-height: 600px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    overflow: hidden;
    flex-direction: column;
}

.smc-widget-window.open {
    display: flex;
}

/* ---------- Header ---------- */
.smc-widget-header {
    background: var(--smc-color, #085DA8);
    color: white;
    padding: 16px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.smc-widget-header-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.smc-widget-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    padding: 0 0 0 12px;
    opacity: 0.8;
}

.smc-widget-close:hover {
    opacity: 1;
}

/* ---------- Messages Area ---------- */
.smc-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    background: #f9fafb;
}

/* ---------- Individual Messages ---------- */
.smc-message {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.smc-message-visitor {
    align-self: flex-end;
    background: var(--smc-color, #085DA8);
    color: white;
    border-bottom-right-radius: 4px;
}

.smc-message-agent {
    align-self: flex-start;
    background: #f0f0f1;
    color: #1d2327;
    border-bottom-left-radius: 4px;
}

.smc-message-ai {
    align-self: flex-start;
    background: #f0f0f1;
    color: #1d2327;
    border-bottom-left-radius: 4px;
    font-style: italic;
}

/* ---------- Input Area ---------- */
.smc-widget-input-area {
    padding: 12px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 8px;
    background: white;
}

.smc-widget-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}

.smc-widget-input:focus {
    border-color: var(--smc-color, #085DA8);
}

.smc-widget-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--smc-color, #085DA8);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
}

.smc-widget-send:hover {
    opacity: 0.9;
}

.smc-widget-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.smc-widget-send svg {
    width: 18px;
    height: 18px;
    fill: white;
}

/* ---------- Typing Indicator ---------- */
.smc-typing {
    display: flex;
    gap: 4px;
    padding: 8px 14px;
    align-self: flex-start;
}

.smc-typing-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: smc-bounce 1.4s infinite;
}

.smc-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.smc-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes smc-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-4px);
    }
}

/* ---------- Mobile Responsive ---------- */
@media (max-width: 480px) {
    .smc-widget-container {
        bottom: 0;
        right: 0 !important;
        left: 0 !important;
        align-items: stretch;
    }

    .smc-widget-bubble {
        align-self: flex-end;
        margin-right: 12px;
        margin-bottom: 12px;
    }

    .smc-widget-window {
        width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }

    .smc-widget-left .smc-widget-bubble {
        align-self: flex-start;
        margin-left: 12px;
        margin-right: 0;
    }
}