/**
 * Dynamic Filter Pro フロントエンドスタイル
 */

/* ==========================================================================
   フィルターフォーム
   ========================================================================== */

.dfp-filter-form-container {
    margin-bottom: 2rem;
    max-width: 100%;
    overflow-x: hidden;
}

.dfp-filter-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
}

.dfp-filter-form .dfp-form-actions {
    margin-top: 1rem;
}

.dfp-field-container {
    max-width: 100%;
    box-sizing: border-box;
}

/* 依存フィールドのグループ化 */
.dfp-field-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.dfp-field-group .dfp-field-container {
    flex: 0 0 auto;
}

/* スマホでは縦並びに変更 */
@media (max-width: 480px) {
    .dfp-field-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dfp-field-group .dfp-field-container {
        flex: 1 1 auto;
    }
}

.dfp-field-label {
    display: block;
    margin-bottom: 4px;
    font-weight: bold;
    color: #333;
}

/* セレクトフィールド */
.dfp-select-field {
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    min-width: 150px;
}

.dfp-select-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* チェックボックスフィールド */
.dfp-checkbox-group {
    display: flex;
    flex-wrap: wrap;
   /* gap: 6px;*/
    max-width: 100%;
    box-sizing: border-box;
}

.dfp-checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    max-width: 100%;
    box-sizing: border-box;
    margin-right: 8px;
    margin-bottom: 4px;
}

.dfp-checkbox-field {
    margin-right: 5px;
    flex-shrink: 0;
}

.dfp-checkbox-text {
    font-size: 14px;
    white-space: nowrap;
}

/* ラジオボタンフィールド */
.dfp-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
}

.dfp-radio-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    max-width: 100%;
    box-sizing: border-box;
    margin-right: 8px;
    margin-bottom: 4px;
}

.dfp-radio-field {
    margin-right: 5px;
    flex-shrink: 0;
}

.dfp-radio-text {
    font-size: 14px;
    white-space: nowrap;
}

/* 範囲指定フィールド */
.dfp-range-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

.dfp-range-min,
.dfp-range-max {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    transition: border-color 0.2s ease;
    min-width: 0;
}

.dfp-range-min {
    order: 0;
}

.dfp-range-max {
    order: 2;
}

.dfp-range-min:focus,
.dfp-range-max:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* 範囲指定フィールドの区切り文字 */
.dfp-range-container::before {
    content: "〜";
    color: #666;
    font-weight: bold;
    flex-shrink: 0;
    order: 1;
}

/* フリー入力フィールド */
.dfp-text-field {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.dfp-text-field:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.dfp-text-field::placeholder {
    color: #999;
    font-style: italic;
}

/* フォームアクション */
.dfp-form-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.dfp-filter-button,
.dfp-reset-button {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 80px;
}

.dfp-filter-button {
    background: #0073aa;
    color: white;
}

.dfp-filter-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dfp-reset-button {
    background: #666;
    color: white;
}

.dfp-reset-button:hover {
    background: #444;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

/* ローディング */
.dfp-loading {
    text-align: center;
    padding: 1rem;
    color: #666;
    font-style: italic;
}

.dfp-loading:before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: dfp-spin 1s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes dfp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 連動フィールド */
.dfp-dependent-field.dfp-hidden {
    display: none !important;
    visibility: hidden;
}

.dfp-dependent-field {
    transition: opacity 0.3s ease-in-out;
}

.dfp-dependent-field.dfp-loading {
    opacity: 0.6;
}

.dfp-dependent-field.dfp-loading::after {
    content: "読み込み中...";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    color: #666;
    z-index: 10;
}

/* 事前フィルターに依存するフィールド */
.dfp-preset-dependent {
    /* 他のフィールドと同じデザインにするため装飾を削除 */
}

.dfp-preset-dependent-group {
    /* 他のフィールドと同じデザインにするため装飾を削除 */
}

.dfp-preset-dependent-group::before {
    /* ラベル表示を削除 */
    display: none;
}

/* ==========================================================================
   検索結果
   ========================================================================== */

.dfp-results-wrapper {
    margin-top: 2rem;
}

/* 初期状態（結果が空の場合） */
.dfp-results:empty {
    display: none;
}

/* 結果ヘッダー（初期状態では非表示、JavaScriptで制御） */
.dfp-results-header {
    display: none;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

/* 結果ヘッダー */
.dfp-results-header:has(.dfp-results-count:empty) {
    display: none !important;
}

.dfp-results-count {
    font-weight: 600;
    color: #495057;
    font-size: 16px;
}

.dfp-results-sort {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dfp-sort-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: #fff;
    font-size: 14px;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.dfp-sort-select:focus {
    border-color: #0073aa;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 115, 170, 0.25);
}

.dfp-results-container {
    display: grid;
    gap: 1.5rem;
}

/* 結果アイテムリンク */
.dfp-result-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.dfp-result-item-link:hover {
    text-decoration: none;
    color: inherit;
    transform: translateY(-2px);
}

.dfp-result-item-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.dfp-result-item {
    padding: 1.5rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: box-shadow 0.2s;
    cursor: pointer;
}

.dfp-result-item-link:hover .dfp-result-item {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* フィールド表示 */
.dfp-field {
    margin-bottom: 1rem;
}

.dfp-field:last-child {
    margin-bottom: 0;
}

.dfp-title {
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    line-height: 1.3;
}

.dfp-title {
    color: #0073aa;
}

.dfp-result-item-link:hover .dfp-title {
    color: #005a87;
}

.dfp-label {
    font-weight: 600;
    color: #666;
    margin-right: 0.5rem;
}

.dfp-content,
.dfp-excerpt,
.dfp-date,
.dfp-acf-field {
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.dfp-content-text,
.dfp-excerpt-text {
    margin-top: 0.25rem;
    color: #333;
}

.dfp-date-value {
    color: #666;
    font-size: 0.9rem;
}

/* 画像表示 */
.dfp-featured-image,
.dfp-field-value img {
    margin-bottom: 1rem;
}

.dfp-featured-img,
.dfp-acf-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.dfp-featured-img {
    max-height: 200px;
    object-fit: cover;
}

.dfp-acf-image {
    max-height: 150px;
    object-fit: cover;
}

/* アクション */
.dfp-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.dfp-read-more {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.dfp-read-more:hover {
    background: #005a87;
    color: white;
}

/* メッセージ */
.dfp-no-results,
.dfp-initial-message,
.dfp-error,
.dfp-notice {
    padding: 1rem;
    border-radius: 4px;
    text-align: center;
}

.dfp-no-results,
.dfp-initial-message {
    background: #f0f0f0;
    color: #666;
    border: 1px solid #ddd;
}

.dfp-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.dfp-notice {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* ==========================================================================
   レスポンシブデザイン
   ========================================================================== */

@media (max-width: 768px) {
    .dfp-filter-form {
        display: block;
    }
    
    .dfp-field-container {
        min-width: auto;
        width: 100%;
        box-sizing: border-box;
        margin-bottom: 10px;
    }
    
    .dfp-form-actions {
        justify-content: center;
        margin-top: 1rem;
    }
    
    .dfp-filter-form-container {
        margin-bottom: 1.5rem;
        padding: 0 10px;
        box-sizing: border-box;
    }
    
    .dfp-result-item {
        padding: 1rem;
    }
    
    .dfp-checkbox-group {
        max-height: none;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
       /* gap: 8px;*/
    }
    
    .dfp-checkbox-label {
        display: inline-block;
        width: auto;
        max-width: calc(50% - 4px);
        margin-bottom: 6px;
        margin-right: 6px;
        box-sizing: border-box;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .dfp-radio-group {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        width: 100%;
        gap: 6px;
    }
    
    .dfp-radio-label {
        display: inline-block;
        width: auto;
        max-width: calc(50% - 4px);
        margin-bottom: 6px;
        margin-right: 6px;
        box-sizing: border-box;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    /* 範囲指定フィールドのレスポンシブ対応 */
    .dfp-range-container {
        flex-direction: row;
        gap: 8px;
        width: 100%;
        flex-wrap: nowrap;
    }
    
    .dfp-range-min,
    .dfp-range-max {
        flex: 1;
        min-width: 0;
        box-sizing: border-box;
    }
    
    .dfp-range-container::before {
        flex-shrink: 0;
        margin: 0 4px;
    }
    
    /* セレクトフィールドの幅調整 */
    .dfp-select-field {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* テキストフィールドの幅調整 */
    .dfp-text-field {
        width: 100%;
        box-sizing: border-box;
    }
    
    /* モバイルでのリンクタッチ対応 */
    .dfp-result-item-link {
        -webkit-tap-highlight-color: rgba(0, 115, 170, 0.1);
    }
    
    .dfp-result-item-link:hover {
        transform: none; /* モバイルではホバー効果を無効化 */
    }
    
    /* 結果ヘッダーのレスポンシブ対応 */
    .dfp-results-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
        padding: 0.75rem;
    }
    
    .dfp-results-sort {
        width: 100%;
        justify-content: flex-end;
    }
    
    .dfp-sort-select {
        width: auto;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .dfp-form-actions {
        flex-direction: column;
        flex-basis: 100%;
        margin-top: 1rem;
    }
    
    .dfp-filter-button,
    .dfp-reset-button {
        width: 100%;
        padding: 12px 20px;
    }
    
    .dfp-title {
        font-size: 1.1rem;
    }
    
    /* より小さい画面での調整 */
    .dfp-filter-form-container {
        padding: 0 5px;
    }
    
    .dfp-field-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .dfp-checkbox-text,
    .dfp-radio-text {
        font-size: 13px;
        line-height: 1.4;
    }
    
    /* より小さい画面では1列にする */
    .dfp-checkbox-label,
    .dfp-radio-label {
        max-width: 100%;
        margin-right: 0;
    }
    
    /* 画像マッピング対応時の調整 */
    .dfp-checkbox-image,
    .dfp-radio-image {
        /* カスタムCSSで調整してください */
    }
}

/* ==========================================================================
   カスタマイズ用クラス
   ========================================================================== */

/* グリッドレイアウト（2列） */
.dfp-results-grid-2 .dfp-results-container {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

/* グリッドレイアウト（3列） */
.dfp-results-grid-3 .dfp-results-container {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* コンパクト表示 */
.dfp-compact .dfp-result-item {
    padding: 1rem;
}

.dfp-compact .dfp-field {
    margin-bottom: 0.5rem;
}

.dfp-compact .dfp-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

/* カード風表示 */
.dfp-card-style .dfp-result-item {
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    border: none;
}

.dfp-card-style .dfp-result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* リスト表示 */
.dfp-list-style .dfp-results-container {
    display: block;
}

.dfp-list-style .dfp-result-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.dfp-list-style .dfp-featured-image {
    flex-shrink: 0;
    margin-bottom: 0;
}

.dfp-list-style .dfp-featured-img {
    width: 80px;
    height: 80px;
    object-fit: cover;
}

.dfp-list-style .dfp-content-area {
    flex: 1;
}

/* ダークテーマ */
.dfp-dark-theme .dfp-filter-form-container {
    background: #2c2c2c;
    border-color: #444;
    color: white;
}

.dfp-dark-theme .dfp-field-label {
    color: white;
}

.dfp-dark-theme .dfp-select-field {
    background: #333;
    border-color: #555;
    color: white;
}

.dfp-dark-theme .dfp-checkbox-group {
    background: #333;
    border-color: #555;
}

.dfp-dark-theme .dfp-result-item {
    background: #2c2c2c;
    border-color: #444;
    color: white;
}

/* ACFフィールド表示 */
.dfp-acf-field {
    margin-bottom: 0.5rem;
}

.dfp-label {
    font-weight: 600;
    color: #333;
}

/* 画像表示 */
.dfp-acf-image {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.dfp-image-thumbnail {
    max-width: 150px;
    max-height: 150px;
}

.dfp-image-medium {
    max-width: 300px;
    max-height: 300px;
}

.dfp-image-large {
    max-width: 500px;
    max-height: 500px;
}

.dfp-image-full {
    max-width: 100%;
}

/* ファイルリンク */
.dfp-file-link {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    background: #f0f0f0;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    transition: background-color 0.2s;
}

.dfp-file-link:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.dfp-file-link::before {
    content: "📎";
    margin-right: 0.25rem;
}

/* リンクボタン */
.dfp-link-button,
.dfp-url-button {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: #0073aa;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.dfp-link-button:hover,
.dfp-url-button:hover {
    background: #005a87;
    color: white;
    text-decoration: none;
}

/* 通常のリンク */
.dfp-link,
.dfp-url-link {
    color: #0073aa;
    text-decoration: underline;
}

.dfp-link:hover,
.dfp-url-link:hover {
    color: #005a87;
}

/* アイコン表示 */
.dfp-icon-check {
    color: #46b450;
    font-weight: bold;
}

.dfp-icon-cross {
    color: #d63638;
    font-weight: bold;
}

/* ==========================================================================
   ページネーション
   ========================================================================== */

.dfp-pagination {
    margin-top: 2rem;
    text-align: center;
    padding: 1rem 0;
}

.dfp-load-more-button {
    background: #0073aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    min-width: 80px;
}

.dfp-load-more-button:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.dfp-load-more-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.dfp-load-more-button:disabled:hover {
    background: #ccc;
    transform: none;
    box-shadow: none;
}

/* ページネーション情報表示 */
.dfp-pagination-info {
    margin-top: 1rem;
    color: #666;
    font-size: 14px;
    text-align: center;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .dfp-load-more-button {
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .dfp-pagination {
        margin-top: 1.5rem;
        padding: 0.5rem 0;
    }
} 

/* ==========================================================================
   スムーズスクロール
   ========================================================================== */

/* スムーズスクロールのベース設定 */
html {
    scroll-behavior: smooth;
}

/* 結果エリアのスクロール時の上部マージン */
.dfp-results-wrapper {
    scroll-margin-top: 50px;
}

/* スクロール時のアニメーション効果（オプション） */
.dfp-results-scrolling {
    animation: dfp-highlight 1s ease-out;
}

@keyframes dfp-highlight {
    0% {
        background-color: rgba(0, 115, 170, 0.1);
    }
    100% {
        background-color: transparent;
    }
}

.dfp-range-separator {
    margin: 0 5px;
    color: #666;
    font-weight: normal;
}

/* 画像マッピング表示 */
.dfp-image-mapped {
    max-height: 40px;
    vertical-align: middle;
    /*border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);*/
    margin-right: 5px;
}

.dfp-text-unmapped {
    display: inline-block;
    margin-left: 5px;
    color: #666;
}

/* チェックボックス・ラジオボタンの画像マッピング */
.dfp-checkbox-image,
.dfp-radio-image {
    max-height: 60px;
    max-width: 100px;
    margin-left: 8px;
    vertical-align: middle;
    /*border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: all 0.2s ease;*/
    cursor: pointer;
}

.dfp-checkbox-label,
.dfp-radio-label {
    display: inline-block;
    margin-right: 15px;
    margin-bottom: 8px;
    padding: 8px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #f9f9f9;
    vertical-align: top;
}

.dfp-checkbox-label:hover,
.dfp-radio-label:hover {
    background: #f0f0f0;
    border-color: #ddd;
}

/* チェック状態のスタイル */
.dfp-checkbox-label:has(input:checked),
.dfp-radio-label:has(input:checked) {
    background: #e3f2fd;
    border-color: #2196f3;
    /*box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);*/
}

/* 古いブラウザ対応（:hasセレクタが使えない場合） */
.dfp-checkbox-label.checked,
.dfp-radio-label.checked {
    background: #e3f2fd;
    border-color: #2196f3;
   /* box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);*/
}

.dfp-checkbox-label input,
.dfp-radio-label input {
    margin-right: 8px;
    vertical-align: middle;
}

/* 画像マッピングがある場合はチェックボックス・ラジオボタンを非表示 */
.dfp-checkbox-label.dfp-has-image input,
.dfp-radio-label.dfp-has-image input {
    display: none;
}

/* 画像がある場合のラベル内の画像の位置調整 */
.dfp-checkbox-label.dfp-has-image,
.dfp-radio-label.dfp-has-image {
    padding: 0px;
}

.dfp-checkbox-label.dfp-has-image .dfp-checkbox-image,
.dfp-radio-label.dfp-has-image .dfp-radio-image {
    margin-left: 0;
    margin-right: 0;
}

.dfp-checkbox-image:hover,
.dfp-radio-image:hover {
  /*  transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);*/
}

/* 自然なレイアウト（元の形式） */
.dfp-checkbox-group,
.dfp-radio-group {
    margin-top: 8px;
}

/* 画像マッピングがない場合のレイアウト */
.dfp-checkbox-group:not(:has(.dfp-checkbox-image)) .dfp-checkbox-label,
.dfp-radio-group:not(:has(.dfp-radio-image)) .dfp-radio-label {
    background: transparent;
    padding: 4px 8px 4px 0;
    border: none;
    border-radius: 0;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .dfp-checkbox-image,
    .dfp-radio-image {
        /* カスタムCSSで調整してください */
    }
    
    .dfp-checkbox-label,
    .dfp-radio-label {
        padding: 6px;
        font-size: 0.9em;
        margin-right: 10px;
    }
}

