/**
 * WP AI Chatbot - フロントエンドスタイル
 */

/* ============================================
   変数定義
============================================ */
:root {
    --raplsaich-primary: #007bff;
    --raplsaich-primary-dark: #0056b3;
    --raplsaich-bg: #ffffff;
    --raplsaich-text: #333333;
    --raplsaich-text-light: #666666;
    --raplsaich-border: #e0e0e0;
    --raplsaich-user-bg: var(--raplsaich-primary);
    --raplsaich-user-text: #ffffff;
    --raplsaich-bot-bg: #f1f1f1;
    --raplsaich-bot-text: #333333;
    --raplsaich-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
    --raplsaich-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.25), 0 4px 12px rgba(0, 0, 0, 0.15);
    --raplsaich-shadow-message: 0 2px 8px rgba(0, 0, 0, 0.08);
    --raplsaich-radius: 16px;
    --raplsaich-badge-size: 60px;
    --raplsaich-window-width: 380px;
    --raplsaich-window-height: 520px;
}

/* ============================================
   コンテナ
============================================ */
.wp-ai-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-sizing: border-box;
}

.wp-ai-chatbot *,
.wp-ai-chatbot *::before,
.wp-ai-chatbot *::after {
    box-sizing: border-box;
}

/* ============================================
   バッジ（閉じた状態）
============================================ */
.chatbot-badge {
    width: var(--raplsaich-badge-size);
    height: var(--raplsaich-badge-size);
    border-radius: 50%;
    background: var(--raplsaich-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--raplsaich-shadow);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    padding: 0;
}

.chatbot-badge:hover {
    transform: scale(1.1) translateY(-2px);
    background: var(--raplsaich-primary-dark);
    box-shadow: var(--raplsaich-shadow-hover);
}

.chatbot-badge:focus {
    outline: 2px solid transparent;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.3), var(--raplsaich-shadow);
}

.chatbot-badge .badge-icon {
    width: 28px;
    height: 28px;
    color: #ffffff;
}

.chatbot-badge .badge-icon-image {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-badge .badge-icon-emoji {
    font-size: 28px;
    line-height: 1;
}

/* 通知ドット */
.chatbot-badge .badge-notification {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid #ffffff;
}

/* 開いている時はバッジを非表示 */
.wp-ai-chatbot[data-state="open"] .chatbot-badge {
    display: none;
}

/* ============================================
   チャットウィンドウ
============================================ */
.chatbot-window {
    display: none;
    flex-direction: column;
    width: var(--raplsaich-window-width);
    height: var(--raplsaich-window-height);
    min-width: 300px;
    min-height: 400px;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--raplsaich-bg);
    border-radius: var(--raplsaich-radius);
    box-shadow: var(--raplsaich-shadow);
    overflow: hidden;
    animation: raplsaich-slideUp 0.3s ease;
    position: relative;
}

/* リサイズハンドル（左上） */
.chatbot-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    z-index: 10;
    background: transparent;
}

.chatbot-resize-handle::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    width: 10px;
    height: 10px;
    border-top: 3px solid rgba(255, 255, 255, 0.8);
    border-left: 3px solid rgba(255, 255, 255, 0.8);
    border-radius: 2px;
    transition: all 0.2s;
}

.chatbot-resize-handle:hover::before {
    border-color: #ffffff;
    transform: scale(1.1);
}

/* リサイズ中のスタイル */
.chatbot-window.resizing {
    transition: none;
    user-select: none;
}

.wp-ai-chatbot[data-state="open"] .chatbot-window {
    display: flex;
}

@keyframes raplsaich-slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes raplsaich-slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   バッジ位置バリエーション
============================================ */
/* 上配置: ウィンドウは下方向に開く */
.wp-ai-chatbot[data-position="top-right"] .chatbot-window,
.wp-ai-chatbot[data-position="top-left"] .chatbot-window {
    animation: raplsaich-slideDown 0.3s ease;
}

/* 上配置: リサイズハンドルを左下に移動 */
.wp-ai-chatbot[data-position="top-right"] .chatbot-resize-handle {
    top: auto;
    bottom: 0;
    cursor: nesw-resize;
}
.wp-ai-chatbot[data-position="top-left"] .chatbot-resize-handle {
    top: auto;
    bottom: 0;
    left: auto;
    right: 0;
    cursor: nwse-resize;
}
/* bottom-left: handle on right side */
.wp-ai-chatbot[data-position="bottom-left"] .chatbot-resize-handle {
    left: auto;
    right: 0;
    cursor: nesw-resize;
}

.wp-ai-chatbot[data-position="top-right"] .chatbot-resize-handle::before {
    top: auto;
    bottom: 6px;
    border-top: none;
    border-bottom: 3px solid rgba(255, 255, 255, 0.8);
}
.wp-ai-chatbot[data-position="top-left"] .chatbot-resize-handle::before,
.wp-ai-chatbot[data-position="bottom-left"] .chatbot-resize-handle::before {
    left: auto;
    right: 6px;
    border-left: none;
    border-right: 3px solid rgba(255, 255, 255, 0.8);
}
.wp-ai-chatbot[data-position="top-left"] .chatbot-resize-handle::before {
    top: auto;
    bottom: 6px;
    border-top: none;
    border-bottom: 3px solid rgba(255, 255, 255, 0.8);
}

/* 左配置: 通知ドットを左側に */
.wp-ai-chatbot[data-position="bottom-left"] .badge-notification,
.wp-ai-chatbot[data-position="top-left"] .badge-notification {
    right: auto;
    left: -2px;
}

/* ============================================
   ヘッダー
============================================ */
.chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--raplsaich-primary);
    color: #ffffff;
    flex-shrink: 0;
}

.chatbot-header .header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-header .bot-avatar {
    font-size: 28px;
    line-height: 1;
}

.chatbot-header .bot-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-header .header-text {
    display: flex;
    flex-direction: column;
}

.chatbot-header .bot-name {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
}

.chatbot-header .bot-status {
    font-size: 12px;
    opacity: 0.85;
}

.chatbot-close {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-close:focus {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: -2px;
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-close svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   メッセージエリア
============================================ */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #fafafa;
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chatbot-message {
    max-width: 85%;
    animation: raplsaich-fadeIn 0.3s ease;
}

@keyframes raplsaich-fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message--bot {
    align-self: flex-start;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chatbot-message--user {
    align-self: flex-end;
}

.chatbot-message__avatar {
    flex-shrink: 0;
    font-size: 20px;
    line-height: 1;
}

.chatbot-message__avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

.chatbot-message__content {
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
    box-shadow: var(--raplsaich-shadow-message);
}

.chatbot-message--bot .chatbot-message__content {
    background: var(--raplsaich-bot-bg);
    color: var(--raplsaich-bot-text);
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.chatbot-message--user .chatbot-message__content {
    background: var(--raplsaich-user-bg);
    color: var(--raplsaich-user-text);
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.3);
}

/* 参照元リンク */
.chatbot-message__sources {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--raplsaich-border);
    font-size: 12px;
}

.chatbot-message__sources-title {
    color: var(--raplsaich-text-light);
    margin-bottom: 4px;
}

.chatbot-message__sources a {
    display: block;
    color: var(--raplsaich-primary);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-message__sources a:hover {
    text-decoration: underline;
}

/* カルーセル共通 (Shared carousel for product cards & content cards) */
/* 商品カード (WooCommerce Product Cards) */
.chatbot-product-cards {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--raplsaich-border);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.chatbot-product-cards::-webkit-scrollbar {
    display: none;
}

.chatbot-product-card {
    display: flex;
    flex-direction: column;
    min-width: 160px;
    max-width: 180px;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px;
    border: 1px solid var(--raplsaich-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.chatbot-product-card:hover {
    background-color: rgba(0, 0, 0, 0.03);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.chatbot-product-card__image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 6px;
}

.chatbot-product-card__info {
    min-width: 0;
}

.chatbot-product-card__name {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chatbot-product-card__price {
    font-weight: 700;
    font-size: 13px;
    color: var(--raplsaich-primary);
    margin-top: 2px;
}

.chatbot-product-card__out-of-stock {
    display: inline-block;
    font-size: 11px;
    color: #b32d2e;
    margin-top: 2px;
}

/* コンテンツカード (Generic content/link cards from RAG) */
.chatbot-content-cards {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    padding: 8px 0 4px;
    border-top: 1px solid var(--raplsaich-border);
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.chatbot-content-cards::-webkit-scrollbar {
    display: none;
}

.chatbot-content-card {
    display: flex;
    flex-direction: column;
    min-width: 180px;
    max-width: 220px;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 10px;
    border: 1px solid var(--raplsaich-border);
    border-radius: 8px;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.15s, box-shadow 0.15s;
}

.chatbot-content-card:hover {
    background-color: rgba(0, 0, 0, 0.03);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    text-decoration: none;
}

.chatbot-content-card__type {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--raplsaich-primary, #4a90d9);
    margin-bottom: 4px;
    font-weight: 600;
}

.chatbot-content-card__title {
    font-weight: 600;
    font-size: 13px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.chatbot-content-card__excerpt {
    font-size: 11px;
    color: #666;
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.4;
}

/* アクションボタン (Intent Recognition Actions) */
.chatbot-action-buttons {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chatbot-action-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    background: var(--raplsaich-primary, #4a90d9);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    transition: opacity 0.2s;
    cursor: pointer;
    border: none;
    line-height: 1.4;
}

.chatbot-action-btn:hover {
    opacity: 0.85;
    color: #fff;
}

.chatbot-action-notice {
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 4px;
}

/* シナリオ進捗バー (Conversation Scenario Progress) */
.chatbot-scenario-progress {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.03);
    border-radius: 8px;
}

.chatbot-scenario-progress__label {
    font-size: 11px;
    color: #888;
    margin-bottom: 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-scenario-progress__bar {
    height: 4px;
    background: var(--raplsaich-border, #e0e0e0);
    border-radius: 2px;
    overflow: hidden;
}

.chatbot-scenario-progress__fill {
    height: 100%;
    background: var(--raplsaich-primary, #4a90d9);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.chatbot-scenario-options {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.chatbot-scenario-option-btn {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 16px;
    background: #f8f9fa;
    border: 1px solid var(--raplsaich-border, #e0e0e0);
    color: #333;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.3;
}

.chatbot-scenario-option-btn:hover {
    background: var(--raplsaich-primary, #4a90d9);
    color: #fff;
    border-color: var(--raplsaich-primary, #4a90d9);
}

.chatbot-scenario-complete {
    font-size: 12px;
    color: #4caf50;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* フルスクリーンモード (Pro) */
.chatbot-window--fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    max-height: none !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
}

/* ウェルカムスクリーン (Pro) */
.chatbot-welcome-screen {
    padding: 24px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 1;
    overflow-y: auto;
}

.chatbot-welcome-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--raplsaich-text, #333);
}

.chatbot-welcome-message {
    font-size: 14px;
    color: var(--raplsaich-text-light, #666);
    line-height: 1.5;
}

.chatbot-welcome-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

.chatbot-welcome-btn {
    background: #f8f9fa;
    border: 1px solid var(--raplsaich-border, #e0e0e0);
    border-radius: 16px;
    padding: 8px 16px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-welcome-btn:hover {
    background: var(--raplsaich-primary, #4a90d9);
    color: #fff;
    border-color: var(--raplsaich-primary, #4a90d9);
}

/* ============================================
   メッセージアクション（フィードバック・再生成）
============================================ */
.chatbot-message__actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--raplsaich-border);
}

.chatbot-message__actions:empty {
    display: none;
}

.chatbot-message__feedback {
    display: flex;
    gap: 4px;
}

.chatbot-feedback-btn {
    background: none;
    border: 1px solid var(--raplsaich-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.chatbot-feedback-btn:hover {
    opacity: 1;
    background: var(--raplsaich-bg);
}

.chatbot-feedback-btn--selected {
    opacity: 1;
    border-color: var(--raplsaich-primary);
    background: rgba(0, 123, 255, 0.1);
}

.chatbot-feedback-btn--up.chatbot-feedback-btn--selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.1);
}

.chatbot-feedback-btn--down.chatbot-feedback-btn--selected {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.chatbot-regenerate-btn {
    background: none;
    border: 1px solid var(--raplsaich-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s ease;
}

.chatbot-regenerate-btn:hover {
    opacity: 1;
    background: var(--raplsaich-bg);
    border-color: var(--raplsaich-primary);
}

.chatbot-message--regenerating {
    opacity: 0.6;
    pointer-events: none;
}

.chatbot-message--regenerating .chatbot-message__content {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   タイピングインジケーター
============================================ */
.chatbot-typing {
    display: flex !important;
    align-items: flex-end !important;
    gap: 5px !important;
    padding: 8px 16px;
    margin: 4px 16px;
}

.chatbot-typing[hidden] {
    display: none !important;
}

.chatbot-typing span {
    display: block !important;
    width: 8px !important;
    height: 8px !important;
    border-radius: 50% !important;
    background: #999 !important;
    animation: raplsaich-wave 0.8s ease-in-out infinite !important;
}

.chatbot-typing span:nth-child(1) {
    animation-delay: 0s !important;
}

.chatbot-typing span:nth-child(2) {
    animation-delay: 0.15s !important;
}

.chatbot-typing span:nth-child(3) {
    animation-delay: 0.3s !important;
}

@keyframes raplsaich-wave {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    50% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* ============================================
   入力エリア
============================================ */
.chatbot-footer-branding {
    padding: 4px 16px;
    text-align: center;
    font-size: 11px;
    color: var(--raplsaich-text-light, #999);
    background: var(--raplsaich-bg, #fff);
    flex-shrink: 0;
    border-top: 1px solid var(--raplsaich-border, #e0e0e0);
}

.chatbot-footer-branding a {
    color: var(--raplsaich-text-light, #999);
    text-decoration: none;
}

.chatbot-footer-branding a:hover {
    text-decoration: none;
}

.chatbot-footer-powered {
    padding: 3px 16px;
    text-align: center;
    font-size: 10px;
    color: #bbb;
    background: var(--raplsaich-bg, #fff);
    flex-shrink: 0;
    line-height: 1.4;
}

.chatbot-footer-powered a {
    color: #bbb;
    text-decoration: none;
}

.chatbot-footer-powered a:hover {
    color: #bbb;
    text-decoration: none;
}

.chatbot-input {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--raplsaich-border);
    background: var(--raplsaich-bg);
    flex-shrink: 0;
    position: relative;
}

.chatbot-input textarea {
    flex: 1;
    border: 1px solid var(--raplsaich-border);
    border-radius: 24px;
    padding: 12px 18px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    outline: 2px solid transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.chatbot-input textarea:focus {
    border-color: var(--raplsaich-primary);
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.15), 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.chatbot-input textarea::placeholder {
    color: #999;
}

.chatbot-input button[type="submit"] {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--raplsaich-primary);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
    flex-shrink: 0;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.chatbot-input button[type="submit"]:hover {
    background: var(--raplsaich-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.4);
}

.chatbot-input button[type="submit"]:active {
    transform: scale(0.95);
}

.chatbot-input button[type="submit"]:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.chatbot-input button[type="submit"] svg {
    width: 20px;
    height: 20px;
    color: #ffffff;
}

/* ============================================
   画像アップロード（Pro: マルチモーダル）
============================================ */
.chatbot-image-btn[hidden],
.chatbot-mic-btn[hidden],
.chatbot-screenshot-btn[hidden] {
    display: none !important;
}

.chatbot-image-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.chatbot-image-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.chatbot-image-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.chatbot-screenshot-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
    flex-shrink: 0;
    padding: 0;
}

.chatbot-screenshot-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.chatbot-screenshot-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.chatbot-screenshot-btn.capturing {
    background: #fff3cd;
    animation: pulse-capture 1s infinite;
}

@keyframes pulse-capture {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-image-preview {
    position: relative;
    padding: 8px 16px;
    border-top: 1px solid var(--raplsaich-border);
    background: #f8f9fa;
}

.chatbot-image-preview img {
    max-width: 120px;
    max-height: 80px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--raplsaich-border);
}

.image-preview-remove {
    position: absolute;
    top: 4px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.image-preview-remove:hover {
    background: rgba(0, 0, 0, 0.8);
}

.image-preview-remove svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

/* ============================================
   音声入力 / TTS (Voice Input / Text-to-Speech)
============================================ */
.chatbot-mic-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}

.chatbot-mic-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.chatbot-mic-btn svg {
    width: 20px;
    height: 20px;
    color: #666;
}

.chatbot-mic-btn.recording {
    background: #fee2e2;
    animation: raplsaich-mic-pulse 1.2s ease-in-out infinite;
}

.chatbot-mic-btn.recording svg {
    color: #dc2626;
}

@keyframes raplsaich-mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3); }
    50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.chatbot-tts-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s, opacity 0.2s;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.6;
}

.chatbot-tts-toggle:not([hidden]) {
    display: flex;
}

.chatbot-tts-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
    opacity: 1;
}

.chatbot-tts-toggle.active {
    opacity: 1;
}

.chatbot-tts-toggle svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   モバイル対応
============================================ */
@media (max-width: 768px) {
    .chatbot-window {
        min-width: 280px;
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .wp-ai-chatbot {
        bottom: 0;
        right: 0;
    }

    .wp-ai-chatbot[data-state="closed"] {
        bottom: 20px;
        right: 20px;
    }

    .wp-ai-chatbot[data-state="open"] {
        left: 0 !important;
        top: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    .wp-ai-chatbot[data-state="open"] .chatbot-window {
        width: 100% !important;
        height: 100% !important;
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        animation: none;
    }

    /* モバイルではリサイズ無効 */
    .chatbot-resize-handle {
        display: none;
    }
}

/* ============================================
   アクセシビリティ
============================================ */
@media (prefers-reduced-motion: reduce) {
    .chatbot-badge,
    .chatbot-window,
    .chatbot-message {
        animation: none;
        transition: none;
    }

    .chatbot-typing span {
        animation: none;
        opacity: 0.6;
    }

    .chatbot-typing span:nth-child(1) { opacity: 1; }
    .chatbot-typing span:nth-child(2) { opacity: 0.7; }
    .chatbot-typing span:nth-child(3) { opacity: 0.4; }

    .chatbot-sentiment,
    .chatbot-handoff-dot,
    .chatbot-mic-btn.recording,
    .chatbot-screenshot-btn.capturing {
        animation: none;
    }
}

/* ハイコントラストモード */
@media (prefers-contrast: high) {
    .chatbot-message--bot .chatbot-message__content {
        border: 1px solid #333;
    }

    .chatbot-message--user .chatbot-message__content {
        border: 1px solid #fff;
    }
}

/* ============================================
   関連ナレッジリンク (Pro)
============================================ */
.chatbot-related-knowledge {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.chatbot-related-knowledge__title {
    font-size: 11px;
    color: #999;
    margin-bottom: 6px;
}

.chatbot-related-knowledge__item {
    display: inline-block;
    background: none;
    border: 1px solid var(--raplsaich-border, #e0e0e0);
    border-radius: 14px;
    padding: 4px 12px;
    font-size: 12px;
    color: var(--raplsaich-primary, #007bff);
    cursor: pointer;
    transition: all 0.2s;
    margin: 0 4px 4px 0;
    line-height: 1.4;
    font-family: inherit;
}

.chatbot-related-knowledge__item:hover {
    background: var(--raplsaich-primary, #007bff);
    color: #fff;
    border-color: var(--raplsaich-primary, #007bff);
}

/* ============================================
   関連質問候補 (Pro)
============================================ */
.chatbot-suggestions {
    padding: 12px 16px;
    margin: 8px 0;
}

.chatbot-suggestions__title {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.chatbot-suggestions__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chatbot-suggestion-btn {
    background: #f8f9fa;
    border: 1px solid var(--raplsaich-border);
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    line-height: 1.3;
}

.chatbot-suggestion-btn:hover {
    background: var(--raplsaich-primary);
    color: #fff;
    border-color: var(--raplsaich-primary);
}

/* ============================================
   入力補完 (Pro)
============================================ */
.chatbot-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 60px;
    background: #fff;
    border: 1px solid var(--raplsaich-border);
    border-radius: 8px;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 10;
    margin-bottom: 8px;
}

.chatbot-autocomplete__item {
    padding: 10px 14px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.chatbot-autocomplete__item:last-child {
    border-bottom: none;
}

.chatbot-autocomplete__item:hover {
    background: #f8f9fa;
}

/* ============================================
   感情インジケーター (Pro)
============================================ */
.chatbot-sentiment {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    flex-shrink: 0;
    cursor: help;
    vertical-align: middle;
    animation: sentimentPulse 2s ease-in-out infinite;
}

@keyframes sentimentPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.7; }
}

.chatbot-sentiment--frustrated {
    background: #ff4444;
    box-shadow: 0 0 6px rgba(255, 68, 68, 0.6);
}

.chatbot-sentiment--confused {
    background: #ffbb33;
    box-shadow: 0 0 6px rgba(255, 187, 51, 0.6);
}

.chatbot-sentiment--urgent {
    background: #ff8800;
    box-shadow: 0 0 6px rgba(255, 136, 0, 0.6);
}

.chatbot-sentiment--positive {
    background: #00C851;
    box-shadow: 0 0 6px rgba(0, 200, 81, 0.6);
}

.chatbot-sentiment--negative {
    background: #666666;
    box-shadow: 0 0 6px rgba(102, 102, 102, 0.6);
}

/* ============================================
   テーマスタイル
============================================ */

/* ----------------------------------------
   Simple テーマ (Free)
---------------------------------------- */
.raplsaich-chatbot.theme-simple .chatbot-window {
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.raplsaich-chatbot.theme-simple .chatbot-header {
    background: #f8f9fa;
    color: #333;
    border-bottom: 1px solid #e9ecef;
}

.raplsaich-chatbot.theme-simple .bot-name {
    color: #333;
}

.raplsaich-chatbot.theme-simple .chatbot-close {
    color: #666;
}

.raplsaich-chatbot.theme-simple .chatbot-close:hover {
    color: #333;
    background: rgba(0, 0, 0, 0.05);
}

.raplsaich-chatbot.theme-simple .chatbot-input {
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
}

.raplsaich-chatbot.theme-simple .chatbot-input button[type="submit"] {
    background: #6c757d;
}

.raplsaich-chatbot.theme-simple .chatbot-input button[type="submit"]:hover {
    background: #5a6268;
}

.raplsaich-chatbot.theme-simple .chatbot-badge {
    background: #6c757d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ----------------------------------------
   Classic テーマ (Free)
---------------------------------------- */
.raplsaich-chatbot.theme-classic .chatbot-window {
    border-radius: 0;
    border: 2px solid #2c3e50;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.1);
}

.raplsaich-chatbot.theme-classic .chatbot-header {
    background: #2c3e50;
    border-radius: 0;
}

.raplsaich-chatbot.theme-classic .chatbot-message--bot .chatbot-message__content {
    background: #ecf0f1;
    border-radius: 0;
    border-left: 3px solid #2c3e50;
}

.raplsaich-chatbot.theme-classic .chatbot-message--user .chatbot-message__content {
    background: #2c3e50;
    border-radius: 0;
}

.raplsaich-chatbot.theme-classic .chatbot-input {
    border-radius: 0;
}

.raplsaich-chatbot.theme-classic .chatbot-input button[type="submit"] {
    background: #2c3e50;
    border-radius: 0;
}

.raplsaich-chatbot.theme-classic .chatbot-badge {
    background: #2c3e50;
    border-radius: 4px;
}

/* Pro themes (Modern, Gradient, Dark, Glass, Rounded, Ocean, Sunset, Forest, Neon, Elegant)
   are available in Rapls AI Chatbot Pro plugin */

/* ----------------------------------------
   Light テーマ (Free)
---------------------------------------- */
.raplsaich-chatbot.theme-light .chatbot-window {
    background: #fff;
    border: 1px solid #e8e8e8;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.raplsaich-chatbot.theme-light .chatbot-header {
    background: #fff;
    color: #333;
    border-bottom: 1px solid #e8e8e8;
}

.raplsaich-chatbot.theme-light .bot-name {
    color: #333;
}

.raplsaich-chatbot.theme-light .chatbot-close {
    color: #999;
}

.raplsaich-chatbot.theme-light .chatbot-messages {
    background: #fafafa;
}

.raplsaich-chatbot.theme-light .chatbot-message--bot .chatbot-message__content {
    background: #fff;
    border: 1px solid #e8e8e8;
}

.raplsaich-chatbot.theme-light .chatbot-message--user .chatbot-message__content {
    background: #5c9eff;
}

.raplsaich-chatbot.theme-light .chatbot-input {
    background: #fff;
    border-top: 1px solid #e8e8e8;
}

.raplsaich-chatbot.theme-light .chatbot-input button[type="submit"] {
    background: #5c9eff;
}

.raplsaich-chatbot.theme-light .chatbot-badge {
    background: #5c9eff;
}

/* ----------------------------------------
   Minimal テーマ (Free)
---------------------------------------- */
.raplsaich-chatbot.theme-minimal .chatbot-window {
    border-radius: 0;
    border: 1px solid #ddd;
    box-shadow: none;
}

.raplsaich-chatbot.theme-minimal .chatbot-header {
    background: #333;
    border-radius: 0;
    padding: 12px 16px;
}

.raplsaich-chatbot.theme-minimal .chatbot-message--bot .chatbot-message__content {
    background: #f5f5f5;
    border-radius: 4px;
    border: none;
}

.raplsaich-chatbot.theme-minimal .chatbot-message--user .chatbot-message__content {
    background: #333;
    border-radius: 4px;
}

.raplsaich-chatbot.theme-minimal .chatbot-input {
    border-radius: 0;
    border: 1px solid #ddd;
}

.raplsaich-chatbot.theme-minimal .chatbot-input button[type="submit"] {
    background: #333;
    border-radius: 0;
}

.raplsaich-chatbot.theme-minimal .chatbot-badge {
    background: #333;
    border-radius: 4px;
}

/* ----------------------------------------
   Flat テーマ (Free)
---------------------------------------- */
.raplsaich-chatbot.theme-flat .chatbot-window {
    border-radius: 0;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1);
}

.raplsaich-chatbot.theme-flat .chatbot-header {
    background: #3498db;
    border-radius: 0;
}

.raplsaich-chatbot.theme-flat .chatbot-message--bot .chatbot-message__content {
    background: #ecf0f1;
    border-radius: 0;
}

.raplsaich-chatbot.theme-flat .chatbot-message--user .chatbot-message__content {
    background: #3498db;
    border-radius: 0;
}

.raplsaich-chatbot.theme-flat .chatbot-input {
    border-radius: 0;
}

.raplsaich-chatbot.theme-flat .chatbot-input button[type="submit"] {
    background: #3498db;
    border-radius: 0;
}

.raplsaich-chatbot.theme-flat .chatbot-badge {
    background: #3498db;
    border-radius: 0;
}

/* Dark mode is available in Rapls AI Chatbot Pro plugin */

/* ============================================
   リード獲得フォーム
============================================ */
.chatbot-lead-form {
    position: absolute;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--raplsaich-bg);
    padding: 20px;
    overflow-y: auto;
    z-index: 10;
}

.lead-form-content {
    max-width: 100%;
}

.lead-form-title {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 600;
    color: var(--raplsaich-text);
}

.lead-form-description {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--raplsaich-text-light);
}

.lead-field {
    margin-bottom: 16px;
}

.lead-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--raplsaich-text);
}

.lead-field label .required {
    color: #dc3545;
    margin-left: 2px;
}

.lead-field input,
.lead-field textarea,
.lead-field select {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid var(--raplsaich-border);
    border-radius: 8px;
    background: var(--raplsaich-bg);
    color: var(--raplsaich-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.lead-field textarea {
    resize: vertical;
    min-height: 60px;
}

.lead-field input:focus,
.lead-field textarea:focus,
.lead-field select:focus {
    outline: 2px solid transparent;
    border-color: var(--raplsaich-primary);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.lead-field input.error,
.lead-field textarea.error,
.lead-field select.error {
    border-color: #dc3545;
}

.lead-form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.lead-submit-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    background: var(--raplsaich-primary);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.lead-submit-btn:hover {
    background: var(--raplsaich-primary-dark);
}

.lead-submit-btn:active {
    transform: scale(0.98);
}

.lead-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.lead-skip-btn {
    padding: 12px 20px;
    font-size: 14px;
    color: var(--raplsaich-text-light);
    background: transparent;
    border: 1px solid var(--raplsaich-border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.lead-skip-btn:hover {
    background: #f5f5f5;
}

.lead-form-error {
    margin-top: 12px;
    padding: 10px;
    font-size: 13px;
    color: #dc3545;
    background: #fff5f5;
    border-radius: 6px;
}

/* ダークモード対応 */
.raplsaich-chatbot.dark-mode .chatbot-lead-form {
    background: #1a1a1a;
}

.raplsaich-chatbot.dark-mode .lead-form-title {
    color: #fff;
}

.raplsaich-chatbot.dark-mode .lead-form-description {
    color: #aaa;
}

.raplsaich-chatbot.dark-mode .lead-field label {
    color: #e0e0e0;
}

.raplsaich-chatbot.dark-mode .lead-field input,
.raplsaich-chatbot.dark-mode .lead-field textarea,
.raplsaich-chatbot.dark-mode .lead-field select {
    background: #2d2d2d;
    border-color: #444;
    color: #fff;
}

.raplsaich-chatbot.dark-mode .lead-field input:focus,
.raplsaich-chatbot.dark-mode .lead-field textarea:focus,
.raplsaich-chatbot.dark-mode .lead-field select:focus {
    border-color: var(--raplsaich-primary);
}

.raplsaich-chatbot.dark-mode .lead-skip-btn {
    color: #aaa;
    border-color: #444;
}

.raplsaich-chatbot.dark-mode .lead-skip-btn:hover {
    background: #2d2d2d;
}

.raplsaich-chatbot.dark-mode .lead-form-error {
    background: #3d2020;
    color: #ff8080;
}

/* Offline Message Form */
.raplsaich-offline-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: center;
}

.raplsaich-offline-header {
    text-align: center;
    margin-bottom: 16px;
}

.raplsaich-offline-header h3 {
    margin: 0 0 8px;
    font-size: 18px;
    font-weight: 700;
    color: #333;
}

.raplsaich-offline-header p {
    margin: 0;
    font-size: 13px;
    color: #666;
}

.raplsaich-offline-field {
    margin-bottom: 10px;
}

.raplsaich-offline-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.raplsaich-offline-input:focus {
    outline: 2px solid transparent;
    border-color: var(--raplsaich-bot-bg, #667eea);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

textarea.raplsaich-offline-input {
    resize: vertical;
    min-height: 80px;
}

.raplsaich-offline-submit {
    width: 100%;
    padding: 12px;
    background: var(--raplsaich-primary, #007bff);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.raplsaich-offline-submit:hover {
    background: var(--raplsaich-primary-dark, #0056b3);
}

.raplsaich-offline-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.raplsaich-offline-status {
    text-align: center;
    margin-top: 10px;
    font-size: 13px;
}

.raplsaich-offline-success {
    color: #22c55e;
}

.raplsaich-offline-error {
    color: #dc2626;
}

/* Markdown rendering in bot messages */
.raplsaich-markdown {
    white-space: normal;
    word-wrap: break-word;
}

.raplsaich-markdown p {
    margin: 0 0 0.6em 0;
}

.raplsaich-markdown p:last-child {
    margin-bottom: 0;
}

.raplsaich-markdown strong {
    font-weight: 700;
}

.raplsaich-markdown em {
    font-style: italic;
}

.raplsaich-markdown code {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    padding: 0.15em 0.35em;
    font-family: Menlo, Consolas, "Courier New", monospace;
    font-size: 0.9em;
}

.raplsaich-markdown pre {
    background: rgba(0, 0, 0, 0.06);
    border-radius: 6px;
    padding: 0.8em 1em;
    overflow-x: auto;
    margin: 0.6em 0;
}

.raplsaich-markdown pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
}

.raplsaich-markdown h2,
.raplsaich-markdown h3,
.raplsaich-markdown h4 {
    margin: 0.8em 0 0.4em 0;
    font-weight: 700;
    line-height: 1.3;
}

.raplsaich-markdown h2 {
    font-size: 1.2em;
}

.raplsaich-markdown h3 {
    font-size: 1.1em;
}

.raplsaich-markdown h4 {
    font-size: 1em;
}

.raplsaich-markdown h2:first-child,
.raplsaich-markdown h3:first-child,
.raplsaich-markdown h4:first-child {
    margin-top: 0;
}

.raplsaich-markdown ul,
.raplsaich-markdown ol {
    margin: 0.4em 0;
    padding-left: 1.5em;
}

.raplsaich-markdown li {
    margin-bottom: 0.2em;
}

.raplsaich-markdown blockquote {
    border-left: 3px solid rgba(0, 0, 0, 0.2);
    background: rgba(0, 0, 0, 0.03);
    margin: 0.6em 0;
    padding: 0.4em 0.8em;
    border-radius: 0 4px 4px 0;
}

.raplsaich-markdown blockquote p {
    margin: 0;
}

.raplsaich-markdown table {
    border-collapse: collapse;
    width: 100%;
    margin: 0.6em 0;
    font-size: 0.9em;
    overflow-x: auto;
    display: block;
}

.raplsaich-markdown thead {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.raplsaich-markdown tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.raplsaich-markdown th,
.raplsaich-markdown td {
    border: 1px solid rgba(0, 0, 0, 0.12);
    padding: 0.4em 0.6em;
    text-align: left;
}

.raplsaich-markdown th {
    background: rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.raplsaich-markdown tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.02);
}

/* ============================================
   インラインモード（ショートコード埋め込み）
============================================ */
.raplsaich-inline {
    position: relative;
    width: 100%;
}

.raplsaich-inline .wp-ai-chatbot {
    position: relative;
    bottom: auto;
    right: auto;
    z-index: auto;
    width: 100%;
    height: 100%;
}

.raplsaich-inline .chatbot-badge {
    display: none;
}

.raplsaich-inline .chatbot-window {
    display: flex !important;
    position: relative;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.raplsaich-inline .chatbot-close {
    display: none;
}
.raplsaich-inline.raplsaich-embed .chatbot-close {
    display: flex;
}

.raplsaich-inline .chatbot-resize-handle {
    display: none;
}

/* ============================================
   ハンドオフ（ライブエージェント引き継ぎ）
============================================ */

/* システムメッセージ（ハンドオフ通知等） */
.chatbot-message--system {
    text-align: center;
    padding: 8px 16px;
    margin: 12px 0;
    align-self: center;
    max-width: 100%;
}

.chatbot-message--system .chatbot-message__content {
    display: inline-block;
    background: #f0f0f1;
    color: #666;
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 12px;
    max-width: none;
    border: none;
    box-shadow: none;
}

/* オペレーターメッセージ */
.chatbot-message--operator {
    align-self: flex-start;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.chatbot-message--operator .chatbot-message__content {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.chatbot-message__avatar--operator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4caf50;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
}

/* ハンドオフステータスインジケーター */
.chatbot-handoff-indicator {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    transition: all 0.3s ease;
}

.chatbot-handoff-indicator--pending {
    background: #fff3e0;
    color: #e65100;
}

.chatbot-handoff-indicator--active {
    background: #e8f5e9;
    color: #2e7d32;
}

.chatbot-handoff-text {
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-handoff-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e65100;
    animation: chatbot-handoff-pulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.chatbot-handoff-dot--active {
    background: #2e7d32;
}

@keyframes chatbot-handoff-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.chatbot-handoff-cancel {
    background: none;
    border: 1px solid currentColor;
    color: inherit;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    opacity: 0.8;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.chatbot-handoff-cancel:hover {
    opacity: 1;
    background: rgba(0,0,0,0.05);
}

/* ============================================
   Quick Replies
============================================ */
.chatbot-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
}

.chatbot-quick-reply-btn {
    background: var(--raplsaich-bg, #fff);
    border: 1px solid var(--raplsaich-primary, #007bff);
    color: var(--raplsaich-primary, #007bff);
    border-radius: 16px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1.3;
}

.chatbot-quick-reply-btn:hover {
    background: var(--raplsaich-primary, #007bff);
    color: #fff;
}

/* ============================================
   Bookmark Button
============================================ */
.chatbot-bookmark-btn {
    background: none;
    border: 1px solid var(--raplsaich-border);
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    color: inherit;
}

.chatbot-bookmark-btn:hover {
    opacity: 1;
    background: var(--raplsaich-bg);
    border-color: var(--raplsaich-primary);
}

.chatbot-bookmark-btn.raplsaich-bookmarked {
    opacity: 1;
    border-color: var(--raplsaich-primary);
    background: rgba(0, 123, 255, 0.1);
}

.chatbot-bookmark-btn.raplsaich-bookmarked svg {
    fill: var(--raplsaich-primary);
}

/* ============================================
   Bookmark Navigation
============================================ */
.chatbot-bookmark-nav-toggle {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-bookmark-nav-toggle:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-bookmark-nav-toggle svg {
    width: 18px;
    height: 18px;
}

.chatbot-bookmark-bar {
    padding: 6px 10px;
    background: rgba(0, 123, 255, 0.06);
    border-bottom: 1px solid var(--raplsaich-border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-bookmark-bar[hidden] {
    display: none;
}

.chatbot-bookmark-bar-label {
    font-size: 12px;
    color: var(--raplsaich-primary, #007bff);
    font-weight: 600;
    margin-right: auto;
}

.chatbot-message.chatbot-bookmark-current {
    background: rgba(0, 123, 255, 0.08);
    box-shadow: inset 3px 0 0 var(--raplsaich-primary, #007bff);
}

/* ============================================
   Chat Search
============================================ */
.chatbot-search-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-search-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-search-btn svg {
    width: 18px;
    height: 18px;
}

.chatbot-search-bar {
    padding: 6px 10px;
    background: var(--raplsaich-bg, #f5f5f5);
    border-bottom: 1px solid var(--raplsaich-border);
    display: flex;
    align-items: center;
    gap: 6px;
}

.chatbot-search-bar[hidden] {
    display: none;
}

.chatbot-search-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--raplsaich-border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
    color: var(--raplsaich-text, #333);
    outline: 2px solid transparent;
    box-sizing: border-box;
}

.chatbot-search-input:focus {
    border-color: var(--raplsaich-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

.chatbot-search-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.chatbot-search-count {
    font-size: 11px;
    color: var(--raplsaich-text, #666);
    min-width: 32px;
    text-align: center;
    white-space: nowrap;
}

.chatbot-search-nav-btn {
    background: none;
    border: 1px solid var(--raplsaich-border, #ddd);
    border-radius: 4px;
    cursor: pointer;
    padding: 2px 6px;
    font-size: 10px;
    line-height: 1;
    color: var(--raplsaich-text, #666);
    transition: background 0.15s, border-color 0.15s;
}

.chatbot-search-nav-btn:hover {
    background: rgba(0, 123, 255, 0.1);
    border-color: var(--raplsaich-primary);
    color: var(--raplsaich-primary);
}

.chatbot-message.chatbot-search-highlight {
    background: rgba(255, 235, 59, 0.15);
}

.chatbot-message.chatbot-search-current {
    background: rgba(255, 235, 59, 0.35);
    box-shadow: inset 3px 0 0 var(--raplsaich-primary, #007bff);
}

/* ============================================
   Conversation Sharing
============================================ */
.chatbot-share-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-share-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-share-btn svg {
    width: 18px;
    height: 18px;
}

.chatbot-share-btn--copied {
    background: rgba(40, 167, 69, 0.3);
}

.chatbot-share-btn--copied:hover {
    background: rgba(40, 167, 69, 0.4);
}
