/* ==========================================================
   HPChat 共通スタイル
   オカベ HP のトンマナに合わせて 白・濃紺・グレー基調
   ========================================================== */

:root {
    --hpchat-primary:    #1a3a6e;   /* 濃紺 */
    --hpchat-primary-d:  #122a52;   /* 濃紺 暗 */
    --hpchat-accent:     #2563eb;   /* リンク・アクセント青 */
    --hpchat-bg:         #f5f7fa;   /* 背景うすグレー */
    --hpchat-border:     #d6dde6;
    --hpchat-text:       #1f2937;
    --hpchat-text-mute:  #6b7280;
    --hpchat-success:    #166534;
    --hpchat-danger:     #b91c1c;
}

html, body {
    height: 100%;
    margin: 0;
    background: var(--hpchat-bg);
    color: var(--hpchat-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "Hiragino Kaku Gothic ProN", "ヒラギノ角ゴ ProN W3",
                 Meiryo, sans-serif;
}

/* ヘッダー */
.hpchat-header {
    background: var(--hpchat-primary);
    color: #fff;
    padding: 0.75rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.hpchat-brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.05em;
}
.hpchat-subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
}

/* メイン */
.hpchat-main {
    min-height: calc(100vh - 56px - 40px);
    padding: 1.5rem 1rem;
}

/* フッター */
.hpchat-footer {
    background: #fff;
    border-top: 1px solid var(--hpchat-border);
    padding: 0.75rem;
    color: var(--hpchat-text-mute);
}

/* カード */
.hpchat-card {
    background: #fff;
    border: 1px solid var(--hpchat-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* ボタン（プライマリ） */
.btn-hpchat-primary {
    background: var(--hpchat-primary);
    color: #fff;
    border: none;
}
.btn-hpchat-primary:hover {
    background: var(--hpchat-primary-d);
    color: #fff;
}

/* ステータスバッジ */
.badge-status-active    { background: #fef3c7; color: #92400e; }
.badge-status-completed { background: #dcfce7; color: #166534; }
.badge-status-blocked   { background: #fee2e2; color: #991b1b; }

/* 接続確認ステータス（Phase A 用） */
.diag-ok    { color: var(--hpchat-success); font-weight: bold; }
.diag-ng    { color: var(--hpchat-danger);  font-weight: bold; }

/* ==========================================================
   Phase B：開始フォーム
   ========================================================== */
.hpchat-required {
    color: var(--hpchat-danger);
    margin-left: 0.25em;
}
.hpchat-business-hours {
    background: #f0f4f9;
    border-left: 3px solid var(--hpchat-primary);
    padding: 0.75rem 1rem;
    border-radius: 4px;
}

/* ハニーポット（人間に見えない・ボット検出用） */
.hpchat-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    opacity: 0 !important;
}

/* ==========================================================
   Phase B：チャット画面
   ========================================================== */
.hpchat-chat-container {
    max-width: 800px;
    margin: 0 auto;
}
.hpchat-chat-card {
    background: #fff;
    border: 1px solid var(--hpchat-border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px - 40px - 3rem);
    min-height: 500px;
}
.hpchat-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--hpchat-border);
    background: #fafbfd;
    border-radius: 8px 8px 0 0;
}
.hpchat-chat-company {
    font-weight: 600;
    color: var(--hpchat-primary);
}
.hpchat-chat-meta {
    font-size: 0.85rem;
    color: var(--hpchat-text-mute);
}
.hpchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: var(--hpchat-bg);
}
.hpchat-msg {
    margin-bottom: 0.75rem;
    display: flex;
}
.hpchat-msg-customer  { justify-content: flex-end; }
.hpchat-msg-staff     { justify-content: flex-start; }
.hpchat-msg-system    { justify-content: center; }

.hpchat-msg-bubble {
    max-width: 75%;
    width: fit-content;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    overflow-wrap: anywhere;
}
.hpchat-msg-customer .hpchat-msg-bubble {
    background: var(--hpchat-primary);
    color: #fff;
}
.hpchat-msg-staff .hpchat-msg-bubble {
    background: #fff;
    color: var(--hpchat-text);
    border: 1px solid var(--hpchat-border);
}
.hpchat-msg-system .hpchat-msg-text {
    font-size: 0.85rem;
    color: var(--hpchat-text-mute);
    background: #eef1f5;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
}
.hpchat-msg-name {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-bottom: 0.15rem;
}
.hpchat-msg-time {
    font-size: 0.7rem;
    opacity: 0.75;
    margin-top: 0.15rem;
    text-align: right;
}
.hpchat-input-area {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--hpchat-border);
    background: #fafbfd;
    border-radius: 0 0 8px 8px;
}
.hpchat-input-area textarea {
    resize: none;
    flex: 1;
}
.hpchat-input-area button {
    align-self: stretch;
    min-width: 80px;
}

/* スマホ調整 */
@media (max-width: 576px) {
    .hpchat-chat-card {
        height: calc(100vh - 56px - 40px - 2rem);
    }
    .hpchat-msg-bubble {
        max-width: 85%;
    }
}
