/* Puradoro Quick Order — Chat Widget v2 */

.pqo-btn-wrap { width: 100%; }
.pqo-btn-wrap .pqo-cart-shim { margin: 0; width: 100%; }
.pqo-btn-wrap .pqo-cart-shim .pqo-trigger-btn.pqo-woodmart-btn {
    -webkit-appearance: none;
    appearance: none;
    border-radius: var(--btn-accented-brd-radius, 0);
    box-shadow: var(--btn-accented-box-shadow, none);
    background-color: var(--btn-accented-bgcolor);
    color: var(--btn-accented-color);
    min-height: var(--btn-accented-height, var(--btn-height, 42px));
    font-size: var(--btn-accented-font-size, var(--btn-font-size, 13px));
    text-transform: var(--btn-accented-transform, var(--btn-transform, uppercase));
    font-weight: var(--btn-accented-font-weight, var(--btn-font-weight, 600));
    position: relative;
    border: none;
}
.pqo-btn-wrap .pqo-cart-shim .pqo-trigger-btn.pqo-woodmart-btn:hover {
    color: var(--btn-accented-color-hover);
    background-color: var(--btn-accented-bgcolor-hover);
}
.pqo-trigger-btn { cursor: pointer; }
.pqo-trigger-btn:focus { outline: 2px solid currentColor; outline-offset: 2px; }

/* Overlay — always centered modal */
#pqo-overlay.pqo-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999998;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px;
    box-sizing: border-box;
}
#pqo-overlay.pqo-overlay.active {
    display: flex !important;
}

/* Chat window */
#pqo-overlay .pqo-chat-window {
    background: #fff;
    width: 100%;
    max-width: 420px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    max-height: min(88vh, 640px);
    min-height: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
    overflow: hidden;
    animation: pqo-modal-in 0.22s ease;
    margin: 0;
    position: relative;
}

@keyframes pqo-modal-in {
    from { transform: scale(0.96) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

/* Header — uses grid; critical rules also in JS pqoCriticalCss() */
#pqo-overlay .pqo-header {
    background: #2A5C45;
    color: #fff;
    flex-shrink: 0;
}
#pqo-overlay .pqo-h-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
#pqo-overlay .pqo-h-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.55);
    outline-offset: 1px;
}

/* Product badge */
.pqo-product-badge {
    background: #f0f7f4;
    border-left: 3px solid #2A5C45;
    padding: 10px 14px;
    font-size: 13px;
    color: #2A5C45;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.pqo-product-badge img {
    width: 36px;
    height: 36px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}
.pqo-product-badge strong { display: block; font-size: 13px; }
.pqo-product-badge span { font-size: 14px; font-weight: 700; }

/* Messages */
.pqo-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: #f9f9f9;
    -webkit-overflow-scrolling: touch;
}
.pqo-msg {
    max-width: 88%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-break: break-word;
}
.pqo-msg.bot {
    background: #fff;
    border: 1px solid #e8e8e8;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    color: #333;
}
.pqo-msg.bot a {
    color: #2A5C45;
    font-weight: 600;
}
.pqo-msg.free-ship-hint {
    background: #f0f7f4;
    border: 1px solid #b8d8cc;
    align-self: flex-start;
    font-size: 13px;
}
.pqo-msg.user {
    background: #2A5C45;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}
.pqo-msg.system {
    background: #fff8e7;
    border: 1px solid #f0d080;
    align-self: center;
    font-size: 12px;
    color: #7a6000;
    max-width: 95%;
    text-align: center;
}

/* Typing */
.pqo-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    width: 56px;
}
.pqo-typing span {
    width: 8px;
    height: 8px;
    background: #2A5C45;
    border-radius: 50%;
    animation: pqo-bounce 1.2s infinite;
    opacity: 0.6;
}
.pqo-typing span:nth-child(2) { animation-delay: 0.2s; }
.pqo-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes pqo-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* Summary */
.pqo-summary {
    background: #f0f7f4;
    border: 1px solid #b8d8cc;
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 13px;
    align-self: flex-start;
    max-width: 95%;
}
.pqo-summary h4 {
    margin: 0 0 8px;
    color: #2A5C45;
    font-size: 13px;
    font-weight: 700;
}
.pqo-summary table { width: 100%; border-collapse: collapse; }
.pqo-summary td { padding: 3px 0; font-size: 13px; }
.pqo-summary td:last-child { text-align: right; font-weight: 600; }
.pqo-summary .pqo-total-row td {
    font-weight: 700;
    border-top: 1px solid #b8d8cc;
    padding-top: 6px;
    color: #2A5C45;
}
.pqo-summary-meta {
    margin-top: 8px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}
.pqo-summary-address {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #d8e8e0;
}
.pqo-summary-label {
    font-weight: 700;
    color: #2A5C45;
    font-size: 12px;
}

/* Support footer removed — contact in header */

/* Input */
.pqo-input-area {
    padding: 10px 14px;
    background: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.pqo-input-area input[type="text"] {
    flex: 1;
    min-width: 0;
    border: 1px solid #ddd;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 16px;
    outline: none;
    background: #f9f9f9;
}
.pqo-input-area input[type="text"]:focus {
    border-color: #2A5C45;
    background: #fff;
}
.pqo-send-btn {
    background: #2A5C45;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.pqo-send-btn:hover { background: #1e4332; }
.pqo-send-btn:disabled { background: #aaa; cursor: default; }

/* Quick replies — inline în conversație */
.pqo-inline-replies {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 92%;
    width: 100%;
    margin: 2px 0 4px;
}
.pqo-inline-replies .pqo-quick-reply {
    background: #fff;
    border: 1px solid #2A5C45;
    color: #2A5C45;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    text-align: left;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(42, 92, 69, 0.08);
}
.pqo-inline-replies .pqo-quick-reply:hover {
    background: #2A5C45;
    color: #fff;
}

/* Legacy container removed — replies live in .pqo-messages */
.pqo-quick-replies { display: none !important; }

/* Payment */
.pqo-stripe-wrap { padding: 0 14px 14px; flex-shrink: 0; }
.pqo-payment-box {
    background: #f0f7f4;
    border: 1px solid #b8d8cc;
    border-radius: 10px;
    padding: 14px;
    text-align: center;
}
.pqo-payment-box p { margin: 0 0 10px; font-size: 13px; color: #333; }
.pqo-pay-btn {
    display: inline-block;
    background: #2A5C45;
    color: #fff !important;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}
.pqo-pay-btn--large {
    display: block;
    width: 100%;
    max-width: 280px;
    padding: 14px 20px;
    font-size: 15px;
    margin-top: 4px;
}
.pqo-pay-hint {
    font-size: 12px !important;
    color: #888 !important;
}
.pqo-close-success--ghost {
    background: transparent;
    border: 0;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    margin-top: 4px;
}
.pqo-success--card .pqo-pay-btn:hover {
    background: #1e4433;
}

/* Success */
.pqo-success {
    padding: 28px 20px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    overflow-y: auto;
}
.pqo-success .pqo-success-icon { font-size: 48px; }
.pqo-success h3 { color: #2A5C45; margin: 0; font-size: 20px; }
.pqo-success p { color: #666; font-size: 14px; margin: 0; line-height: 1.6; max-width: 320px; }
.pqo-success .pqo-order-id {
    background: #f0f7f4;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 700;
    color: #2A5C45;
}
.pqo-success .pqo-order-total {
    font-size: 18px;
    font-weight: 700;
    color: #2A5C45;
}
.pqo-close-success {
    margin-top: 8px;
    background: #2A5C45;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 24px;
    cursor: pointer;
    font-size: 14px;
}

/* Tablet / desktop — same centered modal */
@media (min-width: 600px) {
    #pqo-overlay.pqo-overlay {
        padding: 24px;
    }
    #pqo-overlay .pqo-chat-window {
        max-width: 440px;
    }
}

/* Small phones */
@media (max-width: 380px) {
    #pqo-overlay.pqo-overlay {
        padding: 10px;
    }
    #pqo-overlay .pqo-chat-window {
        max-height: 92vh;
    }
}

/* Safe area (notch) */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .pqo-input-area {
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
    }
}
