/* MYZ AI Chatbot Widget */

#myz-chatbot-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

/* トグルボタン - #159BBE 角丸デザイン */
#myz-chatbot-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #159BBE;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 14px 24px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(21, 155, 190, 0.35);
    transition: all 0.3s ease;
    white-space: nowrap;
}

#myz-chatbot-toggle:hover {
    background: #1289a8;
    box-shadow: 0 6px 24px rgba(21, 155, 190, 0.5);
    transform: translateY(-2px);
}

#myz-chatbot-toggle svg {
    flex-shrink: 0;
}

/* チャットウィンドウ */
#myz-chatbot-window {
    position: absolute;
    bottom: 70px;
    left: 0;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
    transform-origin: bottom left;
}

#myz-chatbot-window.myz-hidden {
    display: none;
}

/* ヘッダー */
#myz-chatbot-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #159BBE;
    color: #fff;
    padding: 16px 20px;
    flex-shrink: 0;
}

.myz-header-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.myz-header-icon {
    font-size: 20px;
}

.myz-header-title {
    font-size: 16px;
    font-weight: 600;
}

#myz-chatbot-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s;
}

#myz-chatbot-close:hover {
    opacity: 1;
}

/* メッセージエリア */
#myz-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 300px;
    max-height: 380px;
}

.myz-message {
    display: flex;
    max-width: 85%;
}

.myz-message.myz-bot {
    align-self: flex-start;
}

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

.myz-message-content {
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
}

.myz-bot .myz-message-content {
    background: #f0f4f8;
    color: #333;
    border-bottom-left-radius: 4px;
}

.myz-user .myz-message-content {
    background: #159BBE;
    color: #fff;
    border-bottom-right-radius: 4px;
}

/* ローディング */
.myz-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
}

.myz-typing-dot {
    width: 8px;
    height: 8px;
    background: #a0aec0;
    border-radius: 50%;
    animation: myzTyping 1.2s infinite ease-in-out;
}

.myz-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.myz-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes myzTyping {
    0%, 60%, 100% { transform: scale(0.6); opacity: 0.4; }
    30% { transform: scale(1); opacity: 1; }
}

/* 入力エリア */
#myz-chatbot-input-area {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-top: 1px solid #e8ecf0;
    gap: 8px;
    flex-shrink: 0;
}

#myz-chatbot-input {
    flex: 1;
    border: 1px solid #dde2e8;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    font-family: inherit;
}

#myz-chatbot-input:focus {
    border-color: #159BBE;
}

#myz-chatbot-input::placeholder {
    color: #a0aec0;
}

#myz-chatbot-send {
    background: #159BBE;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

#myz-chatbot-send:hover {
    background: #1289a8;
}

#myz-chatbot-send:disabled {
    background: #a0aec0;
    cursor: not-allowed;
}

/* スクロールバー */
#myz-chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

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

#myz-chatbot-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 2px;
}

/* メッセージ内のHTML要素 */
.myz-bot .myz-message-content strong {
    font-weight: 700;
    color: #1a1a1a;
}

.myz-bot .myz-message-content .myz-heading {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #159BBE;
    margin: 8px 0 4px 0;
}

.myz-bot .myz-message-content .myz-heading:first-child {
    margin-top: 0;
}

.myz-bot .myz-message-content ul.myz-list,
.myz-bot .myz-message-content ol.myz-list {
    margin: 6px 0;
    padding-left: 20px;
}

.myz-bot .myz-message-content .myz-list li {
    margin: 3px 0;
    font-size: 13px;
    line-height: 1.5;
}

.myz-bot .myz-message-content table.myz-table {
    width: 100%;
    border-collapse: collapse;
    margin: 8px 0;
    font-size: 12px;
}

.myz-bot .myz-message-content .myz-table th,
.myz-bot .myz-message-content .myz-table td {
    border: 1px solid #dde2e8;
    padding: 4px 8px;
    text-align: left;
}

.myz-bot .myz-message-content .myz-table th {
    background: #e8f4f8;
    font-weight: 600;
    color: #159BBE;
}

.myz-bot .myz-message-content br + br {
    display: block;
    content: '';
    margin: 4px 0;
}

/* モバイル対応 */
@media (max-width: 480px) {
    #myz-chatbot-container {
        bottom: 16px;
        left: 16px;
        right: auto;
    }

    #myz-chatbot-toggle {
        padding: 10px 18px;
        font-size: 13px;
    }

    #myz-chatbot-window {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 80vh;
        border-radius: 16px 16px 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
    }

    #myz-chatbot-messages {
        min-height: 200px;
        max-height: calc(80vh - 130px);
    }

    #myz-chatbot-input-area {
        padding: 10px 12px;
        padding-bottom: max(10px, env(safe-area-inset-bottom));
    }

    #myz-chatbot-input {
        font-size: 16px; /* iOS zoom防止 */
    }
}
