#oriigyn-chat-root, #oriigyn-chat-root * { box-sizing: border-box; }
#oriigyn-chat-root { position: relative; z-index: 2147483647; }

.oc-bubble {
    position: fixed !important;
    bottom: 20px;
    z-index: 2147483647 !important;
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: var(--oc-color, #1a1a1a);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s ease;
}
.oc-bubble:hover { transform: scale(1.06); }
.oc-bubble.oc-right { right: 20px; }
.oc-bubble.oc-left { left: 20px; }
.oc-bubble svg { width: 26px; height: 26px; fill: #fff; }
.oc-bubble .oc-badge {
    position: absolute; top: -2px; right: -2px;
    background: #e74c3c; color: #fff; font-size: 11px; font-weight: 700;
    width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

.oc-window {
    position: fixed !important;
    bottom: 90px;
    z-index: 2147483647 !important;
    width: 360px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.oc-window.oc-right { right: 20px; }
.oc-window.oc-left { left: 20px; }
.oc-window.oc-open { display: flex; }

.oc-header {
    background: var(--oc-color, #1a1a1a);
    color: #fff;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
}
.oc-header-title { font-weight: 700; font-size: 15px; }
.oc-header-sub { font-size: 11px; opacity: 0.75; margin-top: 2px; }
.oc-close-btn { cursor: pointer; opacity: 0.8; font-size: 20px; line-height: 1; background: none; border: none; color: #fff; position: relative; z-index: 3; }
.oc-close-btn:hover { opacity: 1; }

.oc-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f7f7f8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.oc-msg-row { display: flex; align-items: flex-end; gap: 6px; max-width: 88%; }
.oc-msg-row-visitor { align-self: flex-end; flex-direction: row-reverse; margin-left: auto; }
.oc-msg-row-ai, .oc-msg-row-admin { align-self: flex-start; }
.oc-msg-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.oc-msg-avatar-default { display: flex; align-items: center; justify-content: center; background: #eee; font-size: 13px; }

.oc-msg { max-width: 100%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.oc-msg-visitor { background: var(--oc-color, #1a1a1a); color: #fff; border-bottom-right-radius: 4px; }
.oc-msg-ai, .oc-msg-admin { background: #fff; color: #222; border: 1px solid #eee; border-bottom-left-radius: 4px; }
.oc-msg-admin { border-left: 3px solid var(--oc-color, #1a1a1a); }
.oc-msg-typing { align-self: flex-start; font-size: 12px; color: #999; font-style: italic; background: none; border: none; padding: 0 13px; }
.oc-msg-system {
    align-self: center; font-size: 11.5px; color: #888; background: #eee; padding: 5px 12px;
    border-radius: 20px; text-align: center; max-width: 90%;
}

.oc-product-prompt {
    align-self: flex-start; background: #fff8ec; border: 1px solid #f3d9a4; border-radius: 12px;
    padding: 10px 12px; font-size: 12.5px; max-width: 88%; line-height: 1.4;
}
.oc-product-prompt-btn {
    display: block; margin-top: 8px; padding: 7px 12px; border-radius: 8px; border: none;
    background: var(--oc-color, #1a1a1a); color: #fff; font-size: 12px; cursor: pointer;
}

.oc-human-btn-row { padding: 0 14px 10px; flex-shrink: 0; display: none; display: flex; flex-direction: column; gap: 6px; }
.oc-human-btn {
    width: 100%; padding: 8px; border-radius: 8px; border: 1px solid #ddd; background: #fff;
    font-size: 12.5px; cursor: pointer; color: #444;
}
.oc-human-btn:hover { background: #f1f1f1; }
.oc-human-btn-secondary { border-color: #ddd; }
.oc-searching { font-size: 12px; color: #888; text-align: center; padding: 6px; font-style: italic; }

.oc-custom-buttons { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; flex-shrink: 0; }
.oc-custom-btn {
    padding: 7px 12px; border-radius: 20px; border: 1px solid #ddd; background: #fff;
    font-size: 12px; cursor: pointer; color: #444;
}
.oc-custom-btn:hover { background: #f1f1f1; }

.oc-product-card {
    align-self: flex-start; display: flex; gap: 10px; background: #fff; border: 1px solid #eee;
    border-radius: 12px; padding: 10px; max-width: 85%; box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.oc-product-card img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.oc-product-info { min-width: 0; }
.oc-product-title { font-size: 12.5px; font-weight: 700; color: #1a1a1a; }
.oc-product-price { font-size: 12px; color: #555; margin: 2px 0; }
.oc-product-link { font-size: 12px; font-weight: 600; color: var(--oc-color, #1a1a1a); text-decoration: none; }
.oc-product-link:hover { text-decoration: underline; }

.oc-email-form { padding: 12px 14px; border-top: 1px solid #eee; flex-shrink: 0; background: #fff; }
.oc-email-form input, .oc-email-form textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #ddd; border-radius: 8px; font-size: 13px; margin-bottom: 8px;
}
.oc-email-form button {
    width: 100%; padding: 9px; border-radius: 8px; border: none; background: var(--oc-color, #1a1a1a); color: #fff; font-weight: 600; cursor: pointer;
}

.oc-input-row { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #eee; flex-shrink: 0; background: #fff; align-items: flex-end; }
.oc-attach-btn {
    background: none; border: 1px solid #ddd; border-radius: 10px; width: 36px; height: 36px; flex-shrink: 0;
    cursor: pointer; font-size: 15px; display: flex; align-items: center; justify-content: center;
}
.oc-attach-btn:hover { background: #f1f1f1; }
.oc-input-row textarea {
    flex-grow: 1; resize: none; border: 1px solid #ddd; border-radius: 10px; padding: 9px 12px; font-size: 13.5px; max-height: 70px;
    font-family: inherit;
}
.oc-send-btn {
    background: var(--oc-color, #1a1a1a); color: #fff; border: none; border-radius: 10px; width: 40px; height: 36px; flex-shrink: 0; cursor: pointer;
}
.oc-send-btn:disabled { opacity: 0.5; cursor: default; }

.oc-msg-image { padding: 4px; background: transparent; border: none; }
.oc-msg-image-thumb { max-width: 180px; max-height: 180px; border-radius: 10px; display: block; object-fit: cover; }
.oc-msg-image-caption { font-size: 12px; color: #555; margin-top: 4px; padding: 0 4px; }
.oc-msg-row a { color: inherit; }
.oc-msg a { color: inherit; text-decoration: underline; }

@media (max-width: 480px) {
    .oc-window {
        width: 100vw; max-width: 100vw;
        top: 0 !important; bottom: 0 !important; height: auto !important; max-height: none !important;
        right: 0 !important; left: 0 !important;
        border-radius: 0;
    }
    .oc-header { padding-top: max(16px, env(safe-area-inset-top)); flex-shrink: 0; }
    .oc-bubble { bottom: 16px; }
}
