/* MOD一覧ページ専用CSS */

.mod-page-wrapper {
    max-width: 1800px; /* 画面全体を広く使う */
    width: 96%;
    margin: 120px auto 50px;
    padding: 0;
}

.mod-page-header {
    text-align: center;
    margin-bottom: 40px;
}

.mod-page-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: #333;
    margin-bottom: 15px;
}

.mod-guide-banner {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.mod-guide-banner a {
    display: inline-block;
    padding: 12px 25px;
    background: #007bff;
    color: white;
    border-radius: 50px;
    font-weight: bold;
    text-decoration: none;
    transition: background 0.3s, transform 0.2s;
}

.mod-guide-banner a:hover {
    background: #0056b3;
    transform: translateY(-2px);
    color: white;
}

/* --- 2カラムレイアウト --- */
.mod-layout-container {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    margin-bottom: 30px;
}

/* サイドバー */
.mod-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.sidebar-section {
    margin-bottom: 25px;
}

.sidebar-section h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #ddd;
}

.sidebar-section input[type="text"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.sidebar-list {
    list-style: none;
    padding: 0;
    margin: 0;
    /* スクロールをなくし全件表示 */
}

.sidebar-list li {
    margin-bottom: 10px;
}

.sidebar-list label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #444;
    cursor: pointer;
    transition: color 0.2s;
}

.sidebar-list label:hover {
    color: #007bff;
}

.sidebar-list input[type="radio"],
.sidebar-list input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* タグ一覧をギュッと詰める専用スタイル */
#filter-tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

#filter-tag-list li {
    margin-bottom: 0;
}

#filter-tag-list label {
    display: flex;
    align-items: center;
    font-size: 0.85rem;
    gap: 5px; /* チェックボックスとの間隔 */
    cursor: pointer;
}

#filter-tag-list input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin: 0;
}

/* メインエリア */
.mod-main-area {
    flex: 1;
    min-width: 0; /* フレックスアイテム内の溢れ防止 */
}

.mod-main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.mod-count {
    font-weight: bold;
    font-size: 1.1rem;
    color: #555;
}

.mod-view-toggle {
    display: flex;
    gap: 10px;
}

.btn-toggle-view {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1rem;
    color: #555;
    transition: all 0.2s;
}

.btn-toggle-view.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

/* --- カードレイアウト（グリッド表示） --- */
.mod-list.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

/* --- リストレイアウト（横長表示） --- */
.mod-list.list-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* MODカード共通スタイル */
.mod-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.mod-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.mod-image-container {
    width: 100%;
    background: #f0f0f0;
    position: relative;
    padding-top: 56.25%; /* 16:9比率（ご要望が128x128の場合でも、カードの幅に合わせるために背景比率を確保。または固定サイズ） */
    overflow: hidden;
}

/* Grid表示時の画像は上部全体か、中央配置 */
.grid-view .mod-image-container {
    padding-top: 60%;
}

.mod-image {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.mod-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex: 1;
    text-align: left;
}

.mod-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #222;
}

.mod-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.mod-tag {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: 50px; /* カプセル型（ピル型） */
    font-weight: bold;
    color: #000;
    display: inline-block;
    border: none;
    line-height: 1.3;
}

/* 説明文エリア（スッと広がる機能） */
.mod-desc-wrapper {
    margin-bottom: 20px;
    flex: 1;
    position: relative;
}

.mod-desc {
    font-size: 0.95rem;
    color: #555;
    line-height: 1.6;
    max-height: 4.8em; /* 3行分 */
    overflow: hidden;
    transition: max-height 0.4s ease-in-out;
}

.mod-desc.expanded {
    max-height: 800px; /* 十分な高さ */
}

/* 説明文の中に配置するもっと見るボタン */
.mod-more-btn-inline {
    position: absolute;
    bottom: 0;
    right: 0;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 20%);
    padding-left: 30px;
    border: none;
    color: #007bff;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    line-height: 1.6;
}

.mod-more-btn-inline:hover {
    text-decoration: underline;
}

/* 展開時はボタンを非表示にする */
.mod-desc-wrapper.expanded .mod-more-btn-inline {
    display: none;
}

/* カード下部（リンクともっと見る） */
.mod-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.mod-link {
    font-size: 0.9rem;
    color: #007bff;
    font-weight: bold;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 5px;
}

.mod-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* --- リスト表示時のレイアウト上書き --- */
.list-view .mod-card {
    flex-direction: row;
    align-items: center;
    padding: 10px 20px;
    gap: 20px;
}

.list-view .mod-image-container {
    width: 64px;
    height: 64px;
    padding-top: 0;
    flex-shrink: 0;
    border-radius: 8px;
}

.list-view .mod-image {
    position: relative;
    top: 0;
    left: 0;
    transform: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.list-view .mod-content {
    display: grid;
    grid-template-columns: 280px 1fr auto; /* タイトル枠を広げる */
    grid-template-rows: auto auto;
    gap: 8px 20px;
    padding: 0;
    flex: 1;
    align-items: center;
}

.list-view .mod-title {
    margin: 0;
    font-size: 1.1rem;
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    /* 長い名前は省略(...)にして重なりを防ぐ */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-view .mod-tags {
    margin: 0;
    grid-column: 2 / 3;
    grid-row: 1 / 2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.list-view .mod-desc-wrapper {
    display: block;
    grid-column: 1 / 4;
    grid-row: 2 / 3;
    margin: 0;
}

.list-view .mod-desc {
    font-size: 0.85rem;
    max-height: 3.2em; /* 2行分 */
}

.list-view .mod-desc.expanded {
    max-height: 800px; /* 展開時は高さを広げる */
}

.list-view .mod-more-btn-inline {
    font-size: 0.8rem;
    padding-left: 20px;
}

.list-view .mod-footer {
    margin: 0;
    padding: 0;
    border: none;
    grid-column: 3 / 4;
    grid-row: 1 / 2;
    display: flex;
    justify-content: flex-end;
}

/* 中間サイズ対応：タグが横に収まらず縦に長く(3行以上等に)なるのを防ぐため、MOD名の下に配置 */
@media (max-width: 1300px) {
    .list-view .mod-content {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 8px 15px;
    }
    .list-view .mod-title {
        grid-column: 1 / 2;
        grid-row: 1 / 2;
        white-space: normal; /* 折り返しを許可 */
    }
    .list-view .mod-footer {
        grid-column: 2 / 3;
        grid-row: 1 / 2;
    }
    .list-view .mod-tags {
        grid-column: 1 / 3;
        grid-row: 2 / 3;
    }
    .list-view .mod-desc-wrapper {
        grid-column: 1 / 3;
        grid-row: 3 / 4;
    }
}

/* SPレイアウト対応 */
@media (max-width: 768px) {
    .mod-page-header {
        margin-bottom: 25px;
    }
    .mod-page-title {
        font-size: 1.6rem;
    }
    .mod-page-header h2 {
        font-size: 1.25rem;
    }
    .mod-page-header p {
        font-size: 0.9rem;
    }

    .mod-layout-container {
        flex-direction: column;
    }
    .mod-sidebar {
        width: 100%;
        box-sizing: border-box;
    }
    /* SP時のリスト表示：画像は左、テキストは右（縦積み）にする */
    .list-view .mod-card {
        align-items: flex-start;
        padding: 15px;
        gap: 15px;
    }
    .list-view .mod-content {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .list-view .mod-title, .list-view .mod-tags, .list-view .mod-footer {
        grid-column: auto;
        grid-row: auto;
    }
    .list-view .mod-desc-wrapper {
        grid-column: auto;
        grid-row: auto;
    }
}

/* ========================================================
   MOD Alert Notice
======================================================== */
.mod-alert-notice {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 15px 20px;
    max-width: 800px;
    margin: 0 auto 30px;
    text-align: left;
}

.mod-alert-notice h4 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 16px;
    font-weight: bold;
}

.mod-alert-notice h4 i {
    margin-right: 5px;
}

.mod-alert-notice p {
    margin: 0;
    font-size: 14px;
    line-height: 1.6;
}

/* --- いいねボタン --- */
.like-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    background: transparent;
    border: none;
    padding: 5px 8px;
    font-size: 14px;
    color: #666;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: none;
}

.like-btn:hover {
    color: #ff6b81;
}

.like-btn.liked {
    background: transparent;
    color: #ff6b81;
}

/* Tooltip for Like button */
.like-btn::before {
    content: "これ好き";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-5px);
    background: #fff;
    color: #000;
    padding: 4px 8px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 11px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
}

.like-btn::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(3px);
    border-width: 4px;
    border-style: solid;
    border-color: #fff transparent transparent transparent;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    pointer-events: none;
}

.like-btn:hover::before,
.like-btn:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}
.like-btn:hover::after {
    transform: translateX(-50%) translateY(0px);
}
