/* comic_panel.css - 吹き出し表示用スタイル */

/* 吹き出しコンテナ（基本） */
.balloon-container {
    display: flex;
    align-items: flex-start; /* 上揃え */
    margin: 15px 0;
    gap: 0; /* gapは0にして、marginで制御 */
    line-height: 1.2rem;
}

/* 左タイプ: 画像 → 吹き出し */
.balloon-left {
    justify-content: flex-start;
}

/* 右タイプ: 吹き出し → 画像 */
.balloon-right {
    justify-content: flex-end;
}

/* 人物画像（丸くトリミング） */
.balloon-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%; /* 円形にトリミング */
    object-fit: cover; /* 画像を円形にフィット */
    margin: 10px;
    padding: 0;
    flex-shrink: 0; /* 画像サイズを固定 */
}

/* 吹き出しコンテンツ */
.balloon-content {
    background-color: #ffffff;
    border: 2px solid #ddd;
    border-radius: 12px;
    padding: 10px;
    max-width: calc(90% - 100px - 20px); /* 親要素の90% - 画像幅 - マージン */
    min-width: 100px;
    word-wrap: break-word;
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.5rem;
}

/* 左タイプの吹き出し（吹き出しの尾は左側） */
.balloon-left .balloon-content {
    margin-left: 0;
}

.balloon-left .balloon-content::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 20px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 10px 10px 0;
    border-color: transparent #ddd transparent transparent;
}

.balloon-left .balloon-content::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 21px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 9px 9px 9px 0;
    border-color: transparent #ffffff transparent transparent;
}

/* 右タイプの吹き出し（吹き出しの尾は右側） */
.balloon-right .balloon-content {
    margin-right: 0;
}

.balloon-right .balloon-content::before {
    content: '';
    position: absolute;
    right: -10px;
    top: 20px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #ddd;
}

.balloon-right .balloon-content::after {
    content: '';
    position: absolute;
    right: -7px;
    top: 21px;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 9px 0 9px 9px;
    border-color: transparent transparent transparent #ffffff;
}

/* ローディング画像コンテナ */
.loading-images {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 20px;
}

/* 画像グループ */
.loading-images-group {
    display: flex;
    gap: 10px;
}

/* ローディング画像（トリミングなし） */
.loading-avatar {
    width: 100px;
    height: 100px;
    object-fit: contain; /* アスペクト比を維持してトリミングしない */
}

/* 思考吹出しコンテナ */
.thinking-bubble {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* 思考吹出しのコンテンツ（もくもく型の丸四角） */
.thinking-bubble-content {
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 60% 50% 60% 50%; /* もくもく感を出す不規則な丸み */
    padding: 15px 20px;
    min-width: 80px;
    max-width: 200px;
    text-align: center;
    font-size: 14px;
    word-wrap: break-word;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    line-height: 1.4;
}

/* 思考吹出しの尾（小さな丸2つ） */
.thinking-bubble-tail {
    position: relative;
    width: 32px;  /* 小さな丸8px + 間隔12px + 大きな丸12px */
    height: 20px;
    margin-top: 0;
    margin-left: 8px;   /* 画像グループとの間隔 */
    margin-right: 12px; /* 吹出しとの間隔 */
    order: -1;  /* 吹出しの前に配置 */
}

.thinking-bubble-tail::before,
.thinking-bubble-tail::after {
    content: '';
    background-color: #fff;
    border: 2px solid #333;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: absolute;
}

/* 大きい丸：右端に配置 */
.thinking-bubble-tail::before {
    width: 12px;
    height: 12px;
    right: 0px;  /* コンテナの右端 */
    top: calc(50% - 6px - 0.8px);  /* 3度傾斜で少し上 */
}

/* 小さい丸：左端に配置 */
.thinking-bubble-tail::after {
    width: 8px;
    height: 8px;
    left: 0px;  /* コンテナの左端 */
    top: calc(50% - 4px + 0.8px);  /* 3度傾斜で少し下 */
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .balloon-content {
        max-width: calc(85% - 100px - 20px);
    }
    
    .balloon-avatar {
        width: 80px;
        height: 80px;
        margin: 8px;
    }
    
    .loading-avatar {
        width: 80px;
        height: 80px;
    }
}

@media (max-width: 480px) {
    .balloon-content {
        max-width: calc(80% - 80px - 16px);
        font-size: 0.9em;
    }
    
    .balloon-avatar {
        width: 60px;
        height: 60px;
        margin: 5px;
    }
    
    .loading-avatar {
        width: 60px;
        height: 60px;
    }
}
