/* item-list.css */

/* 基本のリセット */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* アイテムカードのスタイル */
.item-card {
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
    height: auto;
    /* 余白を少し詰めて画像エリアを確保 */
    padding: 10px;
    max-width: 100%;
    position: relative;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

/* 画像コンテナ */
.item-image-container {
    position: relative;
    overflow: hidden;
    border-radius: 5px;
    width: 100%;
    margin-bottom: 8px;
    line-height: 0;
    text-align: center; /* 小さい画像を中央に配置 */
    background-color: #f9f9f9;
}

/* 画像本体 */
.item-image img,
.main-image {
    /* 大きい画像は枠いっぱい(100%)、小さい画像は元のサイズ(auto) */
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    margin: 0 auto;
    transition: opacity 0.3s;
    object-fit: contain;
    /* vertical-align: bottom; は display: block; では無効なため削除 */
}

.item-image img:hover,
.main-image:hover {
    opacity: 0.7;
}

/* ホバー時のサンプル画像切り替え用 */
.sample-images-hover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.item-image-container:hover .sample-images-hover {
    opacity: 1;
}
.item-image-container:hover .main-image {
    opacity: 0;
}

/* 商品タイトルのスタイル */
.item-title {
    font-size: 0.95rem;
    font-weight: 500;
    min-height: auto; 
    display: block;
    text-align: center;
    padding: 5px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f9f9f9;
    transition: all 0.3s ease-in-out;
    width: 100%;
    margin-bottom: 8px;
    line-height: 1.4;
    word-wrap: break-word;
}

.item-title a {
    color: inherit;
    text-decoration: none;
    display: block;
}

.item-title:hover {
    background-color: #ffffff;
    border-color: #d0d0d0;
    color: #000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* キャンペーン情報など */
.item-campaign-info {
    font-size: 0.85em;
    color: #e74c3c;
    text-align: center;
    margin: 0 0 8px 0;
    font-weight: bold;
    line-height: 1.3;
}

/* 詳細情報のスタイル */
.item-actresses,
.item-details,
.item-reviews,
.item-additional,
.item-genres {
    font-size: 0.85em;
    color: #666;
    margin: 5px 10px;
    text-align: center;
}

/* サンプル画像のスタイル（詳細モーダル等で使用） */
.sample-images {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding-bottom: 20px;
    justify-content: center;
}

.sample-images a img {
    border-radius: 5px;
    transition: transform 0.3s, opacity 0.3s;
    height: auto;
    box-sizing: border-box;
    max-width: 100%;
}

.sample-images a img:hover {
    transform: scale(1.05);
    opacity: 0.8;
}

/* 汎用ボタンのスタイル */
.btn-highlight {
    display: inline-block;
    margin: 3px;
    padding: 8px 16px;
    background-color: #ff6f61;
    color: #fff;
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s, transform 0.3s;
    border: none;
    cursor: pointer;
    font-size: 0.9em;
    white-space: nowrap;
}

.btn-highlight:hover {
    background-color: #ffdc7a;
    transform: translateY(-2px);
    color: #333;
}

/* ボタンコンテナ */
.item-buttons-container {
    margin-top: auto;
    text-align: center;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    padding-bottom: 5px;
}

/* --- グリッドレイアウト --- */
.item-list {
    display: grid;
    /* 280px以上を確保して大きく表示、要素が少ない場合は左寄せ(auto-fill) */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    justify-content: center;
    gap: 20px;
    /* 上揃え配置（高さ合わせなし） */
    align-items: start;
}

/* メディアクエリ: スマホ縦向き */
@media (orientation: portrait) {
    .item-list {
        /* スマホでは2列表示（隙間を狭くして画像を大きく確保） */
        grid-template-columns: repeat(2, 1fr); 
        gap: 8px; /* 隙間を詰める */
    }
    .item-card {
        padding: 5px; /* 余白をさらに詰めて画像を大きく */
    }
    .item-title {
        font-size: 0.8rem;
        padding: 3px;
        margin-bottom: 5px;
    }
    .btn-highlight, 
    .open-dmm-item-detail-modal, 
    .dmm-sample-movie-button {
        padding: 5px 8px !important;
        font-size: 0.75em !important;
        margin: 2px !important;
    }
}

/* メディアクエリ: スマホ横向き・タブレット */
@media (orientation: landscape) and (max-width: 1023px) {
    .item-list {
        /* 横向き時はある程度の大きさを確保 */
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    .item-title {
        font-size: 0.85em;
    }
}

/* --- ギャラリー表示用 (class-sample-image.php等) --- */
.dmm-image-gallery-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.dmm-image-gallery .gallery-item-section .main-image-container img {
    max-width: 95%; 
    height: auto; 
    object-fit: contain;
    display: block; 
    margin: 0 auto;
}

@media (orientation: portrait) and (max-width: 767px) {
    .dmm-image-gallery .gallery-item-section .main-image-container img {
        max-width: 98% !important;
    }
}

.dmm-image-gallery .gallery-item {
    margin: 2px;
}

.dmm-image-gallery .gallery-item img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: 3px;
    object-fit: contain;
}

/* --- Genre Search Modal (item-list.php 用) --- */
.dmm-plugin-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.dmm-plugin-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s linear 0s;
}
.dmm-plugin-modal-content {
    background-color: #fff;
    padding: 25px 30px;
    border-radius: var(--border-radius, 8px);
    max-width: 90%;
    width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}
.dmm-plugin-modal-overlay.is-visible .dmm-plugin-modal-content {
    transform: scale(1);
}
.dmm-plugin-modal-close-button {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    padding: 5px;
}
.dmm-plugin-modal-close-button:hover { color: #333; }

#open-genre-search-modal {
    background-color: var(--search-color); color: #fff; padding: 8px 16px;
    border: none; border-radius: 4px; cursor: pointer; font-weight: bold;
    transition: background-color 0.3s, color 0.3s; font-size: 0.9em;
}
#open-genre-search-modal:hover { background-color: #2c8f45; color: #fff; }
#open-genre-search-modal.filter-active-button {
    background-color: #e74c3c !important; border-color: #c0392b !important; color: white !important;
}
#open-genre-search-modal.filter-active-button:hover {
    background-color: #c0392b !important;
}

/* スマホ横向き用の拡大画像コンテナ (script.jsで動的生成) */
@media (orientation: landscape) and (max-width: 1023px) {
  .large-image-container {
        max-width: 80% !important;
    }
    .large-image-container img {
         max-width: 100%;
         height: auto;
         object-fit: contain;
    }
}