/* LINE トーク履歴ビューアー - LINE風スタイル */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Hiragino Sans', 'Meiryo', sans-serif;
    background-color: #f5f5f5;
    min-height: 100vh;
}

.chat-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #7494c0;
}

/* ヘッダー */
.chat-header {
    background-color: #6e8ab4;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.back-button {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    margin-right: 8px;
}

.chat-title {
    font-size: 16px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.header-spacer {
    width: 40px;
}

/* メッセージエリア */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

/* 日付セパレーター */
.date-separator {
    text-align: center;
    margin: 16px 0;
}

.date-separator span {
    background-color: rgba(0, 0, 0, 0.3);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
}

/* メッセージ共通 */
.message {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    max-width: 80%;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    flex-shrink: 0;
}

/* 自分のメッセージ（右寄せ・緑） */
.message.own {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.own .message-bubble {
    background-color: #7ee87e;
    color: #000;
    border-bottom-right-radius: 4px;
}

/* 相手のメッセージ（左寄せ・白） */
.message.other {
    align-self: flex-start;
}

.message.other .message-bubble {
    background-color: #ffffff;
    color: #000;
    border-bottom-left-radius: 4px;
}

/* 特殊メッセージ */
.message-bubble.special {
    background-color: #e0e0e0 !important;
    color: #666 !important;
    font-style: italic;
}

.message-bubble.special .icon {
    margin-right: 4px;
}

/* 通話メッセージ（中央寄せ） */
.system-message {
    text-align: center;
    margin: 8px 0;
}

.system-message span {
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    padding: 6px 14px;
    border-radius: 14px;
    font-size: 12px;
    display: inline-block;
}

/* URL リンク */
.message-bubble a {
    color: #0066cc;
    text-decoration: underline;
    word-break: break-all;
}

.message.own .message-bubble a {
    color: #004499;
}

/* フッター */
.chat-footer {
    background-color: #6e8ab4;
    color: white;
    padding: 8px 16px;
    font-size: 11px;
    display: flex;
    justify-content: space-between;
}

/* スクロールバー */
.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* レスポンシブ */
@media (max-width: 480px) {
    .chat-container {
        max-width: 100%;
    }

    .message {
        max-width: 85%;
    }
}
