/* Samuca widget */
.samuca-shell {
    position: relative;
    z-index: 99980;
}

.samuca-widget {
    position: fixed;
    right: 20px;
    bottom: 110px;
    width: 420px;
    max-width: calc(100vw - 24px);
    height: min(680px, calc(100vh - 140px));
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.samuca-widget.is-hidden {
    display: none;
}

.samuca-header {
    flex: 0 0 auto;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, var(--samuca-color, #1d4ed8), #1e3a8a);
    color: #fff;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.samuca-header-main {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    min-width: 0;
}

.samuca-avatar {
    width: 42px;
    height: 42px;
    min-width: 42px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.18);
    color: #fff;
    font-weight: 700;
}

.samuca-title-wrap { min-width: 0; }
.samuca-title { font-size: 15px; font-weight: 700; line-height: 1.2; margin: 0 0 4px; }
.samuca-subtitle { font-size: 13px; line-height: 1.35; opacity: .92; margin: 0; }
.samuca-close { background: transparent; border: 0; color: #fff; font-size: 20px; cursor: pointer; line-height: 1; padding: 2px; }
.samuca-body { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; background: #f8fafc; color: #0f172a; }

.samuca-gate {
    padding: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 12px;
}

.samuca-gate-text { margin: 0; color: #475569; line-height: 1.5; }
.samuca-question-wrap { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.samuca-question {
    font-size: 28px;
    font-weight: 800;
    padding: 12px 16px;
    border-radius: 14px;
    background: #eff6ff;
    color: #0f172a;
}
.samuca-secondary-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #dbe2ea;
    background: #fff;
    color: #1f2937;
    font-size: 13px;
    font-weight: 600;
}
.samuca-gate-form { display: flex; gap: 10px; }
.samuca-gate-form input {
    flex: 1;
    height: 46px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 0 12px;
    outline: none;
    font-size: 14px;
    background: #fff;
}
.samuca-gate-form button {
    min-width: 132px;
    height: 46px;
    border: 0;
    border-radius: 12px;
    background: var(--samuca-color, #2563eb);
    color: #fff;
    font-weight: 700;
}
.samuca-status { min-height: 20px; font-size: 13px; color: #64748b; }

.samuca-chat { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.samuca-top-fields {
    padding: 14px 16px 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    background: #fff;
}
.samuca-top-fields input {
    width: 100%;
    height: 42px;
    border: 1px solid #dbe3ef;
    border-radius: 12px;
    padding: 0 12px;
    outline: none;
    font-size: 14px;
}
.samuca-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 14px 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.samuca-message {
    max-width: 86%;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}
.samuca-message.bot,
.samuca-message.assistant {
    background: #eef2f7;
    color: #1e293b;
    align-self: flex-start;
}
.samuca-message.user {
    background: #dbeafe;
    color: #1e3a8a;
    align-self: flex-end;
}
.samuca-message.typing { opacity: .8; font-style: italic; }
.samuca-actions {
    padding: 8px 16px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fff;
    border-top: 1px solid #edf2f7;
}
.samuca-chip,
.samuca-chip-link {
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid #d8e1ee;
    background: #fff;
    color: #1f2937;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.samuca-footer {
    flex: 0 0 auto;
    padding: 12px 16px 16px;
    background: #fff;
    border-top: 1px solid #edf2f7;
}
.samuca-compose { display: flex; gap: 10px; align-items: flex-end; }
.samuca-compose textarea {
    flex: 1;
    min-height: 48px;
    max-height: 120px;
    resize: none;
    border: 1px solid #dbe3ef;
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 15px;
    outline: none;
    background: #fff;
}
.samuca-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--samuca-color, #2563eb);
    color: #fff;
    cursor: pointer;
    font-size: 18px;
}
.samuca-note { margin-top: 10px; font-size: 12px; color: #64748b; line-height: 1.4; }

.samuca-launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99980;
}
.samuca-launcher button {
    min-height: 58px;
    padding: 0 22px;
    border-radius: 999px;
    border: 0;
    background: linear-gradient(135deg, var(--samuca-color, #2563eb), #1d4ed8);
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.28);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}
.samuca-trigger-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.samuca-launcher.has-whatsapp { right: 96px; }

.whatsapp-float,
.btn-whatsapp-float,
.float-whatsapp {
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99970 !important;
}

@media (max-width: 768px) {
    .samuca-widget {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 88px;
        height: calc(100vh - 100px);
        max-width: none;
        border-radius: 20px;
    }

    .samuca-top-fields { grid-template-columns: 1fr; }
    .samuca-gate-form { flex-direction: column; }
    .samuca-gate-form button { width: 100%; }
    .samuca-launcher { right: 84px; bottom: 16px; }
    .samuca-launcher.has-whatsapp { right: 84px; }
    .samuca-launcher button { min-height: 52px; padding: 0 18px; font-size: 15px; }
}
