/* フィルタダイアログのスタイル */

.filter-dialog {
    background: var(--dialog-bg-purple);
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    position: relative;
    color: var(--text-primary);
}

/* ヘッダー削除によりフッターマージン調整など必要かも */
.filter-dialog.compact {
    padding: 1.25rem;
}

.filter-dialog-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.filter-row {
    margin-bottom: 0.25rem;
}

/* 属性ボタン */
.attribute-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    /* 中央寄せ */
}

.attribute-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border-radius: 20px;
    /* 丸みを強く */
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.attribute-btn svg {
    width: 16px;
    height: 16px;
}

.attribute-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.2);
}

.attribute-btn.selected {
    background: #9575cd;
    /* Using a purple accent to match the theme */
    border-color: #9575cd;
    color: #fff;
    box-shadow: 0 4px 12px rgba(149, 117, 205, 0.3);
}

/* キーワード入力のラッパー (横並び) */
.keyword-input-wrapper {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.keyword-input {
    flex: 1;
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    min-width: 0;
    /* Flexbox overflow fix */
}

.keyword-input::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.keyword-input:focus {
    outline: none;
    border-color: #9575cd;
    background: rgba(255, 255, 255, 0.9);
}

/* ターゲット切り替えボタン (トグル・サイクル) */
.target-toggle-cycle-btn {
    padding: 0.6rem 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
    transition: all 0.2s ease;
}

.target-toggle-cycle-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.target-toggle-cycle-btn:active {
    transform: scale(0.98);
}

/* 期間入力 (横並び) */
.date-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.date-input {
    flex: 1;
    padding: 0.6rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s ease;
    min-width: 0;
}

/* カレンダーアイコン */
.date-input::-webkit-calendar-picker-indicator {
    filter: none;
    opacity: 0.6;
    cursor: pointer;
    /* absolute positioning to cover full input area is one hack, but handled via onclick in JS usually */
}

.date-input:focus {
    outline: none;
    border-color: #9575cd;
    background: rgba(255, 255, 255, 0.9);
}

.date-separator {
    color: var(--text-secondary);
    font-weight: bold;
}

/* フッター */
.filter-dialog-footer {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.25rem;
}

.filter-reset-btn,
.filter-apply-btn {
    flex: 1;
    padding: 0.7rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
    box-shadow: none;
}

.filter-reset-btn:hover,
.filter-apply-btn:hover {
    background: rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

/* 適用ボタンは少し強調してもいいかも */
.filter-apply-btn {
    color: #7e57c2;
    border-color: rgba(126, 87, 194, 0.3);
}

.filter-apply-btn:hover {
    background: rgba(126, 87, 194, 0.1);
}

/* 閉じるボタン */
.close-dialog-btn {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    background: transparent;
    border: none;
    color: #9575cd;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 10;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-dialog-btn:hover {
    background: rgba(149, 117, 205, 0.1);
    color: #7e57c2;
}

/* スクロールバーのスタイル */
.filter-dialog::-webkit-scrollbar {
    width: 6px;
}

.filter-dialog::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

.filter-dialog::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

/* レスポンシブ対応 */
@media (max-width: 400px) {
    .filter-dialog {
        padding: 1rem;
        width: 95%;
    }

    .keyword-input-wrapper {
        flex-direction: row;
    }

    .target-toggle-cycle-btn {
        min-width: 60px;
        padding: 0.6rem 0.5rem;
        font-size: 0.8rem;
    }
}