/* お灸相談チャット専用スタイル */

/* チャットページ固有のbody設定 */
body.chat-page {
    background-color: #f8f4ef;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* メインコンテンツエリア */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* ページタイトル */
.chat-header {
    text-align: center;
    margin-bottom: 20px;
}

.chat-header h1 {
    font-size: 2rem;
    color: #8c7462;
    margin: 0 0 10px 0;
}

.chat-header p {
    font-size: 1rem;
    color: #666;
    margin: 0;
}

/* チャットコンテナ */
.chat-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* フレックスアイテムの高さ制御に必要 */
}

/* チャット表示エリア */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #fafaf8;
    min-height: 0; /* スクロール可能にするために必要 */
}

/* メッセージ */
.message {
    margin-bottom: 16px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-message {
    justify-content: flex-end;
}

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    white-space: pre-line;
    word-wrap: break-word;
}

.user-message .message-content {
    background-color: #8c7462;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background-color: #fff;
    border: 1px solid #e0d7ce;
    color: #333;
    border-bottom-left-radius: 4px;
}

/* 入力エリア */
.input-area {
    display: flex;
    padding: 16px 20px;
    background-color: #fff;
    border-top: 1px solid #e0d7ce;
    gap: 12px;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0d7ce;
    border-radius: 24px;
    font-size: 1rem;
    background-color: #fafaf8;
    transition: border-color 0.3s;
}

#user-input:focus {
    outline: none;
    border-color: #8c7462;
    background-color: #fff;
}

#send-button {
    background-color: #8c7462;
    color: white;
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: background-color 0.3s, transform 0.1s;
    flex-shrink: 0;
}

#send-button:hover {
    background-color: #6e584a;
}

#send-button:active {
    transform: scale(0.95);
}

/* ローディングインジケーター */
.loading {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.loading-dot {
    background-color: #8c7462;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin: 0 4px;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    } 
    40% { 
        transform: scale(1.0);
        opacity: 1;
    }
}

/* スマホ対応: アプリ風UI */
@media (max-width: 768px) {
    body.chat-page {
        background-color: #fff;
    }
    
    /* ヘッダーを最小化 */
    header {
        padding: 10px 0;
    }
    
    .header-container {
        padding: 0 15px;
    }
    
    .site-title a {
        font-size: 18px;
    }
    
    /* ナビゲーションを非表示 */
    .main-nav {
        display: none;
    }
    
    /* メインエリアをフル活用 */
    .chat-main {
        padding: 10px;
        margin: 0;
    }
    
    .chat-header {
        margin-bottom: 10px;
    }
    
    .chat-header h1 {
        font-size: 1.5rem;
    }
    
    .chat-header p {
        font-size: 0.9rem;
    }
    
    /* チャットコンテナを全画面風に */
    .chat-container {
        border-radius: 8px;
        flex: 1;
        max-height: calc(100vh - 200px); /* ヘッダー・フッター分を引く */
    }
    
    .chat-box {
        padding: 15px;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 0.95rem;
    }
    
    .input-area {
        padding: 12px 15px;
    }
    
    #user-input {
        font-size: 16px; /* iOS のズーム防止 */
    }
    
    #send-button {
        width: 44px;
        height: 44px;
    }
    
    /* フッターを最小化 */
    footer {
        padding: 15px 0;
        font-size: 0.85rem;
    }
    
    .footer-nav {
        display: none;
    }
}

/* タブレット対応 */
@media (min-width: 769px) and (max-width: 1024px) {
    .chat-main {
        padding: 15px;
    }
    
    .chat-container {
        max-height: calc(100vh - 280px);
    }
}

/* PC対応 */
@media (min-width: 1025px) {
    .chat-container {
        max-height: calc(100vh - 320px);
        min-height: 500px;
    }
}

/* カスタムスクロールバー */
.chat-box::-webkit-scrollbar {
    width: 8px;
}

.chat-box::-webkit-scrollbar-track {
    background: #f8f4ef;
}

.chat-box::-webkit-scrollbar-thumb {
    background: #c9b8a8;
    border-radius: 4px;
}

.chat-box::-webkit-scrollbar-thumb:hover {
    background: #8c7462;
}
