/* =========================
   タグ囲み線
========================= */

.tag-group {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #ccc;
    padding: 5px;
    border-radius: 4px;
    margin-bottom: 10px;
}

/* =========================
   検索ボックス全体
========================= */
.search-box {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
    padding: 24px;
    background: #f8f9fb;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}


/* =========================
   セレクトボックス共通
========================= */
.search-box select {
    appearance: none;
    -webkit-appearance: none;
    padding: 10px 40px 10px 12px;
    font-size: 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg viewBox='0 0 24 24' fill='%23666' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    width: 100%;
    /* 全幅に統一 */
}

.search-box select:hover {
    border-color: #888;
}

.search-box select:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

/* =========================
   タググループ（横並び）
========================= */
.tag-group {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.tag-group label {
    flex: 1;
    min-width: 140px;
}

/* AND/OR セレクト */
#tagLogic {
    height: 42px;
    min-width: 110px;
}

/* =========================
リスト全体のレイアウト
========================= */

.works-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* 画面幅に合わせて自動調整 */
    gap: 20px;
    padding: 0;
    list-style: none;
    margin-top: 30px;
}

/* 検索結果の各作品カードのデザイン */
.work-item {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    /* transitionは1箇所にまとめて記述 */
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

/* ホバー時に少し浮き上がらせ、枠線の色を変える */
.work-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-color: #d400ff;
}

/* --- カードをクリックした瞬間のアニメーション --- */
.work-item:active {
    /* ホバーの -4px よりも「下」にくるように数値を調整 */
    transform: scale(0.97) translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.05s ease;
}

/* タイトルのスタイル */
.work-item h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
}

.work-item h3 a {
    color: #333;
    text-decoration: none;

}

.work-item:hover h3 a {
    color: #d400ff;
    /* ホバー時にタイトル色も変える */
}

/* サブ情報のスタイル */
.work-item p {
    font-size: 0.85rem;
    color: #666;
    margin: 5px 0;
}



/* 追加のインラインスタイル */
.search-box label {
    display: block;
    margin-bottom: 5px;
    /* 少し詰めた */
    font-weight: bold;
}

/* テキスト入力 */
#titleInput {
    width: 100%;
    padding: 12px;
    /* selectと合わせました */
    border: 1px solid #ccc;
    border-radius: 8px;
    box-sizing: border-box;
    font-size: 14px;
}

/* =========================
   タグ選択（モーダル連動エリア）
========================= */

/* タグ選択エリア */
.tag-search-container {
    margin-bottom: 10px;
}

.selected-tags-area {
    min-height: 50px;
    padding: 10px;
    border: 2px dashed #eee;
    border-radius: 8px;
    margin-bottom: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fafafa;
    align-items: center;
}

/* キーワードを入力してください */
.placeholder {
    color: #999;
    font-size: 0.9rem;
    font-weight: normal;
}

.selected-tag-chip {
    background: #d400ff;
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
}

.tag-select-trigger {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.tag-select-trigger:hover {
    background: #e0e0e0;
}

/* モーダル基本設定 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    /* JSでflexに切り替え */
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    background: #fff;
    width: 95%;
    max-width: 700px;
    max-height: 85vh;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 15px 20px;
    background: #f8f8f8;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.tag-group-section {
    margin-bottom: 25px;
}

.tag-group-title {
    font-weight: bold;
    border-left: 5px solid #d400ff;
    padding-left: 10px;
    margin-bottom: 12px;
    color: #333;
}

.tag-checkbox-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}

.tag-checkbox-list label {
    font-weight: normal;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    margin: 0;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background: #f8f8f8;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    background: #fc33fc;
    color: #fff;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.btn-secondary {
    background: #ccc;
    color: #333;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
}

/* 検索ボタン */
/* search-actionsは全てを解除 */
.search-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    width: 100%;
}

/* 共通スタイル：全てのボタンの基本を統一 */
.search-actions button {
    height: 50px;
    padding: 0 15px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    box-sizing: border-box;
    /* どの状態でも文字がはみ出さないように */
    white-space: nowrap;
}

/* 押し込み演出を一括適用 */
.search-actions button:active {
    transform: scale(0.96);
}

/* 検索ボタン（青色・メイン） */
#searchBtn {
    background-color: #4a90e2;
    color: white;
    border: none;
}

#searchBtn:hover {
    background-color: #357abd;
}

/* 全て解除ボタン */
#allClearBtn {
    flex: 1;
    /* 残りの 1 の比率を割り当てる */
    background-color: #f0f0f0;
    color: #666;
    border: 1px solid #ccc;
}

/* ボタン押した感触 */
#searchBtn:active {
    transform: scale(0.96);
}

/* ホバー時の演出 */
#searchBtn:hover {
    background-color: #357abd;
}

#allClearBtn:hover {
    background-color: #e0e0e0;
    color: #333;
}

/* --- チェックボックスのカスタマイズ --- */

/* --- タググループのタイトル（女性・男性） --- */
.tag-group-title {
    font-weight: bold;
    color: #333;
    margin: 20px 0 10px;
    padding-left: 8px;
    border-left: 4px solid #ea1ace;
    /* ピンクのアクセント線 */
}

/* --- タグ一覧の並び（横に並べる） --- */
.tag-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    /* 横に並べて入りきらない分は改行 */
    gap: 8px;
    /* タグ同士の隙間 */
    padding: 5px;
}

/* --- タグ（ラベル）本体のデザイン --- */
.tag-checkbox-list label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background-color: #f5f5f5;
    /* 未選択時の背景色 */
    color: #666;
    /* 未選択時の文字色 */
    border-radius: 50px;
    /* 角丸（カプセル型） */
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    border: 1px solid #eee;
    user-select: none;
}

/* --- 元のチェックボックス（四角）を完全に隠す --- */
.tag-checkbox-list input[type="checkbox"] {
    display: none;
}

/* --- マウスを乗せた時の動き（PCのみ） --- */
@media (hover: hover) {
    .tag-checkbox-list label:hover {
        background-color: #eee;
        border-color: #ddd;
    }
}

/* --- 【重要】チェックが入った時のデザイン変化 --- */
/* :has() セレクタを使って、中のinputがチェックされたら親のlabelを変える */
.tag-checkbox-list label:has(input:checked) {
    background: linear-gradient(135deg, #ef69d6, #ea1ace);
    /* サイトのメインカラー */
    color: #fff;
    /* 文字を白に */
    border-color: #ea1ace;
    box-shadow: 0 4px 10px rgba(234, 26, 206, 0.3);
    transform: translateY(-1px);
    /* 少し浮き上がらせる */
}

/* --- チェックが入った時にアイコンを表示したい場合（任意） --- */
.tag-checkbox-list label:has(input:checked)::before {
    content: '✓';
    margin-right: 4px;
    font-weight: bold;
}


/* =========================
    レスポンシブ対応
========================= */
@media (max-width: 768px) {
    .search-box {
        padding: 16px;
    }

    .tag-group {
        flex-direction: column;
        align-items: stretch;
    }

    #tagLogic {
        width: 100%;
    }
}

/* --- スマホ用設定 (480px以下) --- */
@media (max-width: 480px) {
    .search-actions {
        flex-direction: column;
        /* 縦並びにする */
        gap: 10px;
        /* 縦の隙間 */
        max-width: 100vw;
    }

    .container,
    .entry-modal-content {
        max-width: 100vw;
        /* 画面幅（Viewport Width）を超えないように制限 */
    }

    /* HTMLの style="flex: 3" を強制的に上書きして解除する */
    .search-actions #searchBtn,
    .search-actions #allClearBtn {
        flex: none !important;
        width: 100% !important;
        height: 50px;
        /* 高さをしっかり確保 */
    }
}