/* メインコンテンツの重なり順を調整 */
#ILLUST_SEARCH {
    position: relative;
    z-index: 1; /* メニューが上に表示されるように設定 */
    margin: 2px 3px 2px 3px;
}

/* 検索条件欄 */
.search-container {
    border: 1px solid white;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.search-container h3.search-toggle {
    padding: 10px;
    margin: -15px -15px 15px -15px; /* 上下左右のpaddingを打ち消し、下にマージン */
}

.search-container h3.search-toggle.closed {
    margin-bottom: -15px; /* コンテナのpadding-bottomを相殺 */
    border-bottom: none;
}

.search-container .form-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.search-container input[type="date"],
.search-container select {
    padding: 4px 6px;
    font-size: 14px;
    border-radius: 4px;
}

/* 項目名（src_titleクラスを持つラベル）のスタイル */
.search-container .form-group .src_title {
    flex-shrink: 0; /* ラベルが縮まないようにする */
    font-weight: bold;
    width: 120px;
}

/* 項目名以外のラベル（ラジオボタンなど）のスタイル */
.search-container .form-group label:not(.src_title) {
    font-weight: normal;
    color: white;
}

.search-container .form-group span,
.search-container h3 {
    color: white;
}

/* キャラ選択UI */
#selected-charas-display {
    /* 背景色と枠線をなくす */
    padding: 0;
}

#open-chara-modal-btn,
#clear-date-btn {
    border-radius: 3px;
    padding: 3px 11px;
}

/* キャラ選択モーダル */
#chara-modal-overlay {
    display: none; /* JSで制御 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#chara-modal-content {
    padding: 20px 30px;
    border-radius: 8px;
    max-height: 80vh;
    width: 90%;
    max-width: 95%; /* 横幅を広げて5列表示しやすくする */
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

#chara-checkbox-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.modal-buttons {
    position: sticky;
    bottom: -20px; /* 親要素のpadding-bottomを打ち消す */
    /* 親要素の左右paddingを打ち消し、上下マージンを設定 */
    margin: 20px -30px -20px;
    padding: 15px 30px;
    background-color: rgba(255, 255, 255, 0.95); /* 半透明の白 */
    border-top: 1px solid #ddd;
    text-align: right;
}

/* ポップアップ用 */
#popup-overlay {
    display: none; /* JSで制御 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#popup-content {
    position: relative;
    width: 100%;
    max-width: 90vw;
    max-height: 90vh; /* 画面内に収まるように */
    display: flex;
    padding: 20px;
}

.popup-main-content {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex: 1;
    overflow: hidden; /* はみ出し防止 */
    min-height: 0; /* flexアイテムのはみ出し防止 */
}

#popup-image {
    flex: 1; /* 残りのスペースを埋める */
    min-width: 0; /* flexアイテムのはみ出し防止 */
    max-height: 100%;
    object-fit: contain;
}

#popup-comment {
    margin: 0;
    flex: 0 0 320px; /* 幅を320pxに固定 */
    padding-right: 10px;
}

/* 検索ボタン */
.search-container button[type="submit"] {
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    cursor: pointer;
}

#popup-close {
    align-self: flex-end;
    padding: 8px 16px;
}

/* 検索結果サムネイル */
.thumbnail-grid {
    display: grid;
    /* 画面幅に応じて列数を自動調整。各列の最小幅は150px */
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    margin: 5px 0;
    gap: 15px; /* サムネイル間の隙間 */
}

.thumbnail-grid .thumbnail-link {
    display: flex;
    align-items: center;
    padding: 2px; /* 中余白を減らす */
    aspect-ratio: 1 / 1;
    overflow: hidden;
    transition: padding 0.2s ease-in-out; /* アニメーション */
}

.thumbnail-grid .thumbnail-link:hover {
    padding: 0; /* ホバー時に余白をなくす */
}

.thumbnail-grid .thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* アスペクト比を維持してコンテナいっぱいに表示 */
}

.pagination {
    margin-top: 20px;
    font-size:20pt;
}

.pagination a {
    margin-right: 10px;
}
/* Skebリンク */
.skeb-link {
    display: inline-block;
    padding: 4px 10px;
    margin: 4px 0;
    text-decoration: none;
    border-radius: 4px;
}

#clear-date-btn {
    margin-left: 128px;
}

