﻿/* ========================================
   Tom Select モダンデザイン 2025
   index.css から分離 - コード変更なし
   ======================================== */

/* === Tom Select モダンデザイン 2025（アーカイブページと完全一致） === */
/* Tom Select ラッパー */
.ts-wrapper {
    /* Tom Selectの一番外側 */
    position: relative;
    background: var(--container-bg) !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0;
}

/* Tom Select コントロール（入力フィールド）- グラスモーフィズム */
.ts-wrapper.single .ts-control {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.85) 100%) !important;
    border: 1.5px solid rgba(168, 85, 247, 0.2) !important;
    border-radius: 16px !important;
    padding: 12px 16px !important;
    min-height: 48px !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: #1e293b !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    backdrop-filter: blur(10px) saturate(150%);
    -webkit-backdrop-filter: blur(10px) saturate(150%);
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.08),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
    position: relative;
    overflow: hidden;
}

/* コントロールのホバー効果 */
.ts-wrapper.single .ts-control:hover {
    border-color: rgba(168, 85, 247, 0.35) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 250, 252, 0.9) 100%) !important;
    box-shadow:
        0 4px 12px rgba(168, 85, 247, 0.14),
        0 0 0 1px rgba(255, 255, 255, 0.6) inset !important;
    transform: translateY(-1px);
}

/* フォーカス時の現代的なスタイル */
.ts-wrapper.single .ts-control.focus,
.ts-wrapper.single .ts-control:focus-within {
    border-color: rgba(168, 85, 247, 0.55) !important;
    background: rgba(255, 255, 255, 0.95) !important;
    box-shadow:
        0 4px 16px rgba(168, 85, 247, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.7) inset !important;
    outline: none !important;
    transform: translateY(-2px);
}

/* アクティブ状態（ドロップダウン開いている時） */
.ts-wrapper.single.dropdown-active .ts-control {
    border-color: #a855f7 !important;
    border-bottom-left-radius: 4px !important;
    border-bottom-right-radius: 4px !important;
    background: #ffffff !important;
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.3) !important;
}

/* ドロップダウンメニューの最新デザイン */
.ts-dropdown {
    background: #ffffff !important;
    border: 2px solid #a855f7 !important;
    border-top: none !important;
    border-radius: 0 0 12px 12px !important;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(168, 85, 247, 0.24) !important;
    margin-top: -2px !important;
    z-index: 1000 !important;
    overflow: hidden;
    backdrop-filter: blur(8px);
    width: auto !important;
    min-width: 100% !important;
    max-width: none !important;
}

/* 基本的なオプションスタイルはTom Selectのデフォルトを使用（アーカイブページと一致） */

/* optgroupヘッダー */
.ts-dropdown .optgroup-header {
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%) !important;
    color: #475569 !important;
    font-weight: 600 !important;
    font-size: 0.75rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    padding: 8px 20px !important;
    cursor: default !important;
    border-bottom: 2px solid #cbd5e1;
}

/* 無効なオプション */
.ts-dropdown .option.disabled {
    color: #94a3b8 !important;
    background: #f8fafc !important;
    font-weight: 400 !important;
    font-style: italic !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    transform: none !important;
}

/* カテゴリ選択特殊スタイル */
.ts-dropdown .option.category_select {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%) !important;
    color: #3730a3 !important;
    font-weight: 600 !important;
    border-left: 4px solid #6366f1 !important;
    padding-left: 16px !important;
}

/* コントロールの無効状態 */
.ts-wrapper.single .ts-control.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #94a3b8 !important;
    border-color: #e2e8f0 !important;
    transform: none !important;
}

/* 無効な選択ラッパー - アーカイブページから削除（重複） */

/* === カテゴリ連動の視覚的フィードバック === */
.select-wrapper.loading .ts-control {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.select-wrapper.loading .ts-control::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 重複削除 - この定義は既に上の部分で含まれている */

/* スピンアニメーション */
@keyframes spin {
    0% {
        transform: translateY(-50%) rotate(0deg);
    }

    100% {
        transform: translateY(-50%) rotate(360deg);
    }
}

/* カテゴリオプションの特殊スタイル */
.ts-dropdown .option.option-disabled {
    color: #9ca3af !important;
    background: #f8fafc !important;
    font-style: italic !important;
    cursor: not-allowed !important;
}

.ts-dropdown .option.option-all {
    font-weight: 600 !important;
    color: #059669 !important;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
    border-left: 3px solid var(--success-color) !important;
    padding-left: 17px !important;
}

.ts-dropdown .option.option-empty {
    color: #6b7280 !important;
    background: #f9fafb !important;
    font-style: italic !important;
    text-align: center !important;
}

/* ダークモード対応 - グラスモーフィズム */
@media (prefers-color-scheme: dark) {
    .ts-wrapper.single .ts-control {
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.85) 0%, rgba(38, 50, 65, 0.8) 100%) !important;
        backdrop-filter: blur(10px) saturate(150%);
        -webkit-backdrop-filter: blur(10px) saturate(150%);
        border-color: rgba(168, 85, 247, 0.35) !important;
        box-shadow:
            0 2px 8px rgba(0, 0, 0, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.1) inset !important;
        color: #f1f5f9 !important;
    }

    .ts-wrapper.single .ts-control:hover {
        border-color: rgba(168, 85, 247, 0.45) !important;
        background: linear-gradient(135deg, rgba(30, 41, 59, 0.9) 0%, rgba(38, 50, 65, 0.85) 100%) !important;
        box-shadow:
            0 4px 12px rgba(168, 85, 247, 0.24),
            0 0 0 1px rgba(255, 255, 255, 0.15) inset !important;
    }

    .ts-wrapper.single .ts-control.focus,
    .ts-wrapper.single .ts-control:focus-within {
        border-color: rgba(168, 85, 247, 0.6) !important;
        background: rgba(30, 41, 59, 0.95) !important;
        box-shadow:
            0 4px 16px rgba(168, 85, 247, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.2) inset !important;
    }

    .ts-wrapper.single.dropdown-active .ts-control {
        border-color: #a855f7 !important;
        background: #1e293b !important;
    }

    .ts-dropdown {
        background: #1e293b !important;
        border-color: #a855f7 !important;
        width: auto !important;
        /* アーカイブページと同じく、コンテンツ幅に合わせる */
        min-width: 100% !important;
        /* 最小幅はコントロールと同じ */
    }

    /* ドロップダウンのオプション基本色 */
    .ts-dropdown .option {
        color: #f1f5f9 !important;
        background: #1e293b !important;
    }

    /* 基本的なオプションスタイルはTom Selectのデフォルトを使用（アーカイブページと一致） */

    .ts-dropdown .optgroup-header {
        background: linear-gradient(135deg, #334155 0%, #475569 100%) !important;
        color: #cbd5e1 !important;
        border-bottom-color: #64748b;
    }

    .ts-dropdown .option:hover,
    .ts-dropdown .option.active,
    .ts-dropdown .option.focus {
        background: #2b364b !important;
        color: #fff !important;
    }

    .ts-dropdown .option.disabled {
        color: #64748b !important;
        background: #0f172a !important;
    }

    .ts-wrapper.single .ts-control.disabled {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
        color: #64748b !important;
        border-color: #334155 !important;
    }
}
