/* ============================================================
   Propague Gestores — Chat Widget CSS (Frontend)
   Plugin oficial · Freddy Nascimento
   ============================================================ */

/* ─── Widget container ───────────────────────────────────────── */
.pg-chat-widget {
    --pg-color: #C8A96A;
    --pg-width: 100%;
    display: flex;
    flex-direction: column;
    border: 1.5px solid #e0e0e0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    width: 100%;
}

/* ─── Header ─────────────────────────────────────────────────── */
.pg-chat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: #1a1a1a;
    color: #fff;
    border-bottom: 2px solid var(--pg-color);
}

.pg-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--pg-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 800;
    flex-shrink: 0;
    letter-spacing: -1px;
    overflow: hidden;
}

.pg-chat-agent-info {
    flex: 1;
    min-width: 0;
}

.pg-chat-agent-info strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-chat-agent-info span {
    font-size: 11px;
    color: #aaa;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.pg-chat-badge {
    font-size: 10px;
    letter-spacing: .14em;
    font-weight: 700;
    background: var(--pg-color);
    color: #fff;
    padding: 3px 9px;
    border-radius: 20px;
    flex-shrink: 0;
}

/* ─── Messages window ────────────────────────────────────────── */
.pg-chat-messages {
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: #fafafa;
    scroll-behavior: smooth;
}

/* ─── Message bubbles ────────────────────────────────────────── */
.pg-msg {
    display: flex;
}

.pg-msg--user {
    justify-content: flex-end;
}

.pg-msg--agent {
    justify-content: flex-start;
}

.pg-msg-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.65;
    word-break: break-word;
}

.pg-msg--user .pg-msg-bubble {
    background: #1a1a1a;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.pg-msg--agent .pg-msg-bubble {
    background: #fff;
    color: #1d2327;
    border: 1px solid #e8e8e8;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
}

/* ─── Typing indicator ───────────────────────────────────────── */
.pg-msg--typing .pg-msg-bubble {
    padding: 12px 16px;
}

.pg-typing-dots {
    display: flex;
    gap: 5px;
    align-items: center;
}

.pg-typing-dots span {
    width: 7px;
    height: 7px;
    background: var(--pg-color);
    border-radius: 50%;
    animation: pg-bounce 1.2s infinite ease-in-out;
}

.pg-typing-dots span:nth-child(1) { animation-delay: 0s; }
.pg-typing-dots span:nth-child(2) { animation-delay: .2s; }
.pg-typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes pg-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: .5; }
    40%           { transform: scale(1);   opacity: 1;  }
}

/* ─── Chat form ──────────────────────────────────────────────── */
.pg-chat-form {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.pg-chat-input {
    flex: 1;
    min-width: 0;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #1d2327;
    resize: none;
    line-height: 1.5;
    max-height: 140px;
    overflow-y: auto;
    transition: border-color .15s;
    background: #fff;
}

.pg-chat-input:focus {
    outline: none;
    border-color: var(--pg-color);
}

.pg-chat-input::placeholder {
    color: #aaa;
}

.pg-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--pg-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: opacity .15s, transform .1s;
}

.pg-chat-send:hover {
    opacity: .88;
}

.pg-chat-send:active {
    transform: scale(.94);
}

.pg-chat-send:disabled {
    opacity: .4;
    cursor: not-allowed;
}

/* ─── Disclaimer ─────────────────────────────────────────────── */
.pg-chat-disclaimer {
    font-size: 11px;
    color: #aaa;
    text-align: center;
    padding: 8px 16px 10px;
    margin: 0;
    line-height: 1.5;
    background: #fff;
    border-top: 1px solid #f0f0f0;
}

/* ─── Error message ──────────────────────────────────────────── */
.pg-msg--error .pg-msg-bubble {
    background: #fce8e8;
    color: #c0392b;
    border-color: #f5c6c6;
    font-size: 13px;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    .pg-chat-widget {
        border-radius: 10px;
    }
    .pg-msg-bubble {
        max-width: 92%;
        font-size: 13px;
    }
    .pg-chat-input {
        font-size: 13px;
    }
}

/* ============================================================
   Propague Gestores — Floating Chat Styles
   ============================================================ */

.pg-float-wrapper {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Trigger Button ────────────────────────────────────────── */
.pg-float-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: .02em;
    transition: transform 0.2s, background 0.2s, color 0.2s, box-shadow 0.2s;
    user-select: none;
    outline: none;
}

.pg-float-trigger:active {
    transform: scale(0.95);
}

.pg-float-trigger-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Janela Popup ──────────────────────────────────────────── */
.pg-float-panel {
    position: absolute;
    bottom: 65px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    transition: transform 0.25s cubic-bezier(0.1, 0.76, 0.55, 0.94), opacity 0.2s;
    animation: pgFloatFadeIn 0.25s ease-out;
}

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

.pg-float-step-selector,
.pg-float-step-chat {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* ─── Panel Header ──────────────────────────────────────────── */
.pg-float-panel-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.pg-float-panel-header h3 {
    margin: 0 0 4px;
    font-size: 17px;
    font-weight: 800;
    color: #1a1a1a;
    letter-spacing: -0.01em;
}

.pg-float-panel-header p {
    margin: 0;
    font-size: 12px;
    color: #888;
}

.pg-float-close {
    position: absolute;
    top: 18px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    font-weight: 300;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: color 0.15s;
}

.pg-float-close:hover {
    color: #1a1a1a;
}

/* ─── Agents List ───────────────────────────────────────────── */
.pg-float-agents-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pg-float-agent-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
}

.pg-float-agent-card:hover {
    background: #f3f3f3;
    border-color: #ddd;
    transform: translateY(-1px);
}

.pg-float-agent-card:active {
    transform: translateY(0);
}

.pg-float-agent-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    overflow: hidden;
    background: #1a1a1a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.pg-float-agent-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pg-float-agent-info {
    flex: 1;
    min-width: 0;
}

.pg-float-agent-info strong {
    display: block;
    font-size: 14px;
    color: #1a1a1a;
    font-weight: 700;
    margin-bottom: 2px;
}

.pg-float-agent-info span {
    display: block;
    font-size: 11px;
    color: #777;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pg-float-agent-arrow {
    font-size: 14px;
    color: #ccc;
    font-weight: 300;
    transition: color 0.15s, transform 0.15s;
}

.pg-float-agent-card:hover .pg-float-agent-arrow {
    color: #1a1a1a;
    transform: translateX(3px);
}

/* ─── Chat View ─────────────────────────────────────────────── */
.pg-float-chat-header {
    padding: 14px 20px;
    background: #1a1a1a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid #C8A96A;
}

.pg-float-chat-header .pg-float-close {
    position: static;
    color: #bbb;
    font-size: 24px;
    line-height: 1;
}

.pg-float-chat-header .pg-float-close:hover {
    color: #fff;
}

.pg-float-back-btn {
    background: none;
    border: none;
    color: #bbb;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    transition: color 0.15s;
}

.pg-float-back-btn:hover {
    color: #fff;
}

.pg-float-chat-title {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.pg-float-chat-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.pg-float-widget-item {
    height: 100%;
}

.pg-float-widget-item .pg-chat-widget {
    height: 100%;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

.pg-float-widget-item .pg-chat-header {
    display: none; /* Esconde o header duplicado pois o popup já tem header */
}

/* ─── Layout Styles ─────────────────────────────────────────── */

/* OPÇÃO 1 — Modern Glassmorphism */
.pg-float-layout-style1 .pg-float-trigger {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #1a1a1a;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 30px;
    padding: 12px 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.pg-float-layout-style1 .pg-float-trigger:hover {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.pg-float-layout-style1 .pg-float-panel {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

/* OPÇÃO 2 — Classic Solid */
.pg-float-layout-style2 .pg-float-trigger {
    background: #000;
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 14px 28px;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.25);
}

.pg-float-layout-style2 .pg-float-trigger:hover {
    background: #222;
}

.pg-float-layout-style2 .pg-float-panel {
    background: #fff;
    border: 3px solid #000;
    border-radius: 4px;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15);
}

.pg-float-layout-style2 .pg-float-panel-header {
    background: #fafafa;
    border-bottom: 3px solid #000;
}

.pg-float-layout-style2 .pg-float-chat-header {
    background: #000;
    border-bottom: 3px solid #C8A96A;
}

.pg-float-layout-style2 .pg-float-agent-card {
    border: 2px solid #000;
    border-radius: 4px;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.1);
}

.pg-float-layout-style2 .pg-float-agent-card:hover {
    background: #fafafa;
    box-shadow: 3px 3px 0px rgba(0, 0, 0, 0.2);
}

/* OPÇÃO 3 — Clean Minimalist */
.pg-float-layout-style3 .pg-float-trigger {
    background: #fff;
    color: #000;
    border: 1.5px solid #000;
    border-radius: 50px;
    padding: 10px 22px;
    box-shadow: none;
}

.pg-float-layout-style3 .pg-float-trigger:hover {
    background: #000;
    color: #fff;
}

.pg-float-layout-style3 .pg-float-panel {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
}

