/* =========================================================
   FANZA Data Fetcher Plugin Styles
   (女優・商品・動画ランキング プロフェッショナル統合版)
   ========================================================= */

/* ---------------------------------------------------------
   共通設定 (アニメーション・バッジ・ボタンなど)
   --------------------------------------------------------- */

/* GODランクの虹色アニメーション定義 */
@keyframes rainbow-glow {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ランクバッジ（共通） */
.rank-badge, .voltage-rank {
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 4px;
    color: #fff;
    font-weight: 800;
    letter-spacing: 0.5px;
    font-style: italic;
    text-shadow: 0 1px 2px rgba(0,0,0,0.4);
    display: inline-block;
    line-height: 1.2; /* 高さ確保 */
}

/* ティアごとの色設定 */
.tier-GOD {
    background: linear-gradient(270deg, #ff00cc, #3333ff, #00ccff, #ff00cc);
    background-size: 400% 400%;
    animation: rainbow-glow 4s ease infinite;
    color: #fff !important;
    border: none;
    box-shadow: 0 0 8px rgba(255, 0, 204, 0.6);
}
.tier-SSS { background: linear-gradient(90deg, #ff0000, #ff4500); }
.tier-SS  { background: linear-gradient(90deg, #ff8c00, #ffd700); }
.tier-S   { background: #ffd700; color:#000; text-shadow:none; }
.tier-A   { background: #32cd32; }
.tier-B   { background: #666; }

/* ---------------------------------------------------------
   共通：ボタンエリア（★コンバージョン強化・ピンクver★）
   --------------------------------------------------------- */
.ranking-card-actions { margin-top: 16px; }

.ranking-card-cta, .actress-card .ranking-card-cta {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: linear-gradient(to bottom, #ffeaf4, #ffcce6); 
    color: #330d1a !important; 
    text-align: center;
    padding: 12px 0;
    border-radius: 6px;
    font-size: 15px;
    text-decoration: none !important;
    font-weight: 800;
    border: none;
    box-shadow: 0 4px 6px rgba(255, 105, 180, 0.2); 
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.ranking-card-cta::before, .actress-card .ranking-card-cta::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.6), transparent);
    transition: all 0.5s;
}

.ranking-card-cta:hover, .actress-card .ranking-card-cta:hover {
    background: linear-gradient(to bottom, #fff5fa, #ffe0f0); 
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 105, 180, 0.35); 
}

.ranking-card-cta:hover::before, .actress-card .ranking-card-cta:hover::before {
    left: 100%;
}

.icon-external {
    margin-left: 8px;
    font-size: 14px;
    color: #cc0066; 
}

/* ---------------------------------------------------------
   1. 女優ランキング (Actress Ranking)
   --------------------------------------------------------- */
/* デフォルトのグリッド設定 (既存維持) */
.actress-ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
}
@media screen and (min-width: 768px) {
    .actress-ranking-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 20px;
    }
}

/* ★ [actress_ranking]用の特別グリッド (レスポンシブ対応 2〜8列) */
.fdf-voltage-container.actress-mode {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 初期値:スマホ */
    gap: 8px !important;
    width: 100%;
}
.fdf-voltage-container.actress-mode .actress-card {
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

/* 画面幅ごとの列数定義 */
@media (min-width: 576px) {
    .fdf-voltage-container.actress-mode { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
}
@media (min-width: 768px) {
    .fdf-voltage-container.actress-mode { grid-template-columns: repeat(4, 1fr) !important; gap: 12px !important; }
}
@media (min-width: 992px) {
    .fdf-voltage-container.actress-mode { grid-template-columns: repeat(5, 1fr) !important; }
}
@media (min-width: 1200px) {
    .fdf-voltage-container.actress-mode { grid-template-columns: repeat(6, 1fr) !important; }
}
@media (min-width: 1400px) {
    .fdf-voltage-container.actress-mode { grid-template-columns: repeat(8, 1fr) !important; gap: 10px !important; }
}

/* スマホ表示の調整 */
@media (max-width: 768px) {
    .fdf-voltage-container.actress-mode .actress-card-content {
        padding: 8px !important;
    }
    .fdf-voltage-container.actress-mode .actress-name {
        font-size: 13px !important;
        margin-bottom: 4px !important;
    }
    .fdf-voltage-container.actress-mode .finder-score-card {
        padding: 6px !important;
    }
    .fdf-voltage-container.actress-mode .score-value {
        font-size: 18px !important;
    }
}

/* カード共通スタイル */
.actress-card.rank-card-wrapper, .actress-card.work-card {
    background: #181818;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s, box-shadow 0.25s;
}
.actress-card:hover {
    transform: translateY(-6px);
    border-color: #555;
    box-shadow: 0 12px 24px rgba(0,0,0,0.8);
    z-index: 2;
}

/* 順位バッジ */
.actress-card .ranking-card-rank-badge {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    background: rgba(0,0,0,0.9);
    color: #fff;
    font-weight: 800;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 8px 0 12px 0;
    border-right: 1px solid #444;
    border-bottom: 1px solid #444;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* 画像エリア (アスペクト比200/280, 右上基準) */
.actress-card-image-wrapper {
    width: 100%;
    aspect-ratio: 200 / 280; 
    background: #0d0d0d;
    position: relative;
    overflow: hidden;
}
.actress-card-image-wrapper a { display: block; width: 100%; height: 100%; }
.actress-card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 100% 0%; 
    transition: transform 0.4s ease;
}
.actress-card:hover .actress-card-image-wrapper img { transform: scale(1.06); }

/* コンテンツエリア */
.actress-card-content {
    padding: 12px;
    background: #181818;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

/* 名前 */
.actress-name {
    margin: 0 0 8px 0;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}
.actress-name a { color: #fff !important; text-decoration: none !important; }
.actress-name a:hover { color: #ffd700 !important; }
.actress-name .ruby { display: block; font-size: 10px; color: #999; margin-bottom: 2px; font-weight: 400; }

/* ★★★ スコアカード修正エリア ★★★ */
.finder-score-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: auto; 
    border-left: 3px solid #444;
    display: flex;
    flex-direction: column; /* 縦並びを基本に */
}

/* ラベル */
.score-label {
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
    line-height: 1;
}

/* メインエリア（左：スコア、右：情報） */
.score-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* 底辺揃え */
    width: 100%;
}

/* ★修正: 左側のスコア（数値とアイコン）をまとめるラッパー */
.score-value-wrap {
    display: flex;
    align-items: baseline; /* ベースラインで揃えてガタつき防止 */
}

.icon-bolt {
    font-size: 18px;
    color: #ffcc00;
    margin-right: 2px;
    line-height: 1;
}

.score-value {
    font-family: "Helvetica Neue", Arial, sans-serif;
    font-weight: 900;
    font-size: 24px;
    color: #fff;
    line-height: 1;
    letter-spacing: -0.5px;
}

/* ★修正: 右側の情報カラム（バッジと作品数） */
.score-right-col {
    display: flex;
    flex-direction: column;
    align-items: flex-end; /* 右寄せ */
    justify-content: flex-end;
    margin-left: 8px; /* スコアとの距離確保 */
}

.score-right-col .rank-badge {
    margin-bottom: 4px; /* 作品数との間隔 */
    font-size: 10px;
    padding: 2px 6px;
}

.score-work-count {
    font-size: 10px;
    color: #bbb;
    font-family: "Helvetica Neue", Arial, sans-serif;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap; /* 折り返し防止 */
    line-height: 1;
}

/* プロフィールタグ */
.actress-specs-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}
.spec-tag {
    font-size: 10px;
    color: #ccc;
    background: #333;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #444;
}
.daf-sp-w100 { display: none; width: 100%; height: 0; }

/* ランクごとの枠色 */
.level-max { border: 1px solid #d500f9 !important; box-shadow: 0 0 8px rgba(213, 0, 249, 0.3); }
.level-high { border: 1px solid #ff0000 !important; }
.level-high-mid { border: 1px solid #ff8c00 !important; }
.level-mid { border: 1px solid #ffd700 !important; }


/* ---------------------------------------------------------
   2. 商品ランキング (Products Ranking) - 既存維持
   --------------------------------------------------------- */
.products-ranking-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 24px;
}
@media screen and (min-width: 768px) {
    .products-ranking-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 20px;
    }
}

.product-card {
    background: #181818;
    border: 1px solid #333;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s, box-shadow 0.25s;
}
.product-card:hover {
    transform: translateY(-6px);
    border-color: #555;
    box-shadow: 0 12px 24px rgba(0,0,0,0.8);
    z-index: 2;
}

/* 商品バッジ */
.product-card .ranking-card-rank-badge {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    background: rgba(0,0,0,0.9);
    color: #fff;
    font-weight: 800;
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 8px 0 12px 0;
    border-right: 1px solid #444;
    border-bottom: 1px solid #444;
    box-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}
.product-card:nth-child(1) .ranking-card-rank-badge { background: linear-gradient(135deg, #FFD700, #FDB931); color:#000; border:none; }
.product-card:nth-child(2) .ranking-card-rank-badge { background: linear-gradient(135deg, #E0E0E0, #BDBDBD); color:#000; border:none; }
.product-card:nth-child(3) .ranking-card-rank-badge { background: linear-gradient(135deg, #CD7F32, #A0522D); color:#fff; border:none; }

/* 商品画像 */
.product-card .ranking-card-media-area {
    width: 100%;
    aspect-ratio: 147 / 200; /* DMMパッケージ比率を維持 */
    background: #0d0d0d;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid #222;
}
.product-card .ranking-card-media-area a { display: block; width: 100%; height: 100%; }
.product-card .ranking-card-media-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    
    /* ★修正: 元の「右上基準」に戻しました */
    object-position: 100% 0%; 
    
    transition: transform 0.4s ease;
}
.product-card:hover .ranking-card-media-area img { transform: scale(1.06); }

/* 商品情報 */
.product-card .ranking-card-info-area {
    padding: 14px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.product-card .ranking-card-title {
    margin: 0 0 10px 0;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.4;
    height: 42px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.product-card .ranking-card-title a { color: #fff !important; text-decoration: none !important; }

.ranking-card-actresses {
    font-size: 13px;
    color: #ccc; 
    margin-bottom: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ranking-card-actresses a {
    color: #ddd !important;
    text-decoration: none;
    background: rgba(255,255,255,0.1);
    padding: 3px 8px;
    border-radius: 4px;
    margin-right: 6px;
}

/* 商品メタ */
.product-card .ranking-card-meta-info {
    margin-top: auto;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    padding: 10px 12px;
    border: 1px solid #333;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.product-card .fdf-voltage-display { display: flex; align-items: center; gap: 8px; }
.product-card .voltage-score { font-size: 22px; font-weight: 900; color: #fff; line-height: 1; }
.product-card .voltage-icon { font-size: 18px; color: #ffcc00; }
.product-card .review-stars { color: #ffcc00; font-size: 15px; }

/* =========================================
   ソートUI
   ========================================= */
.fdf-sort-container {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    z-index: 100;
}
.fdf-sort-trigger {
    background: #252525;
    color: #fff;
    border: 1px solid #444;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fdf-sort-trigger span { color: #ffcc00; }
.fdf-sort-options {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 6px;
    list-style: none;
    padding: 0;
    min-width: 200px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}
.fdf-sort-container:hover .fdf-sort-options, .fdf-sort-container.active .fdf-sort-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.fdf-sort-options li { border-bottom: 1px solid #222; margin:0; }
.fdf-sort-options a {
    display: block;
    padding: 10px 16px;
    color: #ccc;
    text-decoration: none;
    font-size: 13px;
}
.fdf-sort-options a:hover { background: #333; color: #fff; }
.fdf-sort-options a.active { color: #ffcc00; font-weight: bold; background: #252525; }

/* =========================================
   3. 動画ランキング (Video Ranking)
   ========================================= */
.product-card .video-media-area {
    width: 100% !important;
    aspect-ratio: auto !important;
    height: auto !important;
    background: #000 !important;
    padding: 0 !important;
    margin: 0 !important;
}
.video-media-area .iframe-responsive-container {
    position: relative !important;
    width: 100% !important;
    padding-bottom: 75% !important; 
    height: 0 !important;
    overflow: hidden !important;
    background: #000 !important;
}
.video-media-area iframe {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border: none !important;
}

.video-card-content {
    padding: 12px;
    background: #181818;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.video-card-top-row { display: flex; gap: 12px; margin-top: 12px; }
.video-thumb-column { flex: 0 0 30%; max-width: 100px; }
.video-thumb-column a {
    display: block;
    width: 100%;
    aspect-ratio: 147 / 200;
    border-radius: 4px;
    border: 1px solid #333;
    overflow: hidden;
}
.video-info-column { flex: 1; display: flex; flex-direction: column; }
.video-card-middle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 6px 10px;
}

/* =========================================
   ファンボルテージ説明ポップアップ（極狭間隔版）
   ========================================= */
.fdf-ui-wrapper {
    /* ★修正: 下の要素との間隔を大幅に狭く */
    margin-bottom: 8px; 
    
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    
    /* ★修正: 要素間の縦の間隔を限界まで狭く */
    /* gap: 縦幅 横幅; */
    gap: 2px 12px; 
}

/* トリガー（リンク）部分 */
.fdf-voltage-explainer {
    position: relative;
    display: inline-block;
    margin-top: 0;
    /* ★追加: 余計な隙間を排除 */
    line-height: 1;
}

.fdf-explainer-trigger {
    font-size: 12px;
    color: #888;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.2s;
    
    /* ★修正: 行高さをフォントサイズと同じにして上下の隙間をなくす */
    line-height: 1; 
    display: inline-block; /* インラインブロック化して高さを確定 */
}
.fdf-explainer-trigger:hover {
    color: #ccc;
}

/* ポップアップ本体（変更なし） */
.fdf-explainer-popup {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 8px;
    width: 280px;
    background: #222;
    border: 1px solid #444;
    border-radius: 6px;
    padding: 12px;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    text-align: left;
}

.fdf-explainer-popup p {
    margin: 0 0 4px 0;
}
.fdf-explainer-popup p:last-child {
    margin: 0;
}
.fdf-explainer-popup strong {
    color: #fff;
    font-weight: bold;
}
.fdf-explainer-popup .highlight {
    color: #ffd700;
    font-weight: bold;
}