/* Worcraft Chat widget — minimal styles, no theme dependencies. */

.wc-chat-bubble {
    /* All key positioning rules use !important to defeat Woodmart theme
       overrides that otherwise pull the bubble to bottom-left or unset
       position:fixed. z-index is huge so we stack above other floating
       widgets (Bitrix24, MailChimp popups, etc.). */
    position: fixed !important;
    bottom: 24px !important;
    right: 24px !important;
    left: auto !important;
    top: auto !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    background: #ba372a !important;
    color: white !important;
    border: 0 !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 24px !important;
    z-index: 2147483000 !important; /* essentially max int32 minus a buffer */
    transition: transform 0.15s ease;
    /* Defeat parent transform issues that would break position:fixed */
    will-change: transform;
    padding: 0 !important;
    margin: 0 !important;
}
.wc-chat-bubble:hover { transform: scale(1.05); }
.wc-chat-bubble.open { transform: rotate(180deg); }

.wc-chat-panel {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 9999;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: #222;
}
.wc-chat-panel.open { display: flex; }

.wc-chat-header {
    padding: 14px 16px;
    background: #ba372a;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}
.wc-chat-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.wc-chat-header .wc-chat-close {
    background: transparent;
    border: 0;
    color: white;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0 4px;
}

.wc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
}

.wc-msg {
    margin-bottom: 12px;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.45;
    word-wrap: break-word;
}
.wc-msg.assistant {
    background: white;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.wc-msg.user {
    background: #ba372a;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}
.wc-msg.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    font-size: 0.8rem;
}
.wc-msg a { color: inherit; text-decoration: underline; }
.wc-msg.assistant a { color: #ba372a; }
.wc-msg code {
    background: #f3f4f6;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.85em;
    font-family: ui-monospace, "SF Mono", monospace;
}
.wc-msg.user code { background: rgba(255,255,255,0.2); }
.wc-msg strong { font-weight: 600; }

.wc-typing { color: #9ca3af; font-style: italic; }

.wc-chat-input-row {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.wc-chat-input-row textarea {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    max-height: 100px;
    min-height: 38px;
    outline: none;
}
.wc-chat-input-row textarea:focus { border-color: #ba372a; }
.wc-chat-input-row button {
    background: #ba372a;
    color: white;
    border: 0;
    border-radius: 8px;
    padding: 0 14px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}
.wc-chat-input-row button:disabled { background: #9ca3af; cursor: not-allowed; }
.wc-chat-input-row button:hover:not(:disabled) { background: #962c21; }

/* Mobile: full-screen panel */
@media (max-width: 600px) {
    .wc-chat-panel {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }
    .wc-chat-bubble { bottom: 16px; right: 16px; }
}
