/* ========== LiteWord AI Chat — ページ埋め込み型 ========== */

/* ========== ヒーローセクション ========== */

#lwmp-chat-section {
    margin: 0 0 40px;
}
.lwmp-chat-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}
.lwmp-hero-avatar {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    animation: lwmp-float 3s ease-in-out infinite;
}
@keyframes lwmp-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.lwmp-chat-hero-text {
    max-width: 400px;
}
.lwmp-hero-greeting {
    font-size: 1.1em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px;
}
.lwmp-hero-sub {
    font-size: 0.82em;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

/* ========== インラインチャット ========== */

#lwmp-chat-inline {
    background: #fff;
    border: 1px solid #e0e7ff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.08);
}

/* メッセージエリア */
#lwmp-chat-messages {
    max-height: 360px;
    overflow-y: auto;
    padding: 16px 20px;
    display: none;
    flex-direction: column;
    gap: 12px;
    background: #f8fafc;
    scrollbar-width: thin;
    scrollbar-color: #e2e8f0 transparent;
    -ms-overflow-style: auto;
}
#lwmp-chat-messages::-webkit-scrollbar {
    display: block;
    width: 4px;
}
#lwmp-chat-messages::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}
#lwmp-chat-messages.has-messages {
    display: flex;
}

/* メッセージ行 */
.lwmp-msg-row {
    display: flex;
    gap: 8px;
    align-items: flex-start;
}
.lwmp-msg-row-user {
    justify-content: flex-end;
}

/* アバター */
.lwmp-msg-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e7ff;
    padding: 2px;
    flex-shrink: 0;
}
.lwmp-avatar-thinking {
    animation: lwmp-wobble 0.5s ease-in-out infinite alternate;
}
@keyframes lwmp-wobble {
    0% { transform: rotate(-5deg); }
    100% { transform: rotate(5deg); }
}

/* バブル */
.lwmp-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88em;
    line-height: 1.65;
    word-break: break-word;
}
.lwmp-msg a {
    color: #6366f1;
    text-decoration: underline;
}
.lwmp-msg-user {
    background: #6366f1;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.lwmp-msg-ai {
    background: #fff;
    color: #334155;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

/* ローディング */
.lwmp-msg-loading { padding: 12px 20px; }
.lwmp-dots span {
    animation: lwmp-blink 1.4s infinite;
    font-size: 1.4em;
    line-height: 1;
}
.lwmp-dots span:nth-child(2) { animation-delay: 0.2s; }
.lwmp-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lwmp-blink {
    0%, 80%, 100% { opacity: 0.2; }
    40% { opacity: 1; }
}

/* ========== 同意バナー ========== */

#lwmp-chat-consent {
    padding: 14px 20px;
    text-align: center;
    background: #fafbfd;
    border-top: 1px solid #e0e7ff;
}
#lwmp-chat-consent p {
    font-size: 0.75em;
    color: #94a3b8;
    margin: 0 0 10px;
    line-height: 1.5;
}
#lwmp-chat-consent a {
    color: #6366f1;
    text-decoration: underline;
}
#lwmp-consent-agree {
    padding: 8px 28px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 0.88em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    animation: lwmp-nudge 6s ease-in-out infinite;
}
#lwmp-consent-agree:hover {
    background: #4f46e5;
    animation: none;
}
@keyframes lwmp-nudge {
    0%, 85%, 100% { transform: rotate(0); }
    87% { transform: rotate(-3deg); }
    89% { transform: rotate(3deg); }
    91% { transform: rotate(-2deg); }
    93% { transform: rotate(2deg); }
    95% { transform: rotate(0); }
}

/* ========== 入力エリア ========== */

#lwmp-chat-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: #fff;
    border-top: 1px solid #e0e7ff;
}
#lwmp-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e7ff;
    border-radius: 12px;
    font-size: 0.92em;
    color: #334155;
    background: #f8fafc;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, background 0.15s;
}
#lwmp-chat-input:focus {
    border-color: #6366f1;
    background: #fff;
}
#lwmp-chat-input::placeholder {
    color: #94a3b8;
}

/* 音声ボタン */
#lwmp-chat-voice {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.15s;
    flex-shrink: 0;
}
#lwmp-chat-voice:hover {
    background: #e2e8f0;
    color: #334155;
}
#lwmp-chat-voice.recording {
    background: #ef4444;
    color: #fff;
    animation: lwmp-pulse 1.5s infinite;
}
@keyframes lwmp-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

/* 送信ボタン */
#lwmp-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #6366f1;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: background 0.15s;
    flex-shrink: 0;
}
#lwmp-chat-send:hover {
    background: #4f46e5;
}

/* ========== プライバシーポップアップ ========== */

#lwmp-privacy-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(99, 102, 241, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: lwmp-fade-in 0.25s ease;
}
@keyframes lwmp-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.lwmp-privacy-content {
    background: #fff;
    border-radius: 24px;
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.15);
    border: 1px solid #e0e7ff;
    animation: lwmp-pop-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    scrollbar-width: thin;
    -ms-overflow-style: auto;
}
@keyframes lwmp-pop-in {
    from { transform: scale(0.9) translateY(20px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}
.lwmp-privacy-content::-webkit-scrollbar {
    display: block;
    width: 4px;
}
.lwmp-privacy-content::-webkit-scrollbar-thumb {
    background: #c7d2fe;
    border-radius: 2px;
}
.lwmp-privacy-content h3 {
    font-size: 1.05em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 20px;
    text-align: center;
}
.lwmp-privacy-body h4 {
    font-size: 0.88em;
    font-weight: 650;
    color: #6366f1;
    margin: 20px 0 6px;
    padding-left: 10px;
    border-left: 3px solid #c7d2fe;
}
.lwmp-privacy-body p {
    font-size: 0.84em;
    color: #475569;
    line-height: 1.7;
    margin: 0 0 8px;
}
.lwmp-privacy-body ul {
    list-style: none;
    padding-left: 8px;
    margin: 0 0 12px;
}
.lwmp-privacy-body li {
    font-size: 0.84em;
    color: #475569;
    line-height: 1.7;
    margin: 4px 0;
    padding-left: 16px;
    position: relative;
}
.lwmp-privacy-body li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #6366f1;
    font-size: 0.85em;
}
#lwmp-privacy-close {
    width: 100%;
    margin-top: 24px;
    padding: 12px;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.92em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
#lwmp-privacy-close:hover {
    opacity: 0.9;
}
#lwmp-privacy-cancel {
    width: 100%;
    margin-top: 8px;
    padding: 10px;
    background: none;
    color: #94a3b8;
    border: none;
    border-radius: 10px;
    font-size: 0.82em;
    cursor: pointer;
    transition: color 0.15s;
}
#lwmp-privacy-cancel:hover {
    color: #64748b;
}

/* ========== アプリ内ブラウザ誘導オーバーレイ ========== */

#lwmp-inapp-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 75, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: lwmp-fade-in 0.3s ease;
}
.lwmp-inapp-card {
    background: #fff;
    border-radius: 24px;
    max-width: 380px;
    width: 100%;
    padding: 32px 28px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.25);
    border: 1px solid #e0e7ff;
    animation: lwmp-pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.lwmp-inapp-avatar {
    width: 72px;
    height: 72px;
    margin-bottom: 12px;
    animation: lwmp-float 3s ease-in-out infinite;
}
.lwmp-inapp-title {
    font-size: 1.15em;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 10px;
}
.lwmp-inapp-desc {
    font-size: 0.84em;
    color: #475569;
    line-height: 1.7;
    margin: 0 0 20px;
}
.lwmp-inapp-desc strong {
    color: #6366f1;
}
.lwmp-inapp-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.lwmp-inapp-btn-primary:hover {
    opacity: 0.9;
}
.lwmp-inapp-hint {
    font-size: 0.82em;
    color: #94a3b8;
    margin: 8px 0;
    min-height: 1.4em;
    transition: color 0.2s;
}
.lwmp-inapp-btn-secondary {
    width: 100%;
    padding: 12px 20px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.9em;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 4px;
    transition: background 0.15s;
}
.lwmp-inapp-btn-secondary:hover {
    background: #e2e8f0;
}
.lwmp-inapp-btn-skip {
    width: 100%;
    padding: 10px;
    background: none;
    color: #94a3b8;
    border: none;
    font-size: 0.78em;
    cursor: pointer;
    margin-top: 4px;
    transition: color 0.15s;
}
.lwmp-inapp-btn-skip:hover {
    color: #64748b;
}

/* ========== スマホ対応 ========== */

@media (max-width: 600px) {
    .lwmp-chat-hero {
        flex-direction: column;
        text-align: center;
    }
    .lwmp-hero-avatar {
        width: 64px;
        height: 64px;
    }
    #lwmp-chat-input {
        font-size: 16px; /* iOSズーム防止 */
    }
}
