/* PocketStrainerSupport chatbot widget styles.
 *
 * Loaded from chat.puggyman.com/widget.css. Scoped under
 * .ps-chat-* class names to avoid colliding with Shopify theme CSS.
 *
 * Color tokens are inline (not CSS vars) so the widget renders
 * correctly even if the host page has no styles loaded.
 */

.ps-chat-root,
.ps-chat-root * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
}

.ps-chat-root {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 2147483000;  /* very high; sits above most page chrome */
    color: #1a1a1a;
}

/* -------- Bubble -------- */

.ps-chat-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
}

.ps-chat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.ps-chat-bubble:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* -------- Panel -------- */

.ps-chat-panel {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.ps-chat-open .ps-chat-panel {
    display: flex;
}

/* -------- Header -------- */

.ps-chat-header {
    background: #1a1a1a;
    color: #ffffff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.ps-chat-title {
    font-weight: 600;
    flex: 1;
}

.ps-chat-escalate {
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.4);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.ps-chat-escalate:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ps-chat-close {
    background: transparent;
    color: #ffffff;
    border: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    padding: 0 4px;
}

.ps-chat-close:hover {
    color: #d0d0d0;
}

/* -------- Messages -------- */

.ps-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    background: #f7f7f7;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ps-chat-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ps-chat-msg-user {
    align-self: flex-end;
    background: #1a1a1a;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.ps-chat-msg-assistant {
    align-self: flex-start;
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.ps-chat-notice {
    align-self: stretch;
    text-align: center;
    color: #5a5a5a;
    font-size: 12px;
    padding: 6px 12px;
    background: #ececec;
    border-radius: 6px;
}

.ps-chat-notice-error {
    background: #fbe6e6;
    color: #8a1a1a;
}

/* Typing indicator: three pulsing dots */

.ps-chat-typing {
    display: flex;
    gap: 4px;
    padding: 12px 14px;
    min-width: 44px;
}

.ps-chat-typing span {
    width: 6px;
    height: 6px;
    background: #888888;
    border-radius: 50%;
    animation: ps-chat-blink 1.2s infinite ease-in-out both;
}

.ps-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.ps-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes ps-chat-blink {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.0); }
}

/* -------- Footer -------- */

.ps-chat-footer {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e0e0e0;
    background: #ffffff;
    flex-shrink: 0;
}

.ps-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #d0d0d0;
    border-radius: 8px;
    padding: 8px 10px;
    font-family: inherit;
    font-size: 14px;
    min-height: 36px;
    max-height: 120px;
}

.ps-chat-input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.ps-chat-send {
    background: #1a1a1a;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-weight: 600;
}

.ps-chat-send:hover:not(:disabled) {
    background: #333333;
}

.ps-chat-send:disabled {
    background: #888888;
    cursor: wait;
}

/* -------- Mobile -------- */

@media (max-width: 480px) {
    .ps-chat-root {
        bottom: 12px;
        right: 12px;
    }
    .ps-chat-panel {
        width: calc(100vw - 24px);
        height: calc(100vh - 80px);
        bottom: 68px;
        right: -8px;
    }
}
