:root {
    --opa-blue: #153d8a;
    --opa-blue-dark: #0d2f6d;
    --opa-green: #25d366;
    --opa-border: #dfe5ee;
    --opa-text: #1f2937;
    --opa-red: #d72130;
}

.opa {
    position: fixed;
    right: 20px;
    bottom: 24px;
    z-index: 999999;
    font-family: Arial, sans-serif;
}

.opa__launcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, #1b5fd1 0%, var(--opa-blue) 100%);
    color: #fff;
    padding: 13px 18px 13px 13px;
    box-shadow: 0 12px 28px rgba(21, 61, 138, .35);
    cursor: pointer;
    font-weight: 700;
    transition: transform .25s ease, box-shadow .25s ease;
}

.opa__launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 34px rgba(21, 61, 138, .45);
}

.opa__launcher-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    color: var(--opa-blue);
    display: grid;
    place-items: center;
    font-size: 20px;
    font-weight: 900;
}

.opa__panel {
    position: absolute;
    right: 0;
    bottom: 72px;
    width: min(430px, calc(100vw - 24px));
    max-height: min(680px, calc(100vh - 110px));
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--opa-border);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.opa__panel.is-open {
    display: flex;
}

.opa__header {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 76px;
    padding: 16px 72px 16px 16px;
    background: var(--opa-blue);
    color: #fff;
}

.opa__header strong,
.opa__header small {
    display: block;
}

.opa__header small {
    margin-top: 3px;
    opacity: .88;
}

.opa__close {
    position: absolute !important;
    top: 14px !important;
    right: 14px !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    display: grid !important;
    place-items: center !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: #fff !important;
    color: #ef233c !important;
    font-size: 23px !important;
    line-height: 1 !important;
    box-shadow: 0 6px 18px rgba(0,0,0,.12) !important;
    cursor: pointer !important;
}

.opa__body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    padding: 14px;
    overflow: hidden;
}

.opa__conversation {
    min-height: 220px;
    max-height: 390px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.opa__message {
    max-width: 88%;
    margin: 0 0 10px;
    padding: 11px 13px;
    border-radius: 14px;
    line-height: 1.42;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.opa__message--bot {
    background: #eef4ff;
    color: var(--opa-text);
    border-bottom-left-radius: 5px;
}

.opa__message--user {
    margin-left: auto;
    background: var(--opa-blue);
    color: #fff;
    border-bottom-right-radius: 5px;
}

.opa__message.is-thinking {
    opacity: .72;
    font-style: italic;
}

.opa__quick-actions {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
}

.opa__quick-actions button {
    flex: 0 0 auto;
    border: 1px solid #cfe0fb;
    border-radius: 999px;
    background: #f5f8ff;
    color: var(--opa-blue);
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.opa__search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.opa__input {
    min-width: 0;
    border: 1px solid var(--opa-border);
    border-radius: 12px;
    padding: 12px;
    font-size: 15px;
}

.opa__search-button {
    border: 0;
    border-radius: 12px;
    background: var(--opa-blue);
    color: #fff;
    padding: 0 16px;
    font-weight: 700;
    cursor: pointer;
}

.opa__product-list {
    margin: 4px 0 12px;
    border: 1px solid var(--opa-border);
    border-radius: 14px;
    padding: 0 10px;
}

.opa__product {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 11px;
    align-items: start;
    padding: 12px 0;
    border-bottom: 1px solid var(--opa-border);
}

.opa__product:last-child {
    border-bottom: 0;
}

.opa__product-image-link,
.opa__product img {
    width: 76px;
    height: 76px;
}

.opa__product img {
    object-fit: contain;
    border-radius: 10px;
    background: #f7f8fa;
}

.opa__product-info {
    min-width: 0;
}

.opa__product-name {
    display: -webkit-box;
    color: var(--opa-text);
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.opa__stock {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    font-weight: 700;
}

.opa__stock.is-in-stock { color: #167d35; }
.opa__stock.is-out { color: #b42318; }

.opa__price {
    margin-top: 5px;
    line-height: 1.35;
}

.opa__old-price {
    display: block;
    color: #7b8491;
    font-size: 13px;
    text-decoration: line-through;
}

.opa__sale-price {
    display: block;
    color: #1f2937;
    font-size: 16px;
    font-weight: 800;
}

.opa__view-product {
    display: inline-flex;
    margin-top: 8px;
    padding: 7px 11px;
    border-radius: 8px;
    background: #eef4ff;
    color: var(--opa-blue);
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
}

.opa__footer {
    padding: 12px 16px 16px;
    border-top: 1px solid var(--opa-border);
}

.opa__whatsapp {
    width: 100%;
    border: 0;
    border-radius: 10px;
    background: var(--opa-green);
    color: #fff;
    padding: 12px;
    font-weight: 700;
    cursor: pointer;
}

@media (max-width: 767px) {
    .opa {
        right: 12px;
        bottom: 84px;
    }

    .opa__launcher {
        width: 62px;
        height: 62px;
        padding: 0;
        justify-content: center;
        border-radius: 50%;
    }

    .opa__launcher-text {
        display: none;
    }

    .opa__launcher-icon {
        width: 38px;
        height: 38px;
    }

    .opa__panel {
        position: fixed;
        left: 8px;
        right: 8px;
        bottom: 145px;
        width: auto;
        max-height: calc(100vh - 165px);
    }

    .opa__conversation {
        min-height: 180px;
        max-height: calc(100vh - 390px);
    }
}


/* ===== OnePharma v0.6 — layout e cores ===== */
.opa__launcher {
    background: linear-gradient(135deg, var(--opa-blue) 0%, var(--opa-blue-dark) 100%) !important;
}

.opa__launcher-icon {
    overflow: hidden;
    padding: 4px;
}

.opa__launcher-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.opa__header {
    background: linear-gradient(135deg, var(--opa-blue) 0%, var(--opa-blue-dark) 100%) !important;
}

.opa__header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.opa__avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    padding: 3px;
    border-radius: 12px;
    background: #fff;
    object-fit: contain;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
}

.opa__body {
    gap: 10px;
}

.opa__conversation {
    min-height: 250px;
    max-height: 430px;
    padding: 0 2px 4px 0;
}

.opa__quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    overflow: visible;
    padding: 2px 0 10px;
}

.opa__quick-actions button {
    border: 1px solid rgba(15,135,201,.28);
    background: #f3faff;
    color: var(--opa-blue);
    padding: 8px 11px;
    line-height: 1.15;
}

.opa__quick-actions button:hover {
    background: var(--opa-blue);
    color: #fff;
}

.opa__search-form {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding-top: 4px;
    background: #fff;
}

.opa__search-button {
    background: var(--opa-red) !important;
    color: #fff !important;
    box-shadow: 0 6px 16px rgba(215,33,48,.2);
}

.opa__search-button:hover {
    filter: brightness(.95);
}

.opa__whatsapp {
    background: var(--opa-green) !important;
    color: #fff !important;
    box-shadow: 0 7px 18px rgba(37,211,102,.22);
}

.opa__whatsapp:hover {
    filter: brightness(.95);
}

.opa__product-list {
    overflow: hidden;
}

.opa__product {
    overflow: hidden;
}

.opa__product-name {
    overflow-wrap: anywhere;
}

.opa__view-product {
    background: #eaf7ff;
    color: var(--opa-blue);
}

@media (max-width: 767px) {
    .opa__conversation {
        min-height: 220px;
        max-height: calc(100vh - 360px);
    }

    .opa__quick-actions {
        position: sticky;
        top: 0;
        z-index: 3;
        background: #fff;
        padding-top: 4px;
    }

    .opa__quick-actions button {
        font-size: 11px;
        padding: 7px 9px;
    }

    .opa__avatar {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }
}


/* ===== v0.7 — respostas rápidas e cabeçalho ===== */
.opa__header-brand > div {
    min-width: 0;
}

.opa__header strong {
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.opa__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: -2px 0 12px;
}

.opa__suggestions button {
    border: 1px solid rgba(15, 135, 201, .34);
    border-radius: 999px;
    background: #ffffff;
    color: var(--opa-blue);
    padding: 9px 12px;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.2;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15, 135, 201, .08);
}

.opa__suggestions button:hover {
    background: var(--opa-blue);
    color: #fff;
}

@media (max-width: 767px) {
    .opa__header strong {
        font-size: 14px;
    }

    .opa__header small {
        font-size: 11px;
    }

    .opa__suggestions button {
        flex: 1 1 140px;
    }
}


/* ===== v0.8 — Verônica visível e WhatsApp compacto ===== */
.opa__footer {
    padding: 9px 14px 12px !important;
}

.opa__whatsapp {
    width: auto !important;
    min-width: 220px !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 auto !important;
    padding: 9px 16px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    line-height: 1.15 !important;
    letter-spacing: .1px !important;
}

.opa__header strong {
    font-size: 15px !important;
}

.opa__launcher-text {
    font-weight: 800 !important;
}

@media (max-width: 767px) {
    .opa__whatsapp {
        min-width: 190px !important;
        padding: 9px 14px !important;
        font-size: 11px !important;
    }

    .opa__header strong {
        font-size: 13px !important;
    }
}


/* ===== v0.9 — indicador “Verônica está digitando” ===== */
.opa__typing-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin: 0 0 12px;
}

.opa__typing-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--opa-blue), var(--opa-blue-dark));
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    box-shadow: 0 4px 10px rgba(15, 135, 201, .18);
}

.opa__typing-bubble {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    max-width: 82%;
    padding: 10px 12px;
    border-radius: 14px 14px 14px 5px;
    background: #eef4ff;
    color: #526070;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

.opa__typing-label {
    font-size: 12px;
    font-weight: 700;
}

.opa__typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 14px;
}

.opa__typing-dots i {
    width: 6px;
    height: 6px;
    display: block;
    border-radius: 50%;
    background: var(--opa-blue);
    opacity: .35;
    animation: opaTypingDot 1.2s infinite ease-in-out;
}

.opa__typing-dots i:nth-child(2) {
    animation-delay: .16s;
}

.opa__typing-dots i:nth-child(3) {
    animation-delay: .32s;
}

@keyframes opaTypingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: .3;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .opa__typing-dots i {
        animation: none;
        opacity: .75;
    }
}
