#heros-chat-widget { font-family: 'Noto Sans JP', sans-serif; }

/* FABボタン */
#heros-chat-fab {
    position: fixed; bottom: 24px; right: 24px; z-index: 99998;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--primary-red, #dc2626); color: #fff;
    border: none; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s, transform 0.2s;
}
#heros-chat-fab:hover { background: var(--accent-red, #ef4444); transform: scale(1.05); }
#heros-chat-fab svg { width: 28px; height: 28px; fill: #fff; }
#heros-chat-fab .hc-badge {
    position: absolute; top: -4px; right: -4px;
    background: #16a34a; color: #fff; font-size: 11px; font-weight: 700;
    min-width: 18px; height: 18px; border-radius: 9px;
    display: none; align-items: center; justify-content: center; padding: 0 4px;
}
#heros-chat-fab .hc-badge.active { display: flex; }

/* チャットパネル */
#heros-chat-panel {
    position: fixed; bottom: 92px; right: 24px; z-index: 99998;
    width: 370px; max-height: 520px; border-radius: 12px;
    background: #fff; box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    display: none; flex-direction: column; overflow: hidden;
}
#heros-chat-panel.open { display: flex; }

/* ヘッダー */
.hc-header {
    background: var(--background-dark, #0f172a); color: #fff;
    padding: 14px 16px; display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.hc-header h3 { margin: 0; font-size: 15px; font-weight: 600; }
.hc-header .hc-minimize {
    background: none; border: none; color: #94a3b8; cursor: pointer;
    font-size: 26px; line-height: 1; padding: 0 4px;
}
.hc-header .hc-minimize:hover { color: #fff; }

/* プリチャットフォーム */
.hc-prechat {
    padding: 20px 16px; display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto; max-height: 440px;
}
.hc-prechat p { margin: 0; font-size: 14px; color: #475569; }
.hc-prechat input[type="text"],
.hc-prechat input[type="tel"],
.hc-prechat input[type="email"] {
    padding: 9px 12px; border: 1px solid #d1d5db; border-radius: 8px;
    font-size: 13px; outline: none; width: 100%; box-sizing: border-box;
}
.hc-prechat input[type="text"]:focus,
.hc-prechat input[type="tel"]:focus,
.hc-prechat input[type="email"]:focus { border-color: var(--primary-red, #dc2626); }
.hc-service-type, .hc-location-field {
    display: flex; flex-direction: column; gap: 6px;
}
.hc-radio {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: #1e293b; cursor: pointer;
}
.hc-radio input[type="radio"] { margin: 0; accent-color: var(--primary-red, #dc2626); }
.hc-prechat button {
    padding: 10px; border: none; border-radius: 8px;
    background: var(--primary-red, #dc2626); color: #fff;
    font-size: 14px; font-weight: 600; cursor: pointer;
}
.hc-prechat button:hover { background: var(--accent-red, #ef4444); }

/* お客様情報バー */
.hc-my-info {
    padding: 6px 16px; font-size: 11px; color: #64748b;
    background: #f8fafc; border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* メッセージエリア */
.hc-messages {
    flex: 1; overflow-y: auto; padding: 12px 16px;
    display: flex; flex-direction: column; gap: 8px;
    min-height: 200px; max-height: 340px;
}
.hc-msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.5; word-break: break-word; }
.hc-msg.visitor { align-self: flex-end; background: var(--primary-red, #dc2626); color: #fff; border-bottom-right-radius: 4px; }
.hc-msg.admin { align-self: flex-start; background: #f1f5f9; color: #1e293b; border-bottom-left-radius: 4px; }
.hc-msg .hc-msg-name { font-size: 11px; font-weight: 600; margin-bottom: 2px; opacity: 0.7; }
.hc-msg .hc-msg-time { font-size: 10px; margin-top: 4px; opacity: 0.6; }
.hc-msg a { text-decoration: underline; word-break: break-all; }
.hc-msg.visitor a { color: #fff; }
.hc-msg.admin a { color: #2563eb; }
/* 既読表示 */
.hc-read-receipt { font-size: 10px; color: rgba(255,255,255,0.7); text-align: right; margin-top: 2px; }
.hc-msg.admin .hc-read-receipt { color: #94a3b8; }

.hc-system-msg { text-align: center; font-size: 12px; color: #94a3b8; padding: 8px; }
.hc-new-chat-btn {
    align-self: center; margin-top: 8px; padding: 8px 20px;
    background: var(--primary-red, #dc2626); color: #fff; border: none;
    border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.hc-new-chat-btn:hover { background: var(--accent-red, #ef4444); }

/* タイピングインジケーター */
.hc-typing-indicator {
    padding: 4px 16px 8px; font-size: 12px; color: #94a3b8;
    animation: hc-blink 1.5s infinite; flex-shrink: 0;
}
@keyframes hc-blink { 50% { opacity: 0.4; } }

/* FABラベル */
.hc-fab-label {
    position: absolute; right: 60px; top: 50%; transform: translateY(-50%);
    background: var(--primary-red, #dc2626); color: #fff;
    font-size: 12px; font-weight: 700; padding: 6px 12px;
    border-radius: 20px; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    animation: hc-pulse 2s infinite;
}
.hc-fab-label::after {
    content: ''; position: absolute; right: -6px; top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent; border-left-color: var(--primary-red, #dc2626);
    border-right: none;
}
@keyframes hc-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }

/* バージョン表示 */
.hc-version {
    text-align: right; font-size: 9px; color: #c0c0c0;
    padding: 2px 12px 4px; flex-shrink: 0;
}

/* 入力エリア */
.hc-input {
    border-top: 1px solid #e5e7eb; padding: 10px 12px;
    display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.hc-input textarea {
    flex: 1; border: 1px solid #d1d5db; border-radius: 8px;
    padding: 8px 12px; font-size: 14px; resize: none; outline: none;
    font-family: inherit; max-height: 80px;
}
.hc-input textarea:focus { border-color: var(--primary-red, #dc2626); }
.hc-input-buttons { display: flex; flex-direction: column; gap: 4px; }
.hc-input button#hc-send {
    background: var(--primary-red, #dc2626); color: #fff; border: none;
    border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 600;
    cursor: pointer; white-space: nowrap;
}
.hc-input button#hc-send:hover { background: var(--accent-red, #ef4444); }
.hc-end-btn {
    background: none; border: 1px solid #d1d5db; color: #64748b;
    border-radius: 8px; padding: 4px 12px; font-size: 11px;
    cursor: pointer; white-space: nowrap;
}
.hc-end-btn:hover { background: #f1f5f9; color: #dc2626; border-color: #dc2626; }

/* モバイル対応 */
@media (max-width: 480px) {
    #heros-chat-panel {
        position: fixed;
        top: 0; left: 0; right: 0;
        width: 100%; height: 100%;
        max-height: none;
        border-radius: 0;
        z-index: 99999;
        overflow: hidden;
    }
    #heros-chat-fab { bottom: 16px; right: 16px; }
    .hc-messages {
        max-height: none; flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
    }
    .hc-prechat {
        max-height: none; flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    .hc-header {
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top));
    }
    .hc-header .hc-minimize {
        font-size: 32px; padding: 4px 8px;
        min-width: 44px; min-height: 44px;
        display: flex; align-items: center; justify-content: center;
        color: #fff;
    }
    .hc-input {
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }
    .hc-input textarea {
        font-size: 16px; /* iOSのズーム防止 */
    }
    .hc-prechat input[type="text"],
    .hc-prechat input[type="tel"],
    .hc-prechat input[type="email"] {
        font-size: 16px; /* iOSのズーム防止 */
    }
    .hc-prechat select {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #heros-chat-fab { transition: none; }
}

/* システムメッセージ（自動応答・中央グレー表示） */
.hc-system-message {
    text-align: center;
    margin: 8px 16px;
    padding: 8px 14px;
    background: #f0f0f0;
    border-radius: 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
}
.hc-system-message a {
    color: #dc2626;
    text-decoration: underline;
    font-weight: 600;
}

@media print {
    #heros-chat-widget { display: none !important; }
}
