/* ============================================================
   AI記帳 体験デモウィジェット (2026-09-20)
   実際の ai-accounting.html のチャット UI (chat-bubble / journal-preview)
   の配色・角丸・シャドウをそのまま再現した「なりすまし」デモ。
   本物の API は一切呼ばない — 純粋な CSS/JS アニメーションのみ。
   Hero (コンパクト) と #demo (フル) の両方で共用。
   ============================================================ */

.ai-demo-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-demo-card--full {
    max-width: 560px;
    margin: 0 auto;
    background: #ffffff;
    border-radius: 20px;
    padding: 20px 20px 24px;
    box-shadow: 0 20px 45px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.ai-demo-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    margin-bottom: 4px;
}

.ai-demo-header-icon {
    font-size: 20px;
    line-height: 1;
}

.ai-demo-header-title {
    font-weight: 700;
    color: #1f2937;
    font-size: 15px;
}

.ai-demo-header-live {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #16a34a;
    font-weight: 600;
}

.ai-demo-header-live::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
    animation: ai-demo-pulse 1.6s ease-in-out infinite;
}

.ai-demo-body {
    background: linear-gradient(180deg, rgba(238, 242, 255, 0.5) 0%, rgba(250, 245, 255, 0.5) 100%);
    border-radius: 16px;
    padding: 14px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-demo-card--full .ai-demo-body {
    min-height: 300px;
}

.ai-demo-thread {
    display: flex;
    flex-direction: column;
    transition: opacity 0.35s ease;
}

.ai-demo-thread.ai-demo-fading {
    opacity: 0;
}

.ai-demo-bubble {
    max-width: 88%;
    padding: 12px 16px;
    border-radius: 20px;
    margin: 6px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 13.5px;
    line-height: 1.55;
    animation: ai-demo-rise 0.32s ease both;
    word-break: break-word;
}

.ai-demo-bubble--ai {
    background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
    color: #1f2937;
    border: 1px solid #c7d2fe;
    align-self: flex-start;
}

.ai-demo-bubble--user {
    background: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
    color: #ffffff;
    align-self: flex-end;
}

.ai-demo-cursor {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: currentColor;
    margin-left: 2px;
    vertical-align: -2px;
    animation: ai-demo-blink 0.9s step-end infinite;
}

.ai-demo-loading {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 14px 18px;
}

.ai-demo-dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #818cf8;
    animation: ai-demo-bounce 1s ease-in-out infinite;
}

.ai-demo-dot:nth-child(2) { animation-delay: 0.15s; }
.ai-demo-dot:nth-child(3) { animation-delay: 0.3s; }

.ai-demo-result {
    max-width: 96%;
    padding: 14px 16px 16px;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.ai-demo-result.ai-demo-visible {
    opacity: 1;
    transform: translateY(0);
}

.ai-demo-result-intro {
    margin: 0 0 10px;
    font-size: 13px;
    color: #374151;
}

.ai-demo-journal {
    background: linear-gradient(135deg, #eef2ff 0%, #e0f2fe 100%);
    border: 2px solid #6366f1;
    border-radius: 14px;
    padding: 14px;
}

.ai-demo-journal-title {
    font-weight: 700;
    font-size: 13px;
    color: #1f2937;
    margin-bottom: 10px;
}

.ai-demo-journal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.ai-demo-journal-label {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #6b7280;
    margin-bottom: 3px;
}

.ai-demo-journal-box {
    border-radius: 8px;
    padding: 7px 10px;
    border: 1px solid transparent;
}

.ai-demo-journal-box--debit {
    background: #eff6ff;
    border-color: #bfdbfe;
}

.ai-demo-journal-box--credit {
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.ai-demo-journal-account {
    font-weight: 600;
    font-size: 12.5px;
}

.ai-demo-journal-box--debit .ai-demo-journal-account { color: #1e3a8a; }
.ai-demo-journal-box--credit .ai-demo-journal-account { color: #14532d; }

.ai-demo-journal-amount {
    font-size: 12px;
    margin-top: 1px;
}

.ai-demo-journal-box--debit .ai-demo-journal-amount { color: #1d4ed8; }
.ai-demo-journal-box--credit .ai-demo-journal-amount { color: #15803d; }

.ai-demo-journal-meta {
    font-size: 11.5px;
    color: #4b5563;
    margin-bottom: 6px;
}

.ai-demo-confidence {
    font-weight: 700;
    color: #4338ca;
}

.ai-demo-journal-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.ai-demo-btn {
    font-size: 11.5px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ai-demo-btn--confirm { background: #16a34a; }
.ai-demo-btn--edit { background: #e5e7eb; color: #374151; }

.ai-demo-quickpills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.ai-demo-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid transparent;
    white-space: nowrap;
}

.ai-demo-pill--1 { background: linear-gradient(90deg, #e0e7ff, #ede9fe); color: #6b21a8; border-color: #e9d5ff; }
.ai-demo-pill--2 { background: linear-gradient(90deg, #d1fae5, #ccfbf1); color: #065f46; border-color: #a7f3d0; }
.ai-demo-pill--3 { background: linear-gradient(90deg, #ede9fe, #e0e7ff); color: #6b21a8; border-color: #e9d5ff; }
.ai-demo-pill--4 { background: linear-gradient(90deg, #fef9c3, #ffedd5); color: #92400e; border-color: #fde68a; }

.ai-demo-inputbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    padding: 8px 8px 8px 16px;
}

.ai-demo-inputbar-text {
    flex: 1;
    font-size: 12px;
    color: #9ca3af;
}

.ai-demo-inputbar-send {
    background: linear-gradient(135deg, #ec4899, #a855f7);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 999px;
    white-space: nowrap;
}

@keyframes ai-demo-rise {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes ai-demo-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes ai-demo-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
    40% { transform: translateY(-4px); opacity: 1; }
}

@keyframes ai-demo-pulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25); }
    50% { box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.12); }
}

@media (prefers-reduced-motion: reduce) {
    .ai-demo-bubble,
    .ai-demo-cursor,
    .ai-demo-dot,
    .ai-demo-header-live::before {
        animation: none !important;
    }
}
