/* ClasWeb Live Chat - Widget Frontend (Isolado com prefixo cwlc-) */
:root {
    --cwlc-primary: #0D6EFD;
    --cwlc-secondary: #0A58CA;
}

.cwlc-container {
    position: fixed;
    bottom: 20px;
    z-index: 999990;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: #1e293b;
}

.cwlc-pos-right { right: 20px; }
.cwlc-pos-left { left: 20px; }

.cwlc-hidden { display: none !important; }

.cwlc-launcher {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--cwlc-primary), var(--cwlc-secondary));
    color: #ffffff;
    border: none;
    border-radius: 999px;
    padding: 12px 18px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(13, 110, 253, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.cwlc-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(13, 110, 253, 0.45);
}

.cwlc-launcher-status {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.cwlc-launcher-label {
    font-weight: 600;
    font-size: 14px;
}

.cwlc-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    border: 2px solid #ffffff;
}

.cwlc-window {
    width: 350px;
    max-width: calc(100vw - 24px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.22);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-bottom: 12px;
}

.cwlc-header {
    background: linear-gradient(135deg, var(--cwlc-primary), var(--cwlc-secondary));
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cwlc-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cwlc-avatar-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.cwlc-avatar,
.cwlc-avatar-fallback {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.cwlc-online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid var(--cwlc-secondary);
}

.cwlc-header-text {
    display: flex;
    flex-direction: column;
}

.cwlc-header-text strong {
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.cwlc-header-text span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.9);
}

.cwlc-icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cwlc-icon-btn:hover { background: rgba(255, 255, 255, 0.25); }

.cwlc-promo-bar {
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #1e3a8a;
}

.cwlc-promo-bar a {
    color: var(--cwlc-primary);
    font-weight: 700;
    text-decoration: none;
}

.cwlc-promo-bar a:hover { text-decoration: underline; }

.cwlc-messages {
    height: 280px;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cwlc-empty-state {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px;
    font-size: 13px;
    color: #475569;
}

.cwlc-msg {
    max-width: 84%;
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 13.5px;
    word-wrap: break-word;
}

.cwlc-msg-visitor {
    align-self: flex-end;
    background: var(--cwlc-primary);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.cwlc-msg-agent {
    align-self: flex-start;
    background: #ffffff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.cwlc-msg-system {
    align-self: center;
    background: #e2e8f0;
    color: #475569;
    font-size: 11.5px;
    text-align: center;
    max-width: 95%;
}

.cwlc-msg-meta {
    display: block;
    font-size: 10.5px;
    opacity: 0.75;
    margin-top: 4px;
}

.cwlc-msg a {
    color: inherit;
    text-decoration: underline;
    font-weight: 600;
}

.cwlc-form {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
}

.cwlc-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 11px;
    font-size: 13.5px;
    outline: none;
    color: #0f172a;
    background: #ffffff;
}

.cwlc-input:focus { border-color: var(--cwlc-primary); }

.cwlc-send-btn {
    background: var(--cwlc-primary);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cwlc-send-btn:hover { background: var(--cwlc-secondary); }

.cwlc-privacy-note {
    background: #f8fafc;
    color: #64748b;
    font-size: 10.5px;
    text-align: center;
    padding: 5px 8px;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 480px) {
    .cwlc-container {
        bottom: 12px;
        right: 12px;
        left: 12px;
        display: flex;
        flex-direction: column;
        align-items: flex-end;
    }
    .cwlc-window {
        width: 100%;
        max-width: 100%;
    }
    .cwlc-messages {
        height: 240px;
    }
}
