/* Affiros オートインサーター 比較カードCSS
 * テーマ側CSSとの衝突対策として、レイアウトが壊れると致命的なプロパティは
 * !important で強制する (ボタンが潰れて非表示になる事故が実際に起きたため)。
 */

.affiros-ai-compare-card,
.affiros-ai-compare-card *,
.affiros-ai-side-card,
.affiros-ai-side-card * {
    box-sizing: border-box;
}
/* テーマが a::after 等で付ける装飾 (外部リンクアイコン・下線バー) を遮断 */
.affiros-ai-compare-card *::before,
.affiros-ai-compare-card *::after,
.affiros-ai-side-card *::before,
.affiros-ai-side-card *::after {
    content: none !important;
}

.affiros-ai-compare-card {
    margin: 32px 0;
    padding: 20px 16px 14px;
    background: #fff;
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(20, 40, 80, 0.06);
}

.affiros-ai-card-head {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 0 0 10px 10px;
    border-left: 4px solid #2271b1;
    border-bottom: 1px solid #eef1f5;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
}
.affiros-ai-kw {
    font-size: 12px;
    font-weight: 500;
    color: #8a94a3;
}

.affiros-ai-card-grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
@media (max-width: 700px) {
    .affiros-ai-card-grid { grid-template-columns: 1fr; gap: 16px; }
}

.affiros-ai-item {
    position: relative;
    display: flex !important;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e8ecf1;
    border-radius: 10px;
    padding: 18px 14px 16px;
    text-align: center;
    overflow: visible;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.affiros-ai-item:hover {
    box-shadow: 0 6px 18px rgba(20, 40, 80, 0.10);
    transform: translateY(-2px);
}

.affiros-ai-rank {
    position: absolute;
    top: -10px;
    left: -8px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #fff !important;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    line-height: 1;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.18);
    z-index: 1;
}

.affiros-ai-img {
    height: 150px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    /* テーマが img の height を上書きしても文字に被らないよう物理的に切る */
    overflow: hidden !important;
}
.affiros-ai-img a {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}
.affiros-ai-img img {
    display: block !important;
    max-height: 100% !important;
    max-width: 100% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    box-shadow: none !important;
    border: none !important;
    margin: 0 !important;
}
@media (max-width: 700px) {
    .affiros-ai-img { height: 180px; }
}

.affiros-ai-title {
    font-size: 13px;
    line-height: 1.5;
    color: #1a1a1a;
    font-weight: 600;
    margin-bottom: 6px;
    min-height: 58px;
}
@media (max-width: 700px) {
    .affiros-ai-title { min-height: 0; font-size: 14px; }
}
.affiros-ai-title a {
    color: inherit !important;
    text-decoration: none !important;
}
.affiros-ai-title a:hover { color: #2271b1 !important; text-decoration: underline !important; }

.affiros-ai-brand {
    font-size: 11px;
    color: #8a94a3;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.affiros-ai-rating {
    font-size: 12px;
    color: #e8a413;
    font-weight: 700;
    margin-bottom: 2px;
}
.affiros-ai-rating span {
    color: #8a94a3;
    font-weight: 500;
    font-size: 11px;
}

.affiros-ai-price {
    font-size: 18px;
    font-weight: 700;
    color: #e02929;
    margin: 4px 0 14px;
    line-height: 1.2;
}

/* ── ボタン ──
 * テーマによって display / padding / height が上書きされ「ボタンが潰れて
 * 見えない」事故が起きるため、表示に関わる全プロパティを強制する。 */
.affiros-ai-btns {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    margin-top: auto;
    padding-top: 4px;
}
.affiros-ai-btns a,
.affiros-ai-btn {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px 10px !important;
    margin: 0 !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.4 !important;
    text-align: center !important;
    text-decoration: none !important;
    color: #fff !important;
    white-space: normal !important;
    overflow: visible !important;
    opacity: 1 !important;
    visibility: visible !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
    transition: filter 0.15s ease;
}
.affiros-ai-btn-amazon { background: linear-gradient(180deg, #ffa726, #fb8c00) !important; }
.affiros-ai-btn-rakuten { background: linear-gradient(180deg, #d63a3a, #b71c1c) !important; }
.affiros-ai-btns a:hover,
.affiros-ai-btn:hover {
    filter: brightness(1.08);
    color: #fff !important;
}

.affiros-ai-card-foot {
    margin-top: 12px;
    text-align: right;
    color: #8a94a3;
}
.affiros-ai-card-foot small { font-size: 11px; }

/* ── サイドバー用コンパクトカード ([affiros_ai_top]) ── */
.affiros-ai-side-card {
    background: #fff;
    border: 1px solid #e5e9ef;
    border-radius: 12px;
    padding: 16px 14px;
    margin: 0 0 24px;
    text-align: center;
    box-shadow: 0 2px 12px rgba(20, 40, 80, 0.06);
}
.affiros-ai-side-head {
    margin: 0 0 12px;
    padding: 0 0 8px 10px;
    border-left: 4px solid #2271b1;
    border-bottom: 1px solid #eef1f5;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.4;
    color: #1a1a1a;
    text-align: left;
}
.affiros-ai-side-card .affiros-ai-img { height: 160px; }
.affiros-ai-side-card .affiros-ai-title { min-height: 0; }

/* ── セールマイクロコピー (v0.17.0 / セールハブ連携) ──
 * 表示時注入 (affiros_ai_sale_decorate) がボタン直上に差し込む。
 * アニメーションのクラス名・キーフレームはセールハブ管理画面の
 * 表示イメージと同一のデザイン契約。 */
.affiros-ai-sale {
    text-align: center !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin: 0 !important;
}
/* 既定色はポチップ準拠の薄め。ハブで色指定があればインラインstyleが優先 */
.affiros-ai-sale-amazon  { color: #f7a306 !important; }
.affiros-ai-sale-rakuten { color: #e64c4c !important; }
/* .affiros-ai-btns は gap:8px の縦flex。コピーとボタンの間だけ詰める */
.affiros-ai-btns .affiros-ai-sale { margin: 0 0 -5px !important; }

@keyframes affiros-sh-blink  { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes affiros-sh-bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-4px); } 60% { transform: translateY(-2px); } }
@keyframes affiros-sh-pulse  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes affiros-sh-shake  { 0%, 88%, 100% { transform: rotate(0); } 90% { transform: rotate(2deg); } 92% { transform: rotate(-2deg); } 94% { transform: rotate(1.5deg); } 96% { transform: rotate(-1.5deg); } 98% { transform: rotate(.5deg); } }
.affiros-sh-anim-none   { animation: none; }
.affiros-sh-anim-blink  { animation: affiros-sh-blink 1.4s ease-in-out infinite; }
.affiros-sh-anim-bounce { animation: affiros-sh-bounce 2.2s ease-in-out infinite; }
.affiros-sh-anim-pulse  { animation: affiros-sh-pulse 1.6s ease-in-out infinite; }
.affiros-sh-anim-shake  { animation: affiros-sh-shake 3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
    [class^="affiros-sh-anim-"], [class*=" affiros-sh-anim-"] { animation: none; }
}
