/* css/genre-search.css */
.genre-search-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px; /* コンテナ自体のパディング */
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #fff; /* 背景色を明示 */
}

/* === モーダル外 (通常のジャンル検索ページ) の h3 スタイル === */
/* .dmm-genre-heading クラスを持つ h3 にスタイルを適用 */
/* .tab-content 内の h3 も対象にする */
body:not(.modal-open) .genre-search-container > h3.dmm-genre-heading,
body:not(.modal-open) .genre-search-container .tab-content > h3.dmm-genre-heading {
    color: var(--text-color, #333) !important;
    text-align: left !important;
    background-color: transparent !important;
    padding-top: 10px !important;
    padding-bottom: 8px !important;
    padding-left: 10px !important;
    padding-right: 0 !important;
    border-bottom: 1px solid #eee !important;
    margin-top: 40px !important;         /* 上のスペースを十分に確保 */
    margin-bottom: 5px !important;        /* 下のスペースを小さく */
    font-size: 1.1em !important;
    font-weight: bold !important;
    line-height: 1.5 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* モーダル外の最初のh3要素の上のマージンを少し小さくする */
body:not(.modal-open) .genre-search-container > h3.dmm-genre-heading:first-of-type,
body:not(.modal-open) .genre-search-container .tab-content > h3.dmm-genre-heading:first-of-type {
    margin-top: 25px !important; /* 通常ページの最初のh3の上のマージン */
}


/* 各カテゴリー内のジャンルリストのコンテナ (モーダル内外共通) */
/* h3.dmm-genre-heading の直後の .checkbox-grid に適用される想定 */
.genre-search-container h3.dmm-genre-heading + .checkbox-grid {
    margin-top: 5px; /* h3 との間のスペースを調整（h3のmargin-bottomと合わせて） */
}
.genre-search-container .checkbox-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 15px; /* 次のh3との間のスペース */
}

/* ジャンルチェックボックスのラベル (モーダル内外共通) */
.genre-search-container .checkbox-grid label {
    font-size: 0.9em;
    margin: 0;
    padding: 2px 5px;
    border: 1px solid #ddd;
    border-radius: 3px;
    display: inline-block;
    cursor: pointer;
    background-color: #fff;
    transition: background-color 0.2s, border-color 0.2s;
}

.genre-search-container .checkbox-grid label:hover {
    background-color: #f0f0f0;
}

/* チェックされた状態を視覚的に強調（任意） */
.genre-search-container .checkbox-grid label:has(input:checked) {
    background-color: #f0f8ff;
    border-color: #1890ff;
}

/* リセットボタンのスタイル (モーダル内外共通) */
.reset-button {
    background-color: #aaa;
    color: #fff;
    padding: 10px 15px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.3s;
}

.reset-button:hover {
    background-color: #888;
    transform: translateY(-2px);
}


/* === モーダル内の h3 スタイル === */
/* .dmm-genre-heading クラスを持つ h3 にスタイルを適用 */
body .dmm-plugin-modal-content .genre-search-container h3.dmm-genre-heading,
body .dmm-plugin-modal-content .genre-search-container .tab-content > h3.dmm-genre-heading {
    color: var(--text-color, #333) !important;
    text-align: left !important;
    background-color: transparent !important;
    padding-top: 10px !important;
    padding-bottom: 8px !important;
    padding-left: 10px !important;
    padding-right: 0 !important;
    border-bottom: 1px solid #eee !important;
    margin-top: 30px !important;         /* 上のスペースを確保 */
    margin-bottom: 5px !important;        /* 下のスペースを小さく */
    font-size: 1.1em !important;
    font-weight: bold !important;
    line-height: 1.5 !important;
    border-radius: 0 !important;
    box-sizing: border-box !important;
    width: 100% !important;
}

/* モーダル内の最初のカテゴリ見出し(h3)の上のマージンを調整 */
body .dmm-plugin-modal-content .genre-search-container > h3.dmm-genre-heading:first-child,
body .dmm-plugin-modal-content .genre-search-container .tab-content > h3.dmm-genre-heading:first-child {
    margin-top: 20px !important; /* モーダル内の最初のh3の上のマージン */
}

/* === タブナビゲーションスタイル === */
.genre-search-tabs {
    display: flex;
    border-bottom: 1px solid #ccc;
    margin-bottom: 20px;
    margin-top: 10px;
}

.genre-search-tabs .tab-button {
    padding: 10px 20px;
    background: #fff;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 5px 5px 0 0;
    cursor: pointer;
    font-weight: bold;
    color: #555;
    margin-right: 5px;
    transition: all 0.2s ease;
    outline: none;
}

.genre-search-tabs .tab-button:hover {
    background-color: #f9f9f9;
}

.genre-search-tabs .tab-button.active {
    background: #f0f0f0; /* コンテンツエリアの背景色と合わせる */
    color: #000;
    position: relative;
    border-bottom: 1px solid #f0f0f0; /* 下線を隠す */
    margin-bottom: -1px;
}

/* タブコンテンツエリア */
.tab-content {
    /* JSで表示制御されるが、アニメーションを追加 */
    animation: fadeIn 0.3s ease-in-out;
}

/* 除外セクションの説明文 */
.exclusion-section p {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 0.9em;
    color: #666;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- 「おすすめジャンル」下のボタン用のスタイル --- */
.genre-search-container .search-buttons.recommended-buttons {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 20px; /* 他のセクションとの間に十分なスペースを確保 */
    padding-top: 10px; /* 上部に少しパディング */
    border-top: 1px dashed #ccc; /* 上に区切り線を追加 (任意) */
}

.genre-search-container .search-buttons.recommended-buttons button {
    /* 既存の検索ボタンのスタイルを継承または個別に設定 */
    padding: 10px 20px; /* パディングを調整 */
    margin: 0 5px; /* ボタン間のマージン */
    font-size: 1em; /* フォントサイズ */
    border-radius: var(--border-radius, 8px); /* 角丸 */
    cursor: pointer;
    transition: background-color var(--transition-speed, 0.3s) ease, transform var(--transition-speed, 0.3s) ease;
    font-weight: bold;
}

/* おすすめジャンル下の「適用」ボタンの具体的なスタイル */
.genre-search-container .search-buttons.recommended-buttons #dmm-genre-search-apply-button-recommended {
    background-color: var(--search-color, #38b858); /* shared.css の変数を使用 */
    color: #fff;
    border: none;
}

.genre-search-container .search-buttons.recommended-buttons #dmm-genre-search-apply-button-recommended:hover {
    background-color: #2c8f45; /* ホバー時の色を少し暗く */
    transform: translateY(-2px);
}

/* フォーム全体の検索ボタンコンテナのスタイル (既存) */
.genre-search-container .search-buttons:not(.recommended-buttons) { /* :not で recommended-buttons を除外 */
    text-align: center;
    margin-top: 20px;
}

/* フォーム全体の検索ボタンのスタイル (既存) */
.genre-search-container .search-buttons:not(.recommended-buttons) button {
    /* 既存の検索ボタンのスタイル */
    padding: 12px 24px;
    margin: 0 5px;
    font-size: 16px;
    border: none;
    border-radius: var(--border-radius, 8px);
    cursor: pointer;
    transition: background-color var(--transition-speed, 0.3s) ease, transform var(--transition-speed, 0.3s) ease;
    font-weight: bold;
}

.genre-search-container .search-buttons:not(.recommended-buttons) button[type="submit"] {
    background-color: var(--search-color, #38b858);
    color: #fff;
}

.genre-search-container .search-buttons:not(.recommended-buttons) button[type="submit"]:hover {
    background-color: #2c8f45; /* 少し暗い色に変更 */
    transform: translateY(-2px);
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .genre-search-container .checkbox-grid label {
        font-size: 0.85em; /* スマホでは少し小さく */
        padding: 4px 6px; /* タップしやすいようにパディング調整 */
    }
    
    .genre-search-tabs .tab-button {
        padding: 8px 15px;
        font-size: 0.9em;
    }
}