/*
 * Kagari Comics - User Status Badge Styles
 * バッジ（かがり・作者・サブスク etc）の見た目専用CSS
 */

/* ================================
 * Kagari コメントバッジ＆吹き出し拡張
 * （既存レイアウトには干渉せず、クラスが付いた時だけ上書き）
 * ================================ */

/* 削除: .kagari-comment__manga-author-label は使用されていない
   実際には .kagari-comment__manga-author-pill が使用されている */

/* 将来拡張用：creator / paid / normal もクラスだけ定義しておく */
/* .kagari-comment__text.bubble-creator - 今は特に色を変えない。将来、作者共通カラーを入れる想定。 */
/* .kagari-comment__text.bubble-paid - サブスク用。TIPバッジなど実装時に色を付ける想定。 */
/* .kagari-comment__text.bubble-normal - 通常ユーザー。既存デザインをそのまま使う。 */

/* バッジ共通デザイン */
.kagari-comment__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.2;
    vertical-align: middle;
    white-space: nowrap;
}

/* かがり公式バッジ（赤） */
.kagari-comment__badge--official {
    background-color: #ffe5ea;
    color: #ff2757;
}

/* 作者バッジ（青） */
.kagari-comment__badge--creator {
    background-color: #e4eeff;
    color: #1f5fff;
}

/* 将来用：サブスク／TIPバッジ（今は使わない） */
.kagari-comment__badge--subscriber {
    background-color: #fff7da;
    color: #b58900;
}

/* コメントカード外枠：公式（赤） */
.kagari-comment.kagari-comment--official {
    box-shadow: 0 0 0 3px #ff4b5c;
    border-radius: 12px;
}

/* コメントカード外枠：この漫画の作者（青） */
.kagari-comment.kagari-comment--creator-author {
    box-shadow: 0 0 0 3px #3b7eff;
    border-radius: 12px;
}

/* 作者ラベルは小さめのバッジとして名前の横に並べる */
.kagari-comment__manga-author-pill {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    line-height: 1.2;
    color: #1976d2;
    border: 1px solid #1976d2;
    border-radius: 999px;
    white-space: nowrap;
    margin-bottom: 0;
}

/* ===========================
 * Kagari Author - 公式バッジとメッセージ
 * =========================== */

/* バッジラッパー（position: relative でポップアップの基準点にする） */
.kc-author-kagari-badge-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* Twitter風公式バッジ */
.kc-author-kagari-badge {
    background: #1da1f2;
    color: #fff;
    border: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.kc-author-kagari-badge:hover {
    background: #0d8ddb;
    transform: scale(1.05);
}

/* バッジメッセージポップアップ（デフォルト非表示） */
.kc-author-kagari-badge-message {
    position: absolute;
    top: calc(100% + 8px);           /* バッジのすぐ下に表示 */
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    min-width: 260px;
    max-width: 320px;
    padding: 14px 18px;
    background: #ffe9a9;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15), 0 8px 24px rgba(0, 0, 0, 0.1);
    font-size: 14px;
    line-height: 1.6;
    text-align: left;
    color: #333;
    z-index: 100;
    display: none;
    white-space: normal;
    word-wrap: break-word;
}

/* 開いた状態 */
.kc-author-kagari-badge-message.is-open {
    display: block;
}

/* モバイルでバッジの真下に表示（画面端にはみ出さないように調整） */
@media (max-width: 768px) {
    .kc-author-kagari-badge {
        width: 20px;
        height: 20px;
        font-size: 12px;
        flex-shrink: 0;
    }

    .kc-author-kagari-badge-message {
        top: calc(100% + 8px);       /* バッジの真下に表示 */
        left: 50%;
        transform: translateX(-50%);  /* 横は中央寄せ */
        min-width: 240px;
        max-width: min(260px, calc(100vw - 32px));  /* 画面端にはみ出さない */
        font-size: 13px;
        padding: 12px 16px;
        white-space: normal;
    }
}

/* ===============================
 * 共通ユーザーカード：ベースレイアウト
 * （コメントカードのイメージをベースにしたシンプルな横並び）
 * =============================== */

.kc-user-identity {
	display: flex;
	align-items: center;
	gap: 8px;
}

.kc-user-identity__avatar {
	flex: 0 0 auto;
}

.kc-user-identity__avatar img {
	display: block;
	border-radius: 999px; /* まん丸アイコン */
}

.kc-user-identity__meta {
	display: flex;
	flex-direction: row;      /* ← 縦並び → 横並びに変更 */
	align-items: center;
	gap: 6px;
	min-width: 0;
	flex-wrap: nowrap;
}

.kc-user-identity__name {
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.2;
}

.kc-user-identity__badges {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	font-size: 0.75rem;
	line-height: 1.1;
	margin-left: 4px; /* 名前と少しだけ間をあける */
}

/* 共通ユーザーカード：アイコンサイズ（モバイル基準） */
.kc-user-identity__avatar-img {
	width: 38px !important;  /* 32px の約1.2倍 */
	height: 38px !important;
	border-radius: 999px !important;
	object-fit: cover;
	flex-shrink: 0;
}

/* PC ではさらに少し大きく（約1.3倍） */
@media (min-width: 768px) {
	.kc-user-identity__avatar-img {
		width: 42px !important;  /* 32px の約1.3倍 */
		height: 42px !important;
	}
}

/* ===============================
 * バッジ説明ツールチップ（クリック／タップで表示）
 * =============================== */

.kagari-comment__badge {
	position: relative;
	cursor: pointer;
}

.kagari-comment__badge-tooltip {
	position: absolute;
	bottom: calc(100% + 6px);
	left: 50%;
	transform: translateX(-50%);
	background: #ffffff;
	color: #111111;
	padding: 6px 10px;
	border-radius: 10px;
	font-size: 0.75rem;
	line-height: 1.4;
	white-space: normal;
	min-width: 140px;
	max-width: 240px;

	border: 1px solid #e74a4a; /* 赤枠 */

	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);

	z-index: 99999 !important;   /* ← 最前面へ強制表示 */
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease-out;
}

.kagari-comment__badge-tooltip--visible {
	opacity: 1;
	pointer-events: auto;
}

/* 吹き出しの三角（白＋赤枠っぽく見せる） */
.kagari-comment__badge-tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border-width: 7px 7px 0 7px;
	border-style: solid;
	border-color: #ffffff transparent transparent transparent; /* 白い三角 */
}
