/* 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: 100%; /* カードの高さを揃える */
    padding: 20px;
    max-width: 100%;
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.2);
}

/* 商品画像のスタイル */
.item-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: opacity 0.3s;
}

.item-image img:hover {
    opacity: 0.7; /* ホバー時に透明化 */
}

/* 商品タイトルのスタイル */
.item-title {
    font-size: clamp(1rem, 4vw, 2rem); /* 横幅に基づいて文字サイズを調整 */
    font-weight: 500; /* 程よい太さ */
    min-height: 3em; /* タイトルの高さ */
    display: flex; /* flexbox を使用 */
    align-items: center; /* 垂直方向中央揃え */
    justify-content: center; /* 水平方向中央揃え (必要に応じて) */
    text-overflow: ellipsis;
    overflow: hidden;
    padding: 0.5em 1em;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background-color: #f9f9f9;
    transition: all 0.3s ease-in-out;
    width: 100%;
    box-sizing: border-box;
    /* text-align: center; /* display:flex を使うので不要な場合がある */
}


.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-actresses {
    font-size: 0.9em;
    color: #555;
    margin: 0 15px 10px 15px;
    text-align: center;
}

/* 詳細情報のスタイル */
.item-details,
.item-reviews,
.item-additional,
.item-genres {
    font-size: 0.85em;
    color: #666;
    margin: 5px 15px;
}

/* サンプル画像のスタイル */
.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: 15px;
    padding: 10px 20px;
    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;
}

.btn-highlight:hover {
    background-color: #ffdc7a; /* ホバー時の色 */
    transform: translateY(-3px);
    color: #333; /* ホバー時の文字色変更（例） */
}


/* レスポンシブデザイン */
.item-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 400px));
    justify-content: center;
    gap: 20px;
}

/* メディアクエリによるスタイル */
@media (orientation: portrait) {
    /* スマホ 縦向き */
    .item-list {
        grid-template-columns: repeat(1, minmax(280px, 1fr));
    }
    .item-title {
        font-size: 0.7em;
    }
      .dmm-image-gallery-buttons a {
         padding: 8px 16px;
          font-size: 14px;
      }
}

@media (orientation: landscape) and (max-width: 1023px) {
    /* スマホ 横向き */
    .item-list {
        grid-template-columns: repeat(2, minmax(280px, 1fr)) !important;
    }
    .item-title {
        font-size: 0.9em !important;
    }
     .dmm-image-gallery-buttons a {
         padding: 10px 18px;
         font-size: 15px;
      }
}

/* ボタンを横並びにするためのスタイル */
.dmm-image-gallery-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* 共通ボタン (dmm-image-gallery-buttons 内の a.btn-highlight) */
.dmm-image-gallery-buttons a.btn-highlight {
   display: inline-block;
    margin: 0 5px 5px 5px; /* 他の btn-highlight との重複を避けるため少し調整 */
    padding: 10px 20px;
    /* background-color は .btn-highlight から継承 */
    /* color は .btn-highlight から継承 */
    border-radius: 25px;
    text-decoration: none;
    font-weight: bold;
    text-align: center;
    transition: background-color 0.3s, transform 0.3s;
}

.dmm-image-gallery-buttons a.btn-highlight:hover {
    /* background-color は .btn-highlight:hover から継承 */
    transform: translateY(-3px);
}

/* 動画と商品ページボタンコンテナ */
.item-buttons-container {
    margin-top: 10px;
    text-align: center;
}

.item-buttons-container a.btn-highlight {
    margin: 0 5px;
}


/* 作品情報の開閉部分 */
.item-info-section {
    display: flex;
    flex-direction: column;
}

.item-info-toggle {
    display: block;
    padding: 10px 15px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 5px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 10px;
    text-decoration: none;
    color: #333;
    font-weight: bold;
    width: 100%;
}

.item-info-toggle:hover {
    background-color: #e0e0e0;
}

.item-info-collapsible {
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 0;
}

.item-info-collapsible.expanded {
    max-height: 1000px; /* 十分な高さを確保 */
    padding-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 15px;
    margin-top: -10px; /* ボタンとの重なり調整 */
    background-color: #f9f9f9;
}

/* 画像ホバーエフェクト用コンテナ */
.item-image-container {
    position: relative;
    overflow: hidden;
}

.item-image-container .main-image {
    display: block;
    transition: opacity 0.5s ease;
}

.item-image-container .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;
}

.item-image-container:hover .sample-images-hover {
    opacity: 1;
}
.item-image-container:hover .main-image {
    opacity: 0;
}

/* --- 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; /* 初期は flex, is-visible で制御 */
    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;
}

/* モーダル内の genre-search-container の調整 */
#genre-search-popup-content .genre-search-container {
    border: none;
    padding: 0;
    max-width: 100%;
}
#genre-search-popup-content .genre-search-container h2 { /* モーダルのH2とは別 */
    font-size: 1.2em;
    margin-top: 0;
    text-align: center; /* モーダル内のH2は中央揃え */
}

/* ★★★ 「ジャンルで絞り込む」ボタンのスタイル修正 ★★★ */
#open-genre-search-modal {
    background-color: var(--search-color); /* 基本色 (shared.css の変数) */
    color: #fff;
    padding: 10px 20px; /* パディング調整 */
    border: none; /* 枠線なし */
    border-radius: 0; /* 角丸をなくす (四角) */
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s, color 0.3s;
}

#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; /* ホバー時もアクティブ色を維持 */
}

/* スマホ横向き用のスタイル (large-image-container 用) */
@media (orientation: landscape) and (max-width: 1023px) {
  .large-image-container { /* これは script.js で動的に body直下に追加される要素のクラス */
        max-width: 80% !important; /* 画像の最大幅を制限 */
    }
    .large-image-container img {
         /* max-height: 70vh; */ /* 高さ制限をコメントアウトまたは削除 */
         max-width: 100%; /* コンテナの幅に合わせる */
         height: auto;
         object-fit: contain;
    }
}

/* === class-gallery-image.php のメイン画像スタイル === */
/* PCでのメイン画像スタイル */
.dmm-image-gallery .gallery-item-section .main-image-container img {
    max-width: 95%; /* PCでは横幅を少し抑えるなど調整可能 */
    /* max-height は指定しないか、非常に大きな値を指定 */
    height: auto; /* 高さは自動調整 */
    object-fit: contain; /* アスペクト比維持 */
    display: block; /* 中央揃えのため */
    margin-left: auto; /* 中央揃えのため */
    margin-right: auto; /* 中央揃えのため */
}

@media (orientation: portrait) and (max-width: 767px) {
    .dmm-image-gallery .gallery-item-section .main-image-container img {
        max-width: 98% !important; /* 横幅は画面に合わせる */
        /* max-height: 65vh !important; */ /* 高さ制限をコメントアウトまたは削除 */
        object-fit: contain !important;
    }
}


/* === class-gallery-image.php のサンプル画像スタイル === */
.dmm-image-gallery .gallery-item {
    margin: 2px;
     /* 親要素 .dmm-image-gallery の gap: 5px; と合わせて調整 */
}

.dmm-image-gallery .gallery-item img {
    max-width: 100%; /* 親要素(.gallery-item)の幅に合わせる */
    height: auto;    /* 高さは自動調整 */
    display: block;
    border-radius: 3px;
    object-fit: contain; /* アスペクト比を維持して全体を表示 */
    /* max-height: 150px; */ /* PCでのサンプル画像の高さ制限をコメントアウトまたは削除 */
}