/* ============================================================
   アリスAIチャット ウィジェット
   ============================================================ */

/* フローティングボタン */
.aris-chat-button-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99998;
}

.aris-chat-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #109585;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
    transition: transform 0.2s, box-shadow 0.2s;
    line-height: 1.3;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.aris-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.aris-chat-button img {
    width: 40px;
    height: auto;
    max-height: 48px;
    object-fit: contain;
}

/* チャットウィンドウ */
.aris-chat-window {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 24px);
    height: 520px;
    max-height: calc(100vh - 120px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.2);
    z-index: 99999;
    flex-direction: column;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
}

.aris-chat-window.open {
    display: flex;
}

/* ヘッダー */
.aris-chat-header {
    background: #109585;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.aris-chat-header img {
    width: 32px;
    height: auto;
    max-height: 40px;
    object-fit: contain;
}

.aris-chat-header-text {
    flex: 1;
}

.aris-chat-header-title {
    font-size: 14px;
    font-weight: bold;
    line-height: 1.3;
}

.aris-chat-header-sub {
    font-size: 11px;
    opacity: 0.85;
}

.aris-chat-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    opacity: 0.8;
}

.aris-chat-close:hover {
    opacity: 1;
}

/* メッセージエリア */
.aris-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f7f8fa;
}

.aris-chat-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.6;
    word-break: break-word;
    white-space: pre-wrap;
}

.aris-chat-msg.user {
    align-self: flex-end;
    background: #109585;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.aris-chat-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.aris-chat-msg a {
    color: inherit;
    text-decoration: underline;
}

.aris-chat-msg.user a {
    color: #fff;
}

/* 入力中インジケーター */
.aris-chat-typing {
    align-self: flex-start;
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
}

.aris-chat-typing span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: arisTyping 1.4s infinite;
}

.aris-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.aris-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes arisTyping {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
    30% { opacity: 1; transform: scale(1); }
}

/* ウェルカムメッセージ */
.aris-chat-welcome {
    text-align: center;
    padding: 20px 16px 8px;
}

.aris-chat-welcome img {
    width: 70px;
    height: auto;
    object-fit: contain;
    margin-bottom: 8px;
}

.aris-chat-welcome p {
    font-size: 13px;
    color: #666;
    line-height: 1.6;
    margin: 0;
}

/* 入力エリア */
.aris-chat-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e8e8e8;
    background: #fff;
    flex-shrink: 0;
}

.aris-chat-input {
    flex: 1;
    border: 1px solid #ddd;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    line-height: 1.4;
    outline: none;
    transition: border-color 0.2s;
}

.aris-chat-input:focus {
    border-color: #109585;
}

.aris-chat-input::placeholder {
    color: #aaa;
}

.aris-chat-send {
    background: #109585;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}

.aris-chat-send:hover {
    background: #0d7d6f;
}

.aris-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.aris-chat-send svg {
    width: 18px;
    height: 18px;
}

/* エラー表示 */
.aris-chat-error {
    align-self: center;
    background: #fff3f3;
    color: #c62828;
    border: 1px solid #ffcdd2;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12px;
    text-align: center;
}

/* スマホ対応 */
@media (max-width: 480px) {
    .aris-chat-window {
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .aris-chat-button {
        padding: 10px 16px;
        font-size: 12px;
    }

    .aris-chat-button img {
        width: 32px;
        max-height: 40px;
    }
}

/* ai.html 全画面モード用 */
.aris-chat-fullpage {
    position: relative;
    width: 100%;
    max-width: 900px;
    height: 80vh;
    min-height: 500px;
    margin: 0 auto;
    background: #fff;
    border: 2px solid #109585;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.aris-chat-fullpage .aris-chat-messages {
    flex: 1;
}

@media (max-width: 480px) {
    .aris-chat-fullpage {
        border-radius: 0;
        border-width: 1px;
        height: calc(100vh - 60px);
    }
}
